|
| Surface (int width, int height, fge::Color const &color={0, 0, 0, 255}) |
|
| Surface (Surface const &r) |
|
| Surface (Surface &&r) noexcept |
|
| Surface (SDL_Surface *newSurface) |
|
Surface & | operator= (Surface const &r) |
|
Surface & | operator= (Surface &&r) noexcept |
|
void | clear () |
| Destroy the surface.
|
|
bool | create (int width, int height, fge::Color const &color={0, 0, 0, 255}) |
|
bool | loadFromFile (std::filesystem::path const &filePath) |
|
bool | loadFromMemory (void const *data, std::size_t size) |
|
bool | saveToFile (std::filesystem::path const &filePath) const |
| Save the surface to a PNG format file.
|
|
fge::Vector2i | getSize () const |
|
void | createMaskFromColor (fge::Color const &color, uint8_t alpha=0) |
| Create a transparent mask from a color.
|
|
bool | setPixel (int x, int y, fge::Color const &color) |
|
std::optional< fge::Color > | getPixel (int x, int y) const |
|
void | setCircle (int x, int y, unsigned int radius, fge::Color const &color) |
|
void | flipHorizontally () |
|
void | flipVertically () |
|
bool | blitSurface (Surface const &src, std::optional< SDL_Rect > const &srcRect, std::optional< SDL_Rect > &dstRect) |
| Blit a surface on this surface.
|
|
bool | fillRect (std::optional< SDL_Rect > const &rect, fge::Color const &color) |
| Fill a rectangle section of the surface with a color.
|
|
bool | addBorder (int borderSize, fge::Color const &color) |
| Add a border to the surface with a specific color.
|
|
void | set (SDL_Surface *surface) |
| Set a new surface.
|
|
SDL_Surface * | get () const |
| Get the SDL_Surface pointer.
|
|
fge::Vector2f | normalizeTextureCoords (fge::Vector2i const &coords) const |
| Convert some pixel coordinates to texture coordinates (0.0f to 1.0f)
|
|
fge::RectFloat | normalizeTextureRect (fge::RectInt const &rect) const |
| Convert a pixel rectangle to a texture rectangle (0.0f to 1.0f)
|
|
Abstraction of SDL_Surface.
This class is an abstraction of SDL_Surface. It can be used to load image from file or memory with the help of SDL_image. The texture manager must be initialized in order to load image from file (or just init SDL_image manually).
The surface is automatically destroyed when the object is destroyed.
- See also
- fge::texture::Init