UTFWin::ImageDrawable class

A standard IDrawable that renders an image.

Base classes

class IDrawable
A class that is capable of drawing a user interface component.
class DefaultLayoutElement
A default implementation of ILayoutElement.
class IImageDrawable
An abstract class that has the methods that a drawable that renders an image would require.

Constructors, destructors, conversion operators

ImageDrawable()
~ImageDrawable() virtual

Public functions

auto AddRef() -> int override
auto Release() -> int override
auto Cast(uint32_t type) const -> void* override
void SetSerializer(Serializer& dst) override
auto GetProxyID() const -> uint32_t override
Returns the ID that identifies this type of element in a SPUI file.
void Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) override
Paints this drawable onto the given UIRenderer.
auto IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) -> bool override
Tells whether the point specified is colliding in this drawable or not.
auto GetDimensions(Dimensions& dst, int state, int index) -> bool override
Used to get the dimensions of an image contained in this drawable.
auto UseCollision(uint32_t type, bool& dst) -> bool override
Tells whether the collision of a window should be handled by this drawable or not.
auto ToDrawable() -> IDrawable* override
Get the IDrawable instance that represents this class.
void SetImage(Image* pImage) override
Sets the image to be shown.
auto GetImage() const -> Image* override
Gets the image to be shown.
auto GetImageDrawableFlags() const -> int override
Gets the flags used in this drawable.
void SetImageDrawableFlags(int flags) override
Sets the flags used in this drawable.
void SetImageDrawableFlag(int flag, bool bValue) override
Sets the specific drawable flag to the value given.
void SetTiling(ImageTiling tiling) override
Sets the tiling method that will be used in this drawable.
auto GetTiling() const -> ImageTiling override
Gets the tiling method that is being used in this drawable.
void SetScale(float fScale) override
Sets the scale of the image.
auto GetScale() const -> float override
Gets the scale of the image, as a float value.
void SetAlignmentHorizontal(AlignmentH alignment) override
Sets the horizontal alignment of the image.
auto GetAlignmentHorizontal() const -> AlignmentH override
Gets the horizontal alignment of the image.
void SetAlignmentVertical(AlignmentV alignment) override
Sets the vertical alignment of the image.
auto GetAlignmentVertical() const -> AlignmentV override
Gets the vertical alignment of the image.

Protected variables

float mfScale
int mnFlags
ImageTiling mTiling
AlignmentH mAlignmentHorizontal
AlignmentV mAlignmentVertical
intrusive_ptr<Image> mpImage
OutlineFormat mImageOutline

Function documentation

void UTFWin::ImageDrawable::Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) override

Paints this drawable onto the given UIRenderer.

Parameters
pRenderer The UIRenderer where this must be drawn.
area The area of the window to draw.
params RenderParams that contain additional information (e.g. what image do draw, the current state, etc).

bool UTFWin::ImageDrawable::IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) override

Tells whether the point specified is colliding in this drawable or not.

Parameters
area The area of the window that is using this drawable.
point The Point to check whether it collides or not. Its coordinates are relative to the window position.
params Additional information, probably unused.

This method is useful for drawables that use hitmasks.

bool UTFWin::ImageDrawable::GetDimensions(Dimensions& dst, int state, int index) override

Used to get the dimensions of an image contained in this drawable.

Parameters
dst out The Dimensions where the result must be written.
state The current state flags of the window.
index The index of the image whose dimensions must be returned.
Returns True if the dimensions were got, false otherwise.

bool UTFWin::ImageDrawable::UseCollision(uint32_t type, bool& dst) override

Tells whether the collision of a window should be handled by this drawable or not.

Parameters
type The type, usually kDefaultCollisionType.
dst out If the collision type is supported, whether it must be handled by this drawable or not.
Returns True if the collision type is supported (even if it's not handled by this drawable), false otherwise.

void UTFWin::ImageDrawable::SetImage(Image* pImage) override

Sets the image to be shown.

Parameters
pImage The image that will be used by this drawable.

int UTFWin::ImageDrawable::GetImageDrawableFlags() const override

Gets the flags used in this drawable.

The flags are the AbstractImageDrawable::kFlag... values.

void UTFWin::ImageDrawable::SetImageDrawableFlags(int flags) override

Sets the flags used in this drawable.

Parameters
flags The new flags value.

The flags are the AbstractImageDrawable::kFlag... values.

void UTFWin::ImageDrawable::SetImageDrawableFlag(int flag, bool bValue) override

Sets the specific drawable flag to the value given.

Parameters
flag The flag to set.
bValue The new bool value of the flag.

The possible flags are the AbstractImageDrawable::kFlag... values.

void UTFWin::ImageDrawable::SetTiling(ImageTiling tiling) override

Sets the tiling method that will be used in this drawable.

Parameters
tiling ImageTiling The tiling to use, in the ImageTiling enum.

void UTFWin::ImageDrawable::SetScale(float fScale) override

Sets the scale of the image.

Parameters
fScale The new scale value.

void UTFWin::ImageDrawable::SetAlignmentHorizontal(AlignmentH alignment) override

Sets the horizontal alignment of the image.

Parameters
alignment The new alignment value, in the enum AlignmentH.

void UTFWin::ImageDrawable::SetAlignmentVertical(AlignmentV alignment) override

Sets the vertical alignment of the image.

Parameters
alignment The new alignment value, in the enum AlignmentV.