|
| Image (Context *context) |
| Construct empty.
|
|
| ~Image () override |
| Destruct.
|
|
bool | BeginLoad (Deserializer &source) override |
| Load resource from stream. May be called from a worker thread. Return true if successful.
|
|
bool | Save (Serializer &dest) const override |
| Save the image to a stream. Regardless of original format, the image is saved as png. Compressed image data is not supported. Return true if successful.
|
|
bool | SaveFile (const String &fileName) const override |
| Save the image to a file. Format of the image is determined by file extension. JPG is saved with maximum quality.
|
|
bool | SetSize (int width, int height, unsigned components) |
| Set 2D size and number of color components. Old image data will be destroyed and new data is undefined. Return true if successful.
|
|
bool | SetSize (int width, int height, int depth, unsigned components) |
| Set 3D size and number of color components. Old image data will be destroyed and new data is undefined. Return true if successful.
|
|
void | SetData (const unsigned char *pixelData) |
| Set new image data.
|
|
void | SetPixel (int x, int y, const Color &color) |
| Set a 2D pixel.
|
|
void | SetPixel (int x, int y, int z, const Color &color) |
| Set a 3D pixel.
|
|
void | SetPixelInt (int x, int y, unsigned uintColor) |
| Set a 2D pixel with an integer color. R component is in the 8 lowest bits.
|
|
void | SetPixelInt (int x, int y, int z, unsigned uintColor) |
| Set a 3D pixel with an integer color. R component is in the 8 lowest bits.
|
|
bool | LoadColorLUT (Deserializer &source) |
| Load as color LUT. Return true if successful.
|
|
bool | FlipHorizontal () |
| Flip image horizontally. Return true if successful.
|
|
bool | FlipVertical () |
| Flip image vertically. Return true if successful.
|
|
bool | Resize (int width, int height) |
| Resize image by bilinear resampling. Return true if successful. More...
|
|
void | Clear (const Color &color) |
| Clear the image with a color.
|
|
void | ClearInt (unsigned uintColor) |
| Clear the image with an integer color. R component is in the 8 lowest bits.
|
|
bool | SaveBMP (const String &fileName) const |
| Save in BMP format. Return true if successful.
|
|
bool | SavePNG (const String &fileName) const |
| Save in PNG format. Return true if successful.
|
|
bool | SaveTGA (const String &fileName) const |
| Save in TGA format. Return true if successful.
|
|
bool | SaveJPG (const String &fileName, int quality) const |
| Save in JPG format with specified quality. Return true if successful.
|
|
bool | SaveDDS (const String &fileName) const |
| Save in DDS format. Only uncompressed RGBA images are supported. Return true if successful.
|
|
bool | SaveWEBP (const String &fileName, float compression=0.0f) const |
| Save in WebP format with minimum (fastest) or specified compression. Return true if successful. Fails always if WebP support is not compiled in.
|
|
bool | IsCubemap () const |
|
bool | IsArray () const |
|
bool | IsSRGB () const |
|
Color | GetPixel (int x, int y) const |
| Return a 2D pixel color.
|
|
Color | GetPixel (int x, int y, int z) const |
| Return a 3D pixel color.
|
|
unsigned | GetPixelInt (int x, int y) const |
| Return a 2D pixel integer color. R component is in the 8 lowest bits.
|
|
unsigned | GetPixelInt (int x, int y, int z) const |
| Return a 3D pixel integer color. R component is in the 8 lowest bits.
|
|
Color | GetPixelBilinear (float x, float y) const |
| Return a bilinearly sampled 2D pixel color. X and Y have the range 0-1.
|
|
Color | GetPixelTrilinear (float x, float y, float z) const |
| Return a trilinearly sampled 3D pixel color. X, Y and Z have the range 0-1.
|
|
int | GetWidth () const |
|
int | GetHeight () const |
|
int | GetDepth () const |
|
unsigned | GetComponents () const |
|
unsigned char * | GetData () const |
| Return pixel data.
|
|
bool | IsCompressed () const |
|
CompressedFormat | GetCompressedFormat () const |
|
unsigned | GetNumCompressedLevels () const |
|
SharedPtr< Image > | GetNextLevel () const |
| Return next mip level by bilinear filtering. Note that if the image is already 1x1x1, will keep returning an image of that size.
|
|
SharedPtr< Image > | GetNextSibling () const |
| Return the next sibling image of an array or cubemap.
|
|
SharedPtr< Image > | ConvertToRGBA () const |
| Return image converted to 4-component (RGBA) to circumvent modern rendering API's not supporting e.g. the luminance-alpha format.
|
|
CompressedLevel | GetCompressedLevel (unsigned index) const |
| Return a compressed mip level.
|
|
SharedPtr< Image > | GetDecompressedImage () const |
| Return decompressed image data in RGBA format.
|
|
Image * | GetSubimage (const IntRect &rect) const |
| Return subimage from the image by the defined rect or null if failed. 3D images are not supported. You must free the subimage yourself.
|
|
SDL_Surface * | GetSDLSurface (const IntRect &rect=IntRect::ZERO) const |
| Return an SDL surface from the image, or null if failed. Only RGB images are supported. Specify rect to only return partial image. You must free the surface yourself.
|
|
void | PrecalculateLevels () |
| Precalculate the mip levels. Used by asynchronous texture loading.
|
|
bool | HasAlphaChannel () const |
|
bool | SetSubimage (const Image *image, const IntRect &rect) |
| Copy contents of the image into the defined rect, scaling if necessary. This image should already be large enough to include the rect. Compressed and 3D images are not supported.
|
|
void | CleanupLevels () |
| Clean up the mip levels.
|
|
void | GetLevels (PODVector< Image * > &levels) |
| Get all stored mip levels starting from this.
|
|
void | GetLevels (PODVector< const Image * > &levels) const |
| Get all stored mip levels starting from this.
|
|
| Resource (Context *context) |
| Construct.
|
|
bool | Load (Deserializer &source) |
| Load resource synchronously. Call both BeginLoad() & EndLoad() and return true if both succeeded.
|
|
virtual bool | EndLoad () |
| Finish resource loading. Always called from the main thread. Return true if successful.
|
|
bool | LoadFile (const String &fileName) |
|
void | SetName (const String &name) |
|
void | SetMemoryUse (unsigned size) |
| Set memory use in bytes, possibly approximate.
|
|
void | ResetUseTimer () |
| Reset last used timer.
|
|
void | SetAsyncLoadState (AsyncLoadState newState) |
| Set the asynchronous loading state. Called by ResourceCache. Resources in the middle of asynchronous loading are not normally returned to user.
|
|
const String & | GetName () const |
|
StringHash | GetNameHash () const |
| Return name hash.
|
|
unsigned | GetMemoryUse () const |
|
unsigned | GetUseTimer () |
|
AsyncLoadState | GetAsyncLoadState () const |
| Return the asynchronous loading state.
|
|
| Object (Context *context) |
| Construct.
|
|
| ~Object () override |
| Destruct. Clean up self from event sender & receiver structures.
|
|
virtual StringHash | GetType () const =0 |
|
virtual const String & | GetTypeName () const =0 |
|
virtual const TypeInfo * | GetTypeInfo () const =0 |
| Return type info.
|
|
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
| Handle event.
|
|
bool | IsInstanceOf (StringHash type) const |
| Check current instance is type of specified type.
|
|
bool | IsInstanceOf (const TypeInfo *typeInfo) const |
| Check current instance is type of specified type.
|
|
template<typename T > |
bool | IsInstanceOf () const |
| Check current instance is type of specified class.
|
|
template<typename T > |
T * | Cast () |
| Cast the object to specified most derived class.
|
|
template<typename T > |
const T * | Cast () const |
| Cast the object to specified most derived class.
|
|
void | SubscribeToEvent (StringHash eventType, EventHandler *handler) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler) |
| Subscribe to a specific sender's event.
|
|
void | SubscribeToEvent (StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to a specific sender's event.
|
|
void | UnsubscribeFromEvent (StringHash eventType) |
| Unsubscribe from an event.
|
|
void | UnsubscribeFromEvent (Object *sender, StringHash eventType) |
| Unsubscribe from a specific sender's event.
|
|
void | UnsubscribeFromEvents (Object *sender) |
| Unsubscribe from a specific sender's events.
|
|
void | UnsubscribeFromAllEvents () |
| Unsubscribe from all events.
|
|
void | UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData) |
| Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events).
|
|
void | SendEvent (StringHash eventType) |
| Send event to all subscribers.
|
|
void | SendEvent (StringHash eventType, VariantMap &eventData) |
| Send event with parameters to all subscribers.
|
|
VariantMap & | GetEventDataMap () const |
| Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
|
|
template<typename... Args> |
void | SendEvent (StringHash eventType, Args... args) |
| Send event with variadic parameter pairs to all subscribers. The parameter pairs is a list of paramID and paramValue separated by comma, one pair after another.
|
|
Context * | GetContext () const |
| Return execution context.
|
|
const Variant & | GetGlobalVar (StringHash key) const |
|
const VariantMap & | GetGlobalVars () const |
|
void | SetGlobalVar (StringHash key, const Variant &value) |
|
Object * | GetSubsystem (StringHash type) const |
| Return subsystem by type.
|
|
Object * | GetEventSender () const |
| Return active event sender. Null outside event handling.
|
|
EventHandler * | GetEventHandler () const |
| Return active event handler. Null outside event handling.
|
|
bool | HasSubscribedToEvent (StringHash eventType) const |
| Return whether has subscribed to an event without specific sender.
|
|
bool | HasSubscribedToEvent (Object *sender, StringHash eventType) const |
| Return whether has subscribed to a specific sender's event.
|
|
bool | HasEventHandlers () const |
| Return whether has subscribed to any event.
|
|
template<class T > |
T * | GetSubsystem () const |
| Template version of returning a subsystem.
|
|
const String & | GetCategory () const |
|
void | SetBlockEvents (bool block) |
| Block object from sending and receiving events.
|
|
bool | GetBlockEvents () const |
| Return sending and receiving events blocking status.
|
|
| RefCounted () |
| Construct. Allocate the reference count structure and set an initial self weak reference.
|
|
virtual | ~RefCounted () |
| Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
|
|
| RefCounted (const RefCounted &rhs)=delete |
| Prevent copy construction.
|
|
RefCounted & | operator= (const RefCounted &rhs)=delete |
| Prevent assignment.
|
|
void | AddRef () |
| Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
|
|
void | ReleaseRef () |
| Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
|
|
int | Refs () const |
|
int | WeakRefs () const |
|
RefCount * | RefCountPtr () |
| Return pointer to the reference count structure.
|
|