FIFE
2008.0
|
#include <image.h>
Public Member Functions | |
Image (IResourceLoader *loader=0) | |
Image (SDL_Surface *surface) | |
Image (const uint8_t *data, uint32_t width, uint32_t height) | |
virtual | ~Image () |
virtual void | invalidate ()=0 |
virtual void | render (const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0 |
SDL_Surface * | detachSurface () |
virtual void | setSurface (SDL_Surface *surface)=0 |
void | saveImage (const std::string &filename) |
virtual void | useSharedImage (const ImagePtr &shared, const Rect ®ion)=0 |
virtual void | forceLoadInternal ()=0 |
bool | isSharedImage () const |
const Rect & | getSubImageRect () const |
virtual void | copySubimage (uint32_t xoffset, uint32_t yoffset, const ImagePtr &img) |
Static Public Member Functions | |
static void | saveAsPng (const std::string &filename, const SDL_Surface &surface) |
Protected Member Functions | |
void | reset (SDL_Surface *surface) |
FIFE::Image::Image | ( | IResourceLoader * | loader = 0 | ) |
FIFE::Image::Image | ( | SDL_Surface * | surface | ) |
FIFE::Image::Image | ( | const uint8_t * | data, |
uint32_t | width, | ||
uint32_t | height | ||
) |
|
virtual |
|
virtual |
Copies given image into this one with respect to given offsets
Reimplemented in FIFE::GLeImage, and FIFE::GLImage.
Definition at line 310 of file image.cpp.
References getSubImageRect(), FIFE::RectType< T >::h, isSharedImage(), FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
Referenced by FIFE::GLImage::copySubimage(), and FIFE::GLeImage::copySubimage().
SDL_Surface * FIFE::Image::detachSurface | ( | ) |
|
pure virtual |
Forces to load the image into internal memory of GPU
Implemented in FIFE::GLeImage, FIFE::GLImage, and FIFE::SDLImage.
Referenced by FIFE::RenderBackendOpenGL::attachRenderTarget(), and FIFE::RenderBackendOpenGLe::attachRenderTarget().
|
inline |
Returns area of the image it occupies in the shared image
Definition at line 147 of file image.h.
Referenced by copySubimage().
|
pure virtual |
Invalidates the Image causing it to be reset or re-loaded
Implemented in FIFE::GLImage, FIFE::GLeImage, and FIFE::SDLImage.
|
inline |
Returns true if this image shares data with another one
Definition at line 143 of file image.h.
Referenced by copySubimage().
|
pure virtual |
Renders itself to the current render target (main screen or attached destination image) at the rectangle rect. Convenience function
rect | The position and clipping where to draw this image to. |
alpha | The alpha value, with which to draw self. |
rgb | The color value of overlay if any. |
Implemented in FIFE::GLImage, FIFE::GLeImage, and FIFE::SDLImage.
Referenced by FIFE::Cursor::draw().
|
protected |
Resets the image to default values (including the x and y shift values), frees the current surface and sets the surface to the passed SDL_Surface (which can be NULL).
surface | the SDL_Surface to use for this image |
Definition at line 110 of file image.cpp.
Referenced by Image(), FIFE::GLeImage::setSurface(), FIFE::GLImage::setSurface(), and ~Image().
|
static |
Saves the SDL_Surface to png format
Definition at line 226 of file image.cpp.
Referenced by FIFE::RenderBackendOpenGL::captureScreen(), FIFE::RenderBackendSDL::captureScreen(), FIFE::RenderBackendOpenGLe::captureScreen(), and saveImage().
void FIFE::Image::saveImage | ( | const std::string & | filename | ) |
Saves the image using given filename.
Definition at line 222 of file image.cpp.
References saveAsPng().
|
pure virtual |
This frees the current suface and replaces it with the surface passed in the parameter (which can be NULL).
surface | the SDL_Surface to use for this image |
Implemented in FIFE::GLImage, FIFE::GLeImage, and FIFE::SDLImage.
|
pure virtual |
After this call all image data will be taken from the given image and its subregion
Implemented in FIFE::GLeImage, FIFE::GLImage, and FIFE::SDLImage.