21#ifndef GF_NINE_PATCH_H
22#define GF_NINE_PATCH_H
24#include "GraphicsApi.h"
25#include "Transformable.h"
27#include "VertexBuffer.h"
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
92 [[deprecated(
"You should use setTexture(const Texture&, const RectF&) instead")]]
135 return m_texture !=
nullptr;
172 return m_textureRect;
209 void setLimits(
float top,
float bottom,
float left,
float right);
285 void updatePositions();
286 void updateTexCoords();
303#ifndef DOXYGEN_SHOULD_SKIP_THIS
A nine-patch.
Definition: NinePatch.h:46
void unsetTexture()
Unset the source texture of the nine-patch.
VertexBuffer commitGeometry() const
Create a buffer with the current geometry.
RectF getLocalBounds() const
Get the local bounding rectangle of the entity.
virtual void draw(RenderTarget &target, const RenderStates &states) override
Draw the object to a render target.
void setColor(const Color4f &color)
Set the global color of the nine-patch.
NinePatch(const Texture &texture)
Construct the nine-patch from a source texture.
void setVerticalLimits(float top, float bottom)
Set the vertical limits of the stretchable area.
void setSize(Vector2f size)
Set the size of the stretched area.
NinePatch(const Texture &texture, const RectF &textureRect)
Construct the nine-patch from a sub-rectangle of a source texture.
void setAnchor(Anchor anchor)
Set the anchor origin of the entity.
void setTexture(const Texture &texture, bool resetRect)
Change the source texture of the nine-patch.
const Color4f & getColor() const
Get the global color of the nine-patch.
void setTextureRect(const RectF &rect)
Set the sub-rectangle of the texture that the nine-patch will display.
Vector2f getSize() const
Get the size of the stretched area.
Definition: NinePatch.h:243
void setTexture(const Texture &texture, const RectF &textureRect=RectF::fromSize({ 1.0f, 1.0f }))
Change the source texture of the nine-patch.
const Texture & getTexture() const
Get the source texture of the nine-patch.
Definition: NinePatch.h:123
bool hasTexture() const
Check if a texture is set.
Definition: NinePatch.h:134
void setHorizontalLimits(float left, float right)
Set the horizontal limits of the stretchable area.
void setLimits(float top, float bottom, float left, float right)
Set the limits of the stretchable area.
const RectF & getTextureRect() const
Get the sub-rectangle of the texture displayed by the nine-patch.
Definition: NinePatch.h:171
NinePatch()
Default constructor.
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:102
A texture for colored images.
Definition: Texture.h:313
Data in the graphics memory.
Definition: VertexBuffer.h:81
Anchor
An anchor of a box.
Definition: Anchor.h:38
The namespace for gf classes.
static constexpr Rect< float > fromSize(Vector< float, 2 > size) noexcept
Create a rectangle from a size.
Definition: Rect.h:114
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82
A 4D vector.
Definition: Vector.h:852
A point associated with a color and a texture coordinate.
Definition: Vertex.h:75