libSDL2pp
C++ bindings/wrapper for SDL2
|
Image stored in system memory with direct access to pixel data. More...
#include <SDL2pp/Surface.hh>
Classes | |
class | LockHandle |
SDL2pp::Surface lock. More... | |
Public Member Functions | |
Surface (SDL_Surface *surface) | |
Construct from existing SDL_Surface structure. | |
Surface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) | |
Create RGB surface. | |
Surface (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) | |
Create RGB surface with existing pixel data. | |
Surface (RWops &rwops) | |
Create surface loading it via RWops. | |
Surface (const std::string &filename) | |
Create surface loading it from file. | |
virtual | ~Surface () |
Destructor. | |
Surface (Surface &&other) noexcept | |
Move constructor. | |
Surface & | operator= (Surface &&other) noexcept |
Move assignment. | |
Surface (const Surface &)=delete | |
Deleted copy constructor. | |
Surface & | operator= (const Surface &)=delete |
Deleted assignment operator. | |
SDL_Surface * | Get () const |
Get pointer to managed SDL_Surface structure. | |
Surface | Convert (const SDL_PixelFormat &format) |
Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format. | |
Surface | Convert (Uint32 pixel_format) |
Copy an existing surface to a new surface of the specified format. | |
void | Blit (const Optional< Rect > &srcrect, Surface &dst, const Rect &dstrect) |
Fast surface copy to a destination surface. | |
void | BlitScaled (const Optional< Rect > &srcrect, Surface &dst, const Optional< Rect > &dstrect) |
Scaled surface copy to a destination surface. | |
LockHandle | Lock () |
Lock surface for direct pixel access. | |
Rect | GetClipRect () const |
Get the clipping rectangle for a surface. | |
Uint32 | GetColorKey () const |
Get the color key (transparent pixel) for a surface. | |
Uint8 | GetAlphaMod () const |
Get the additional alpha value used in blit operations. | |
SDL_BlendMode | GetBlendMode () const |
Get blend mode used for blit operations. | |
Color | GetColorAndAlphaMod () const |
Get the additional color value multiplied into blit operations. | |
void | GetColorMod (Uint8 &r, Uint8 &g, Uint8 &b) const |
Get the additional color value multiplied into blit operations. | |
Surface & | SetClipRect (const Optional< Rect > &rect=NullOpt) |
Set the clipping rectangle for a surface. | |
Surface & | SetColorKey (bool flag, Uint32 key) |
Set the color key (transparent pixel) in a surface. | |
Surface & | SetAlphaMod (Uint8 alpha=255) |
Set an additional alpha value used in blit operations. | |
Surface & | SetBlendMode (SDL_BlendMode blendMode) |
Set the blend mode used for blit operations. | |
Surface & | SetColorMod (Uint8 r=255, Uint8 g=255, Uint8 b=255) |
Set an additional color value multiplied into blit operations. | |
Surface & | SetColorAndAlphaMod (const Color &color) |
Set an additional color value multiplied into blit operations. | |
Surface & | SetRLE (bool flag) |
Set the RLE acceleration hint for a surface. | |
Surface & | FillRect (const Optional< Rect > &rect, Uint32 color) |
Perform a fast fill of a rectangle with a specific color. | |
Surface & | FillRects (const Rect *rects, int count, Uint32 color) |
Perform a fast fill of a set of rectangles with a specific color. | |
int | GetWidth () const |
Get surface width. | |
int | GetHeight () const |
Get surface height. | |
Point | GetSize () const |
Get surface size. | |
Uint32 | GetFormat () const |
Get texture format. | |
Image stored in system memory with direct access to pixel data.
|
explicit |
Construct from existing SDL_Surface structure.
[in] | surface | Existing SDL_Surface to manage |
SDL2pp::Surface::Surface | ( | Uint32 | flags, |
int | width, | ||
int | height, | ||
int | depth, | ||
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Create RGB surface.
[in] | flags | Unused and should be set to 0 |
[in] | width | Width of the surface |
[in] | height | Height of the surface |
[in] | depth | Depth of the surface in bits |
[in] | Rmask | Red mask for the pixels |
[in] | Gmask | Green mask for the pixels |
[in] | Bmask | Blue mask for the pixels |
[in] | Amask | Alpha mask for the pixels |
SDL2pp::Exception |
SDL2pp::Surface::Surface | ( | void * | pixels, |
int | width, | ||
int | height, | ||
int | depth, | ||
int | pitch, | ||
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Create RGB surface with existing pixel data.
[in] | pixels | Pointer to existing pixel data |
[in] | width | Width of the surface |
[in] | height | Height of the surface |
[in] | depth | Depth of the surface in bits |
[in] | pitch | Number of bytes in a row of pixel data, including padding between lines |
[in] | Rmask | Red mask for the pixels |
[in] | Gmask | Green mask for the pixels |
[in] | Bmask | Blue mask for the pixels |
[in] | Amask | Alpha mask for the pixels |
SDL2pp::Exception |
|
explicit |
Create surface loading it via RWops.
[in] | rwops | RWops used to access an image file |
SDL2pp::Exception |
|
explicit |
Create surface loading it from file.
[in] | filename | Path to an image file |
SDL2pp::Exception |
|
virtual |
Destructor.
|
noexcept |
Move constructor.
[in] | other | SDL2pp::Surface object to move data from |
|
delete |
Deleted copy constructor.
This class is not copyable
void SDL2pp::Surface::Blit | ( | const Optional< Rect > & | srcrect, |
Surface & | dst, | ||
const Rect & | dstrect | ||
) |
Fast surface copy to a destination surface.
[in] | srcrect | Rectangle to be copied, or NullOpt to copy the entire surface |
[in] | dst | Blit target surface |
[in] | dstrect | Rectangle that is copied into |
SDL2pp::Exception |
void SDL2pp::Surface::BlitScaled | ( | const Optional< Rect > & | srcrect, |
Surface & | dst, | ||
const Optional< Rect > & | dstrect | ||
) |
Scaled surface copy to a destination surface.
[in] | srcrect | Rectangle to be copied, or NullOpt to copy the entire surface |
[in] | dst | Blit target surface |
[in] | dstrect | Rectangle that is copied into, or NullOpt to copy into entire surface |
SDL2pp::Exception |
Surface SDL2pp::Surface::Convert | ( | const SDL_PixelFormat & | format | ) |
Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format.
[in] | format | SDL_PixelFormat structure that the new surface is optimized for |
SDL2pp::Exception |
Surface SDL2pp::Surface::Convert | ( | Uint32 | pixel_format | ) |
Copy an existing surface to a new surface of the specified format.
[in] | pixel_format | One of the enumerated values in SDL_PixelFormatEnum |
SDL2pp::Exception |
Perform a fast fill of a rectangle with a specific color.
[in] | rect | Rectangle to fill, or NullOpt to fill the entire surface |
[in] | color | Color to fill with |
SDL2pp::Exception |
Perform a fast fill of a set of rectangles with a specific color.
[in] | rects | Array rectangles to be filled |
[in] | count | Number of rectangles in the array |
[in] | color | Color to fill with |
SDL2pp::Exception |
SDL_Surface * SDL2pp::Surface::Get | ( | ) | const |
Get pointer to managed SDL_Surface structure.
Uint8 SDL2pp::Surface::GetAlphaMod | ( | ) | const |
Get the additional alpha value used in blit operations.
SDL2pp::Exception |
SDL_BlendMode SDL2pp::Surface::GetBlendMode | ( | ) | const |
Rect SDL2pp::Surface::GetClipRect | ( | ) | const |
Get the clipping rectangle for a surface.
Color SDL2pp::Surface::GetColorAndAlphaMod | ( | ) | const |
Get the additional color value multiplied into blit operations.
SDL2pp::Exception |
Uint32 SDL2pp::Surface::GetColorKey | ( | ) | const |
Get the color key (transparent pixel) for a surface.
SDL2pp::Exception |
void SDL2pp::Surface::GetColorMod | ( | Uint8 & | r, |
Uint8 & | g, | ||
Uint8 & | b | ||
) | const |
Get the additional color value multiplied into blit operations.
[out] | r | Variable to be filled in with the current red color value |
[out] | g | Variable to be filled in with the current green color value |
[out] | b | Variable to be filled in with the current blue color value |
SDL2pp::Exception |
Uint32 SDL2pp::Surface::GetFormat | ( | ) | const |
Get texture format.
int SDL2pp::Surface::GetHeight | ( | ) | const |
Get surface height.
Point SDL2pp::Surface::GetSize | ( | ) | const |
Get surface size.
int SDL2pp::Surface::GetWidth | ( | ) | const |
Get surface width.
Surface::LockHandle SDL2pp::Surface::Lock | ( | ) |
Lock surface for direct pixel access.
SDL2pp::Exception |
Deleted assignment operator.
This class is not copyable
Move assignment.
[in] | other | SDL2pp::Surface object to move data from |
Surface & SDL2pp::Surface::SetAlphaMod | ( | Uint8 | alpha = 255 | ) |
Set an additional alpha value used in blit operations.
[in] | alpha | Alpha value multiplied into blit operations |
SDL2pp::Exception |
Surface & SDL2pp::Surface::SetBlendMode | ( | SDL_BlendMode | blendMode | ) |
Set the blend mode used for blit operations.
[in] | blendMode | SDL_BlendMode to use for blit blending |
SDL2pp::Exception |
Set the clipping rectangle for a surface.
[in] | rect | Rect representing the clipping rectangle, or NullOpt to disable clipping |
SDL2pp::Exception |
Set an additional color value multiplied into blit operations.
[in] | color | Color to be multiplied into blit operations |
SDL2pp::Exception |
Surface & SDL2pp::Surface::SetColorKey | ( | bool | flag, |
Uint32 | key | ||
) |
Set the color key (transparent pixel) in a surface.
[in] | flag | True to enabled color key, false to disable |
[in] | key | Transparent pixel value |
SDL2pp::Exception |
Surface & SDL2pp::Surface::SetColorMod | ( | Uint8 | r = 255 , |
Uint8 | g = 255 , |
||
Uint8 | b = 255 |
||
) |
Set an additional color value multiplied into blit operations.
[in] | r | Red color value multiplied into blit operations |
[in] | g | Green color value multiplied into blit operations |
[in] | b | Blue color value multiplied into blit operations |
SDL2pp::Exception |
Surface & SDL2pp::Surface::SetRLE | ( | bool | flag | ) |
Set the RLE acceleration hint for a surface.
[in] | flag | False to disable, true to enable RLE acceleration |
SDL2pp::Exception |