29 #ifndef NOMLIB_SDL2_TEXTURE_HEADERS
30 #define NOMLIB_SDL2_TEXTURE_HEADERS
38 #include "nomlib/config.hpp"
39 #include "nomlib/SDL_helpers.hpp"
40 #include "nomlib/math/helpers.hpp"
41 #include "nomlib/math/Color.hpp"
42 #include "nomlib/math/Coords.hpp"
43 #include "nomlib/math/Point2-inl.hpp"
44 #include "nomlib/system/ObjectCache.hpp"
45 #include "nomlib/SDL_helpers.hpp"
46 #include "nomlib/graphics/Image.hpp"
47 #include "nomlib/graphics/Window.hpp"
70 typedef std::shared_ptr<Texture> SharedPtr;
111 bool initialize ( SDL_SURFACE::RawPtr video_buffer );
119 Texture::SharedPtr
clone (
void )
const;
124 const Point2i& position (
void )
const;
126 const Coords& bounds (
void )
const;
129 SDL_TEXTURE::RawPtr
texture (
void )
const;
132 bool valid (
void )
const;
137 int access (
void )
const;
145 void set_bounds (
const Coords& clip );
150 int32
width (
void )
const;
155 int32
height (
void )
const;
157 int pitch (
void )
const;
159 void* pixels (
void )
const;
164 uint32 pixel_format (
void )
const;
174 const SDL_BlendMode
blend_mode (
void )
const;
177 bool locked (
void )
const;
218 const std::string& filename, uint32 flags,
219 bool use_cache =
false
223 bool update (
const void* pixels, uint16 pitch,
const Coords& update_area );
229 void draw ( SDL_RENDERER::RawPtr target )
const;
244 void draw ( SDL_RENDERER::RawPtr target,
const double angle )
const;
250 void draw (
const Window& target,
const double angle )
const;
252 bool set_alpha ( uint8 opacity );
261 uint32
pixel ( int32 x, int32 y );
268 bool resize (
enum ResizeAlgorithm scaling_algorithm );
292 SDL_TEXTURE::SharedPtr texture_;
314 #endif // include guard defined
Texture::SharedPtr clone(void) const
uint8 bits_per_pixel(void) const
void set_position(const Point2i &pos)
int pitch_
Texture's pixel pitch; these are only available when a Texture is locked.
uint32 pixel(int32 x, int32 y)
bool locked(void) const
Query memory lock status.
const Color & colorkey(void) const
bool set_colorkey(const Color &colorkey)
Color colorkey_
Cached upon use of the set_colorkey method for use by external classes.
uint8 bytes_per_pixel(void) const
void draw(SDL_RENDERER::RawPtr target) const
bool load(const std::string &filename, uint32 flags, bool use_cache=false)
bool update(const void *pixels, uint16 pitch, const Coords &update_area)
Upload texture copy with new pixel data.
const SDL_BlendMode blend_mode(void) const
Obtain the blending mode used for texture copies.
bool set_blend_mode(const SDL_BlendMode blend)
Set a new blending mode for this texture.
~Texture(void)
Lazy destructor.
Coords bounds_
Holds surface offsets (clipping area: X, Y, width & height)
int32 getResizeScaleFactor(enum ResizeAlgorithm scaling_algorithm)
bool valid(void) const
Is this object initialized – not nullptr?
Coordinate values (x, y, z, width, height ) wrapper.
bool initialize(SDL_SURFACE::RawPtr video_buffer)
Texture(void)
Default constructor.
SDL_TEXTURE::RawPtr texture(void) const
Get the video memory surface of the Texture object.
Point2i position_
Holds surface position (X, Y)
Texture & operator=(const Texture &other)
Copy assignment operator.
Utility class container for RGBA colors.
bool resize(enum ResizeAlgorithm scaling_algorithm)