![]() |
nomlib
|
Public Types | |
| enum | ResizeAlgorithm { None = 0 , scale2x , scale3x , scale4x , hq2x , hq3x , hq4x } |
| Available pixel rescaling algorithms. More... | |
| enum | Access { Invalid = 0 , Static = SDL_TEXTUREACCESS_STATIC , Streaming = SDL_TEXTUREACCESS_STREAMING , RenderTarget = SDL_TEXTUREACCESS_TARGET } |
| typedef Texture | self_type |
Public Member Functions | |
| Texture (void) | |
| Default constructor. | |
| ~Texture (void) | |
| Destructor. | |
| Texture (const Texture ©) | |
| Copy constructor. | |
| Texture & | operator= (const Texture &other) |
| Copy assignment operator. | |
| Texture * | clone () const |
| Get a shallow-copy of the underlying stored texture. | |
| bool | initialize (uint32 format, uint32 flags, int width, int height) |
| bool | initialize (uint32 format, uint32 flags, const Size2i &dims) |
| bool | create (SDL_Texture *source) |
| bool | create (const Image &source) |
| bool | create (const Image &source, uint32 pixel_format, enum Texture::Access type) |
| const Point2i & | position () const |
| const Size2i & | size () const |
| Get the width & height dimensions of the texture. | |
| const IntRect & | bounds () const |
| SDL_Texture * | texture () const |
| Get the underlying texture stored. | |
| bool | valid () const |
| Is this object initialized – not nullptr? | |
| enum Texture::Access | access (void) const |
| Query texture access type. | |
| void | set_position (const Point2i &pos) |
| void | set_size (const Size2i &size) |
| Set the width & height dimensions of the texture. | |
| void | set_bounds (const IntRect &bounds) |
| Set bounding coordinates of the Texture. | |
| int32 | width (void) const |
| int32 | height (void) const |
| int | pitch (void) const |
| void * | pixels (void) const |
| uint8 | bytes_per_pixel (void) const |
| uint32 | pixel_format (void) const |
| uint8 | bits_per_pixel (void) const |
| const SDL_BlendMode | blend_mode (void) const |
| Obtain the blending mode used for texture copies. | |
| const Color4i & | colorkey (void) const |
| uint8 | alpha (void) const |
| Obtain the set color key for this image. | |
| const Color4i | color_modulation (void) const |
| Obtain the additional color value multiplied into render copy operations. | |
| bool | locked () const |
| Query lock status of texture. | |
| bool | lock () |
| Lock the entire bounds of the texture for write access to the pixel buffer. | |
| bool | lock (const IntRect &bounds) |
| Lock a portion of the texture for write access to the pixel buffer. | |
| void | unlock (void) |
| bool | load (const std::string &filename, bool use_cache=false, enum Texture::Access type=Access::Static) |
| bool | update_pixels (const void *source, uint16 pitch, const IntRect &bounds) |
| Upload pixels to texture. | |
| void | draw (SDL_Renderer *target) const |
| void | draw (const RenderWindow &target) const |
| void | draw (SDL_Renderer *target, const real64 angle) const |
| void | draw (const RenderWindow &target, const real64 angle) const |
| bool | set_alpha (uint8 opacity) |
| Set an additional alpha value multiplied into render copy operations. | |
| uint32 | pixel (int x, int y) |
| Read a RGBA pixel from the video surface. | |
| bool | resize (enum ResizeAlgorithm scaling_algorithm) |
| Rescale the Texture with the chosen rescaling algorithm. | |
| int | scale_factor (enum ResizeAlgorithm scaling_algorithm) const |
| Return the scaling factor of the chosen algorithm. | |
| int | scale_factor () const |
| bool | set_blend_mode (const SDL_BlendMode blend) |
| Set a new blending mode for this texture. | |
| bool | set_colorkey (const Color4i &colorkey) |
| bool | set_color_modulation (const Color4i &color) |
| Set an additional color value multiplied into render copy operations. | |
| bool | copy_pixels (const void *source, int pitch) |
Static Public Member Functions | |
| static const Point2i | maximum_size (void) |
| Obtain the largest nom::Texture size allowable by your graphics hardware. | |
Private Member Functions | |
| void | set_scale_factor (int factor) |
Private Attributes | |
| std::shared_ptr< SDL_Texture > | texture_ |
| void * | pixels_ |
| Texture's pixels; these are only available when a Texture is locked. | |
| int | pitch_ |
| Texture's pixel pitch; these are only available when a Texture is locked. | |
| Point2i | position_ |
| Size2i | size_ |
| IntRect | bounds_ |
| Color4i | colorkey_ |
| Cached upon use of the set_colorkey method for use by external classes. | |
| int | scale_factor_ |
Definition at line 53 of file Texture.hpp.
| typedef Texture nom::Texture::self_type |
Definition at line 56 of file Texture.hpp.
| enum nom::Texture::Access |
Definition at line 70 of file Texture.hpp.
Available pixel rescaling algorithms.
Definition at line 59 of file Texture.hpp.
| nom::Texture::Texture | ( | void | ) |
Default constructor.
position_ should be initialized to Point2i::null.
bounds_ should be initialized to IntRect::null.
colorkey_ should be initialized to Color4i::null.
| nom::Texture::~Texture | ( | void | ) |
Destructor.
| enum Texture::Access nom::Texture::access | ( | void | ) | const |
Query texture access type.
| uint8 nom::Texture::alpha | ( | void | ) | const |
Obtain the set color key for this image.
| uint8 nom::Texture::bits_per_pixel | ( | void | ) | const |
Calculate this object's bits per pixel (color depth)
| Texture * nom::Texture::clone | ( | ) | const |
Get a shallow-copy of the underlying stored texture.
| const Color4i nom::Texture::color_modulation | ( | void | ) | const |
Obtain the additional color value multiplied into render copy operations.
| const Color4i & nom::Texture::colorkey | ( | void | ) | const |
Obtain the set color key for this image
| bool nom::Texture::create | ( | const Image & | source | ) |
| bool nom::Texture::create | ( | const Image & | source, |
| uint32 | pixel_format, | ||
| enum Texture::Access | type ) |
| bool nom::Texture::create | ( | SDL_Texture * | source | ) |
| void nom::Texture::draw | ( | const RenderWindow & | target | ) | const |
Draw a nom::Texture to a nom::RenderWindow target
| nom::RenderWindow |
| void nom::Texture::draw | ( | const RenderWindow & | target, |
| const real64 | angle ) const |
Draw a rotated nom::Texture on a nom::RenderWindow
| target | Reference to an active nom::RenderWindow |
| angle | Rotation angle in degrees |
| void nom::Texture::draw | ( | SDL_Renderer * | target | ) | const |
Draw a nom::Texture to a SDL_Renderer target
| SDL_Renderer |
| void nom::Texture::draw | ( | SDL_Renderer * | target, |
| const real64 | angle ) const |
Draw a rotated nom::Texture to a rendering target
| target | Pointer to SDL_Renderer context |
| angle | Rotation angle in degrees |
| int32 nom::Texture::height | ( | void | ) | const |
Obtain height, in pixels, of texture
| bool nom::Texture::initialize | ( | uint32 | format, |
| uint32 | flags, | ||
| const Size2i & | dims ) |
| bool nom::Texture::initialize | ( | uint32 | format, |
| uint32 | flags, | ||
| int | width, | ||
| int | height ) |
| bool nom::Texture::load | ( | const std::string & | filename, |
| bool | use_cache = false, | ||
| enum Texture::Access | type = Access::Static ) |
Load an image into memory from a file
| filename | File path you wish to load into memory as a valid bitmap / texture (think: supported image file types). |
| type | nom::Texture::Access enumeration type |
| use_cache | Whether or not to use an internal object cache feature of nomlib. Defaults to off. |
| bool nom::Texture::lock | ( | ) |
Lock the entire bounds of the texture for write access to the pixel buffer.
| bool nom::Texture::lock | ( | const IntRect & | bounds | ) |
Lock a portion of the texture for write access to the pixel buffer.
| bounds | The area encompassing the area to lock; pass IntRect::null to lock the entire surface of the texture. |
|
static |
Obtain the largest nom::Texture size allowable by your graphics hardware.
| uint32 nom::Texture::pixel | ( | int | x, |
| int | y ) |
Read a RGBA pixel from the video surface.
| bool nom::Texture::resize | ( | enum ResizeAlgorithm | scaling_algorithm | ) |
Rescale the Texture with the chosen rescaling algorithm.
| bool nom::Texture::set_alpha | ( | uint8 | opacity | ) |
Set an additional alpha value multiplied into render copy operations.
| bool nom::Texture::set_color_modulation | ( | const Color4i & | color | ) |
Set an additional color value multiplied into render copy operations.
| nom::Color4i | red, green & blue values multiplied into color operations |
| bool nom::Texture::set_colorkey | ( | const Color4i & | colorkey | ) |
| void nom::Texture::set_size | ( | const Size2i & | size | ) |
Set the width & height dimensions of the texture.
| const Size2i & nom::Texture::size | ( | ) | const |
Get the width & height dimensions of the texture.
| void nom::Texture::unlock | ( | void | ) |
Unlock the texture; signals the OK to upload the pixel buffer to the GPU
| bool nom::Texture::update_pixels | ( | const void * | source, |
| uint16 | pitch, | ||
| const IntRect & | bounds ) |
Upload pixels to texture.
| source | Pixels to upload to the texture |
| pitch | Pitch of the source pixels |
| bounds | Rectangle bounds area to update; IntRect::null to update the entire texture |
| int32 nom::Texture::width | ( | void | ) | const |
Obtain width, in pixels, of texture
|
private |
Position & size of texture within memory; X, Y, width & height in pixels.
Definition at line 407 of file Texture.hpp.
|
private |
Cached upon use of the set_colorkey method for use by external classes.
Definition at line 410 of file Texture.hpp.
|
private |
Texture's pixel pitch; these are only available when a Texture is locked.
Definition at line 391 of file Texture.hpp.
|
private |
Texture's pixels; these are only available when a Texture is locked.
Definition at line 388 of file Texture.hpp.
|
private |
Rendering position & size – X, Y, width & height – in pixels.
Definition at line 397 of file Texture.hpp.
|
private |
Definition at line 412 of file Texture.hpp.
|
private |
Definition at line 399 of file Texture.hpp.
|
private |
Definition at line 385 of file Texture.hpp.