3#include <unordered_map>
5#include "RootDisplay.hpp"
17 SCALE_PROPORTIONAL_WITH_BG,
19 SCALE_PROPORTIONAL_NO_BG,
65 bool saveTo(std::string& path);
68 void loadPath(std::string& path,
bool forceReload =
false);
77 static const std::string textElemPrefix;
87 static std::unordered_map<std::string, TextureData>
texCache;
Element * parent
the parent element (reference only, not owned)
int cornerRadius
Rounded corner radius (if >0, will round)
static void wipeEntireCache()
Wipes the entire texture cache (generally, should only be used to reload entire theme / text)
TextureScaleMode texScaleMode
Texture's scaling mode.
bool loadFromSurfaceSaveToCache(std::string &key, CST_Surface *surface)
Loads the texture from a surface and saves the results in caches Returns true if successful.
void resize(int w, int h)
Resizes the texture.
void loadPath(std::string &path, bool forceReload=false)
update and load or reload the texture
void clear(void)
Reinitialize Texture Resets texture content, size and color.
void setScaleMode(TextureScaleMode mode)
Sets texture scaling mode.
static void wipeTextCache()
Similar to wipeEntireCache, but only wipes cached text textures (made by TextElement)
bool loadFromSurface(CST_Surface *surface)
Loads the texture from a surface Returns true if successful.
bool saveTo(std::string &path)
save this texture to the given file path as a PNG
int texW
The size of the texture.
static std::unordered_map< std::string, TextureData > texCache
Cache previously displayed textures.
bool loadFromCache(std::string &key)
Loads the texture from caches Returns true if successful.
SDL_BlendMode blendMode
Blend mode to use for this texture.
CST_Color texFirstPixel
The color of the first pixel.
void render(Element *parent)
Renders the texture.
void getTextureSize(int *w, int *h)
Return texture's original size.
CST_Texture * mTexture
The actual texture.