3#include <unordered_map>
5#include "RootDisplay.hpp"
14 SCALE_PROPORTIONAL_WITH_BG,
60 bool saveTo(std::string& path);
63 void loadPath(std::string& path,
bool forceReload =
false);
70 static std::unordered_map<std::string, TextureData>
texCache;
Element * parent
the parent element (can sometimes be null if it isn't set)
void getTextureSize(int *w, int *h)
Return texture's original size.
bool loadFromSurfaceSaveToCache(std::string &key, CST_Surface *surface)
Loads the texture from a surface and saves the results in caches Returns true if successful.
static std::unordered_map< std::string, TextureData > texCache
Cache previously displayed textures.
CST_Color texFirstPixel
The color of the first pixel.
int cornerRadius
Rounded corner radius (if >0, will round)
int texW
The size of the texture.
void resize(int w, int h)
Resizes the texture.
bool loadFromCache(std::string &key)
Loads the texture from caches Returns true if successful.
void clear(void)
Reinitialize Texture Resets texture content, size and color.
void render(Element *parent)
Renders the texture.
bool saveTo(std::string &path)
save this texture to the given file path as a PNG
void setScaleMode(TextureScaleMode mode)
Sets texture scaling mode.
bool loadFromSurface(CST_Surface *surface)
Loads the texture from a surface Returns true if successful.
TextureScaleMode texScaleMode
Texture's scaling mode.
void loadPath(std::string &path, bool forceReload=false)
update and load or reload the texture
CST_Texture * mTexture
The actual texture.