1 #ifndef LXGUI_GUI_SDL_MATERIAL_HPP
2 #define LXGUI_GUI_SDL_MATERIAL_HPP
4 #include "lxgui/gui_color.hpp"
5 #include "lxgui/gui_material.hpp"
6 #include "lxgui/utils.hpp"
37 bool is_render_target =
false,
51 const std::string& file_name,
52 bool is_pre_multiplied_alpha_supported,
179 SDL_Renderer* renderer_ =
nullptr;
186 bool is_render_target_ = false;
188 SDL_Texture* texture_ =
nullptr;
189 bool is_owner_ = false;
A class that holds rendering data.
A class that holds rendering data This implementation can contain either a plain color or a real SDL_...
static void premultiply_alpha(SDL_Surface *data)
Premultiplies an image by its alpha component.
material(SDL_Renderer *rdr, SDL_Texture *tex, const bounds2f &rect, filter filt=filter::none)
Constructor for atlas textures.
material(const material &tex)=delete
SDL_Texture * get_texture() const
Returns the underlying SDL texture object. return The underlying SDL texture object.
void unlock_pointer() const
Stops modifying the texture data and update the texture in GPU memory.
void set_filter(filter filt)
Sets the filter mode of this texture.
bool uses_same_texture(const gui::material &other) const override
Checks if another material is based on the same texture as the current material.
material(material &&tex)=delete
material(SDL_Renderer *rdr, const std::string &file_name, bool is_pre_multiplied_alpha_supported, wrap wrp=wrap::repeat, filter filt=filter::none)
Constructor for textures.
filter get_filter() const
Returns the filter mode of this texture.
vector2ui get_canvas_dimensions() const override
Returns the physical dimensions (in pixels) of the canvas containing this texture (if any).
material(SDL_Renderer *rdr, const vector2ui &dimensions, bool is_render_target=false, wrap wrp=wrap::repeat, filter filt=filter::none)
Constructor for textures.
static int get_premultiplied_alpha_blend_mode()
Returns the SDL blend mode corresponding to pre-multiplied alpha.
SDL_Texture * get_render_texture()
Returns the underlying SDL texture object (for render target). return The underlying SDL texture obje...
void set_wrap(wrap wrp)
Sets the wrap mode of this texture.
material & operator=(const material &tex)=delete
bounds2f get_rect() const override
Returns the pixel rect in pixels of the canvas containing this texture (if any).
bool set_dimensions(const vector2ui &dimensions)
Resizes this texture.
~material() noexcept override
Destructor.
wrap get_wrap() const
Return the wrap mode of this texture.
material & operator=(material &&tex)=delete
SDL_Renderer * get_renderer()
Returns the SDL renderer object that this material was created on. return The SDL renderer object tha...
color32 * lock_pointer(std::size_t *pitch=nullptr)
Returns a pointer to the texture data, which can be modified.
Holds a single color (byte RGBA, 32 bits)