class
SpriteTexture
Implementation of SpriteImage that uses a user-provided texture as the atlas texture.
Public
Methods
FindOrAllocateImageToFitArea
Attempts to allocate a new image that is of appropriate quality to fit into the provided area.
This is mostly used by vector shapes, which will usually want to re-render themselves to fit the requested size and achieve the best possible quality.
The image will be scaled uniformly until one or both dimensions of the image match the provided size. One dimension may be smaller than the provided size.
Implementations may choose to avoid re-rendering and just return the default allocated image instead, in which case its up to the caller to scale the image appropriately (e.g. using bilinear filtering or scale9grid).
If an existing allocation for the provided size already exists, it will be returned and a new allocation will not be made alive. Allocated portion of the texture will remain alive as long as there is at least a single reference to the returned SpriteImageAllocation.
- size
- Requested size of the allocation, in physical pixel units.
Returns: Allocation structure that provides information about the allocation and used for tracking allocation lifetime.
FindOrAllocateScaledImage
Attempts to allocate a new image that is of appropriate quality for a scaled version of the default image.
This is mostly used by vector shapes, which will usually want to re-render themselves to fit the requested scale and achieve the best possible quality (e.g. scale may change when display DPI changes, or when user zooms in/out).
Implementations may choose to avoid re-rendering and just return the default allocated image instead, in which case its up to the caller to scale the image appropriately (e.g. using bilinear filtering or scale9grid).
If an existing allocation for the provided size already exists, it will be returned and a new allocation will not be made alive. Allocated portion of the texture will remain alive as long as there is at least a single reference to the returned SpriteImageAllocation.
- scale
- Scale to apply.
Returns: Allocation structure that provides information about the allocation and used for tracking allocation lifetime.
GetAtlasTexture
Retrieves the atlas texture where the image is stored.
staticCreate
Creates a new sprite texture that references the entire area of the provided texture.
staticCreate
Creates a new sprite texture that references a sub-area of the provided texture.
staticGetRttiStatic
Private
Constructors
SpriteTexture
Methods
Initialize
Initializes all the internal data of this object.
Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.
CreateRenderProxy
Creates an object that contains render thread specific data and methods for this object.
Can be null if such object is not required.
CreateRenderProxySyncPacket
Creates a data packet that will be used for syncing the core object with it's render proxy.
Caller must free the retrieved packet using the provided allocator when done using it.
GetCoreDependencies
Populates the provided array with all core objects that this core object depends upon.
Dependencies are required for syncing to the render thread, so the system can be aware to update the dependant objects if a dependency is marked as dirty (for example updating a camera's viewport should also trigger an update on camera so it has a chance to potentially update its data).
staticCreateEmpty
Creates a new empty and uninitialized sprite texture.