class
SpriteImage
Image that references a part of a texture by specifying an UV range.
When the sprite image is rendered only the portion of the texture specified by the UV range will be rendered.
Sprite images also allow you to specify sprite sheet animation by varying which portion of the UV is selected over time.
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.
DeallocateImage
Frees any data associated with the provided allocation.
staticGetRttiStatic
~TSpriteImage<IsRenderProxy>
EvaluateAnimation
Evaluates the UV coordinate offset and size to use at the specified animation time.
If the sprite texture doesn't have animation playback enabled then just the default offset and size will be provided, otherwise the animation will be evaluated and appropriate UV returned.
- allocation
- Image allocation to evaluate animation for. Must be owned by this sprite image.
- t
- Time to evaluate the animation at.
Returns: UV range of the animation frame at the specified time.
GetDefaultAllocatedImage
Returns the default (unscaled) image allocation, using the image size as provided on the sprite image construction.
GetAnimationFrameSize
Returns the size of a single animation frame in logical pixel units.
If the texture has no animation this is the same as GetLogicalSize().
Internal
Methods
MarkRenderProxyDataDirtyInternal
Protected
Constructors
SpriteImage
Methods
Destroy
Frees all the data held by this object.
If the object has a render proxy, the internal reference to the render proxy will be released, but the proxy will not be destroyed unless this was the last reference. If render proxy destruction does happen, it is not immediate, but rather queued for destruction 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.