FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::sdl2::ImageLoader Class Reference

#include <imageloader.hpp>

Inheritance diagram for fcn::sdl2::ImageLoader:
fcn::ImageLoader fcn::opengl::ImageLoader

Public Member Functions

SDL_PixelFormat const & getSDLPixelFormat ()
Imageload (std::string const &filename)
fcn::Imageload (std::string const &filename, bool convertToDisplayFormat) override
void setRenderer (SDL_Renderer *renderer)
void setSDLPixelFormat (SDL_PixelFormat const &format)
Public Member Functions inherited from fcn::ImageLoader
 ImageLoader (ImageLoader &&)=default
 ImageLoader (ImageLoader const &)=default
Imageload (std::string const &filename)
ImageLoader & operator= (ImageLoader &&)=default
ImageLoader & operator= (ImageLoader const &)=default

Protected Member Functions

virtual SDL_Surface * convertToStandardFormat (SDL_Surface *surface)
virtual SDL_Surface * loadSDLSurface (std::string const &filename)
virtual SDL_Texture * loadSDLTexture (std::string const &filename)

Detailed Description

SDL2-specific implementation of ImageLoader.

Definition at line 28 of file backends/sdl2/imageloader.hpp.

Member Function Documentation

◆ convertToStandardFormat()

SDL_Surface * fcn::sdl2::ImageLoader::convertToStandardFormat ( SDL_Surface * surface)
protectedvirtual

Convert a surface to a standard internal format (internal).

Definition at line 95 of file imageloader.cpp.

Referenced by fcn::opengl::ImageLoader::load(), and load().

◆ getSDLPixelFormat()

SDL_PixelFormat const & fcn::sdl2::ImageLoader::getSDLPixelFormat ( )

Return the current SDL pixel format used for conversions.

Definition at line 156 of file imageloader.cpp.

◆ load() [1/2]

Image * fcn::ImageLoader::load ( std::string const & filename)
inline

Loads an image.

The single-argument overload forwards to the two-argument overload requesting conversion to display format.

NOTE: The functions Image::getPixel and Image::putPixel are only guaranteed to work before an image has been converted to display format.

Parameters
filenameThe filename of the image to load.

Definition at line 59 of file imageloader.hpp.

◆ load() [2/2]

fcn::Image * fcn::sdl2::ImageLoader::load ( std::string const & filename,
bool convertToDisplayFormat )
overridevirtual

Load an image from filename.

Implements fcn::ImageLoader.

Definition at line 36 of file imageloader.cpp.

References fcn::sdl2::Image::convertToDisplayFormat(), convertToStandardFormat(), and loadSDLSurface().

◆ loadSDLSurface()

SDL_Surface * fcn::sdl2::ImageLoader::loadSDLSurface ( std::string const & filename)
protectedvirtual

Load an SDL_Surface from disk (internal).

Definition at line 65 of file imageloader.cpp.

Referenced by fcn::opengl::ImageLoader::load(), and load().

◆ loadSDLTexture()

SDL_Texture * fcn::sdl2::ImageLoader::loadSDLTexture ( std::string const & filename)
protectedvirtual

Load an SDL_Texture from disk (internal).

Definition at line 80 of file imageloader.cpp.

◆ setRenderer()

void fcn::sdl2::ImageLoader::setRenderer ( SDL_Renderer * renderer)

Set the SDL renderer used when creating textures.

Definition at line 60 of file imageloader.cpp.

◆ setSDLPixelFormat()

void fcn::sdl2::ImageLoader::setSDLPixelFormat ( SDL_PixelFormat const & format)

Set the SDL pixel format used for conversions.

Definition at line 161 of file imageloader.cpp.


The documentation for this class was generated from the following files: