60 int GUIImageNode::thumbnailTextureIdx = 0;
62 GUIImageNode::GUIImageNode(
70 const string& backgroundImage,
72 const GUIColor& backgroundImageEffectColorMul,
73 const GUIColor& backgroundImageEffectColorAdd,
78 const string& tooltip,
99 backgroundImageScale9Grid,
100 backgroundImageEffectColorMul,
101 backgroundImageEffectColorAdd,
107 requestedDimensionConstraints,
119 if (Math::abs(rotation) > Math::EPSILON)
rotate(rotation);
124 Engine::getInstance()->getTextureManager()->removeTexture(
texture->
getId());
153 if (
source.empty() ==
false) {
155 if (StringTools::endsWith(StringTools::toLowerCase(
source),
".tm") ==
true) {
157 vector<uint8_t> thumbnailPNGData;
158 if (FileSystem::getInstance()->getThumbnailAttachment(
159 FileSystem::getInstance()->getPathName(
source),
160 FileSystem::getInstance()->getFileName(
source),
164 auto thumbnailTexture = PNGTextureReader::read(
"tdme.gui.guiimagenode." + to_string(
thumbnailTextureIdx++), thumbnailPNGData,
true);
165 if (thumbnailTexture !=
nullptr) {
166 this->
texture = thumbnailTexture;
177 Console::println(
string() +
"GUIImageNode::setSource(): " + exception.what());
181 if (StringTools::endsWith(StringTools::toLowerCase(
source),
".tmodel") ==
true) {
183 vector<uint8_t> thumbnailPNGData;
184 if (PrototypeReader::readThumbnail(
185 FileSystem::getInstance()->getPathName(
source),
186 FileSystem::getInstance()->getFileName(
source),
190 auto thumbnailTexture = PNGTextureReader::read(
"tdme.gui.guiimagenode." + to_string(
thumbnailTextureIdx++), thumbnailPNGData,
true);
191 if (thumbnailTexture !=
nullptr) {
192 this->
texture = thumbnailTexture;
203 Console::println(
string() +
"GUIImageNode::setSource(): " + exception.what());
207 if (StringTools::endsWith(StringTools::toLowerCase(
source),
".xml") ==
true) {
212 Console::println(
string() +
"GUIImageNode::setSource(): " + exception.what());
216 for (
const auto& extension: ModelReader::getModelExtensions()) {
217 if (StringTools::endsWith(StringTools::toLowerCase(
source),
"." + extension) ==
true) {
225 if (this->
texture ==
nullptr) {
237 if (this->texture ==
texture)
return;
248 textureId = Engine::getInstance()->getTextureManager()->addTexture(
texture, 0);
255 this->texture =
nullptr;
269 if (
texture ==
nullptr)
return;
270 auto rotatedTexture = TextureReader::rotate(
texture, rotation);
271 if (rotatedTexture ==
nullptr)
return;
273 this->
texture = rotatedTexture;
int32_t getColorBufferTextureId()
uint16_t getWidth() const
const string & getId() const
uint16_t getHeight() const
PNG texture reader class.
FrameBuffer * getFrameBuffer()
void disposeTexture()
Release texture.
const string getNodeType() override
void dispose() override
Dispose node.
void setTexture(Texture *texture)
Set texture.
void setSource(const string &source)
Set image source.
static STATIC_DLL_IMPEXT int thumbnailTextureIdx
void setFrameBuffer(FrameBuffer *frameBuffer)
Set frame buffer.
void rotate(float rotation)
Rotate image around center.
FrameBuffer * frameBuffer
bool releaseTextureReference
const string & getSource()
GUI element node conditions.
GUI node requested constraints requested constraints type enum.
GUIScreenNode * screenNode
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
Texture * getImage(const string &fileName)
Get image.
void dispose() override
Dispose node.
File system singleton class.
virtual void releaseReference()
Releases a reference, thus decrementing the counter and delete it if reference counter is zero.
virtual void acquireReference()
Acquires a reference, incrementing the counter.
std::exception Exception
Exception base class.
GUI node clipping entity.
GUI node computed constraints.
GUI node requested constraints entity.
GUI node scale 9 grid entity.