|
| 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 FileIdentifier &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 ea::string &fileName) const |
| Save in BMP format. Return true if successful.
|
|
bool | SavePNG (const ea::string &fileName) const |
| Save in PNG format. Return true if successful.
|
|
bool | SaveTGA (const ea::string &fileName) const |
| Save in TGA format. Return true if successful.
|
|
bool | SaveJPG (const ea::string &fileName, int quality) const |
| Save in JPG format with specified quality. Return true if successful.
|
|
bool | SaveDDS (const ea::string &fileName) const |
| Save in DDS format. Only uncompressed RGBA images are supported. Return true if successful.
|
|
bool | SaveWEBP (const ea::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.
|
|
TextureFormat | GetGPUFormat () const |
| Return internal GPU format corresponding to the Image format. Return unknown if there is no such format.
|
|
int | GetWidth () const |
|
int | GetHeight () const |
|
int | GetDepth () const |
|
IntVector3 | GetSize () const |
| Return size of the image.
|
|
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.
|
|
SharedPtr< Image > | GetDecompressedImageLevel (unsigned index) const |
| Return LOD of decompressed image in RGBA format.
|
|
SharedPtr< 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 (ea::vector< Image * > &levels) |
| Get all stored mip levels starting from this.
|
|
void | GetLevels (ea::vector< 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 FileIdentifier &fileName) |
| Load resource from file.
|
|
void | SetName (const ea::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.
|
|
void | SetAbsoluteFileName (const ea::string &fileName) |
| Set absolute file name.
|
|
const ea::string & | GetName () const |
|
StringHash | GetNameHash () const |
| Return name hash.
|
|
unsigned | GetMemoryUse () const |
|
unsigned | GetUseTimer () |
|
AsyncLoadState | GetAsyncLoadState () const |
| Return the asynchronous loading state.
|
|
const ea::string & | GetAbsoluteFileName () const |
| Return absolute file name.
|
|
| Object (Context *context) |
| Construct.
|
|
| ~Object () override |
| Destruct. Clean up self from event sender & receiver structures.
|
|
virtual StringHash | GetType () const =0 |
|
virtual const ea::string & | GetTypeName () const =0 |
|
virtual const TypeInfo * | GetTypeInfo () const =0 |
| Return type info.
|
|
virtual bool | IsInstanceOf (StringHash type) const =0 |
| Check whether current instance implements specified type.
|
|
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
| Handle event.
|
|
virtual void | SerializeInBlock (Archive &archive) |
| Serialize content from/to archive. May throw ArchiveException.
|
|
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 | SubscribeToEventManual (StringHash eventType, EventHandler *handler) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEventManual (Object *sender, StringHash eventType, EventHandler *handler) |
| Subscribe to a specific sender's event.
|
|
template<class T > |
void | SubscribeToEvent (StringHash eventType, T handler) |
| Subscribe to an event that can be sent by any sender.
|
|
template<class T > |
void | SubscribeToEvent (Object *sender, StringHash eventType, T handler) |
| 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 ea::vector< StringHash > &exceptions) |
| Unsubscribe from all events except those listed.
|
|
void | UnsubscribeFromAllEventsExcept (const ea::vector< Object * > &exceptions) |
| Unsubscribe from all events except those with listed senders.
|
|
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, const Args &... args) |
| Send event with variadic parameter pairs to all subscribers. The parameters are (paramID, paramValue) pairs.
|
|
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 ea::string & | GetCategory () const |
|
void | SendEvent (StringHash eventType, const VariantMap &eventData) |
| Send event with parameters to all subscribers.
|
|
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.
|
|
int | AddRef () |
|
int | ReleaseRef () |
|
int | Refs () const |
|
int | WeakRefs () const |
|
RefCount * | RefCountPtr () const |
| Return pointer to the reference count structure.
|
|
bool | HasScriptObject () const |
| Return true if script runtime object wrapping this native object exists.
|
|
bool | IsScriptStrongRef () const |
| Return true if script reference is strong.
|
|