|
FIFE
|
Base Class for Images. More...
#include <image.h>
Inheritance diagram for FIFE::Image:
Collaboration diagram for FIFE::Image:Public Member Functions | |
| Image (IResourceLoader *loader=0) | |
| Constructor. More... | |
| Image (const std::string &name, IResourceLoader *loader=0) | |
| Image (SDL_Surface *surface) | |
| Constructor. More... | |
| Image (const std::string &name, SDL_Surface *surface) | |
| Image (const uint8_t *data, uint32_t width, uint32_t height) | |
| Constructor. More... | |
| Image (const std::string &name, const uint8_t *data, uint32_t width, uint32_t height) | |
| virtual | ~Image () |
| Destructor. More... | |
| virtual void | invalidate ()=0 |
| Invalidates the Image causing it to be reset or re-loaded. More... | |
| virtual void | render (const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0 |
| Renders itself to the current render target (main screen or attached destination image) at the rectangle rect. More... | |
| virtual void | render (const Rect &rect, const ImagePtr &overlay, uint8_t alpha=255, uint8_t const *rgb=0) |
| virtual void | renderZ (const Rect &rect, float vertexZ, uint8_t alpha=255, uint8_t const *rgb=0) |
| virtual void | renderZ (const Rect &rect, float vertexZ, const ImagePtr &overlay, uint8_t alpha=255, uint8_t const *rgb=0) |
| virtual void | renderZ (const Rect &rect, float vertexZ, uint8_t alpha=255, bool forceNewBatch=false, uint8_t const *rgb=0) |
| SDL_Surface * | detachSurface () |
| Removes underlying SDL_Surface from the image (if exists) and returns this. More... | |
| SDL_Surface * | getSurface () |
| const SDL_Surface * | getSurface () const |
| virtual void | setSurface (SDL_Surface *surface)=0 |
| This frees the current suface and replaces it with the surface passed in the parameter (which can be NULL). More... | |
| void | saveImage (const std::string &filename) |
| Saves the image using given filename. More... | |
| uint32_t | getWidth () const |
| uint32_t | getHeight () const |
| const Rect & | getArea () const |
| void | setXShift (int32_t xshift) |
| int32_t | getXShift () const |
| void | setYShift (int32_t yshift) |
| int32_t | getYShift () const |
| void | getPixelRGBA (int32_t x, int32_t y, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a) |
| virtual size_t | getSize () |
| virtual void | load () |
| virtual void | free () |
| virtual void | useSharedImage (const ImagePtr &shared, const Rect ®ion)=0 |
| After this call all image data will be taken from the given image and its subregion. More... | |
| virtual void | forceLoadInternal ()=0 |
| Forces to load the image into internal memory of GPU. More... | |
| bool | isSharedImage () const |
| Returns true if this image shares data with another one. More... | |
| const Rect & | getSubImageRect () const |
| Returns area of the image it occupies in the shared image. More... | |
| virtual void | copySubimage (uint32_t xoffset, uint32_t yoffset, const ImagePtr &img) |
| Copies given image into this one with respect to given offsets. More... | |
Public Member Functions inherited from FIFE::IResource | |
| IResource (const std::string &name, IResourceLoader *loader=0) | |
| virtual | ~IResource () |
| virtual const std::string & | getName () |
| ResourceHandle | getHandle () |
| virtual ResourceState | getState () |
| virtual void | setState (const ResourceState &state) |
Static Public Member Functions | |
| static void | saveAsPng (const std::string &filename, const SDL_Surface &surface) |
| Saves the SDL_Surface to png format. More... | |
| static bool | putPixel (SDL_Surface *surface, int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255) |
Protected Member Functions | |
| void | reset (SDL_Surface *surface) |
| 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). More... | |
Protected Attributes | |
| SDL_Surface * | m_surface |
| int32_t | m_xshift |
| int32_t | m_yshift |
| bool | m_shared |
| Rect | m_subimagerect |
Protected Attributes inherited from FIFE::IResource | |
| std::string | m_name |
| IResourceLoader * | m_loader |
| ResourceState | m_state |
Private Member Functions | |
| std::string | createUniqueImageName () |
Additional Inherited Members | |
Public Types inherited from FIFE::IResource | |
| enum | ResourceState { RES_INVALID = 0, RES_NOT_LOADED, RES_LOADED } |
| FIFE::Image::Image | ( | IResourceLoader * | loader = 0 | ) |
| FIFE::Image::Image | ( | const std::string & | name, |
| IResourceLoader * | loader = 0 |
||
| ) |
| FIFE::Image::Image | ( | SDL_Surface * | surface | ) |
| FIFE::Image::Image | ( | const std::string & | name, |
| SDL_Surface * | surface | ||
| ) |
| FIFE::Image::Image | ( | const uint8_t * | data, |
| uint32_t | width, | ||
| uint32_t | height | ||
| ) |
Constructor.
| data | Pointer to the imagedata (needs to be in RGBA, 8 bits per channel). |
| width | Width of the image. |
| height | Height of the image. |
Definition at line 76 of file image.cpp.
References FIFE::AMASK, FIFE::BMASK, FIFE::GMASK, reset(), and FIFE::RMASK.
| FIFE::Image::Image | ( | const std::string & | name, |
| const uint8_t * | data, | ||
| uint32_t | width, | ||
| uint32_t | height | ||
| ) |
Definition at line 93 of file image.cpp.
References FIFE::AMASK, FIFE::BMASK, FIFE::GMASK, reset(), and FIFE::RMASK.
|
virtual |
|
virtual |
Copies given image into this one with respect to given offsets.
Reimplemented in FIFE::GLImage.
Definition at line 315 of file image.cpp.
References FIFE::AMASK, FIFE::BMASK, getHeight(), getSubImageRect(), getWidth(), FIFE::GMASK, FIFE::RectType< T >::h, isSharedImage(), m_surface, FIFE::RMASK, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
Referenced by FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindMultiOutline(), FIFE::InstanceRenderer::bindOutline(), and FIFE::GLImage::copySubimage().
Here is the caller graph for this function:
|
private |
| SDL_Surface * FIFE::Image::detachSurface | ( | ) |
Removes underlying SDL_Surface from the image (if exists) and returns this.
Definition at line 145 of file image.cpp.
References m_surface.
Referenced by FIFE::InstanceRenderer::getMultiColorOverlay().
Here is the caller graph for this function:
|
pure virtual |
Forces to load the image into internal memory of GPU.
Implemented in FIFE::GLImage, and FIFE::SDLImage.
Referenced by FIFE::RenderBackendOpenGL::attachRenderTarget(), FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindOutline(), FIFE::Camera::getMatchingInstances(), and FIFE::InstanceRenderer::getMultiColorOverlay().
Here is the caller graph for this function:
|
virtual |
Implements FIFE::IResource.
Reimplemented in FIFE::GLImage, and FIFE::SDLImage.
Definition at line 135 of file image.cpp.
References FIFE::IResource::m_state, m_xshift, m_yshift, FIFE::IResource::RES_NOT_LOADED, and reset().
Referenced by FIFE::LibRocketRenderInterface::freeTextures(), and FIFE::GuiImageLoader::load().
Here is the caller graph for this function:| const Rect & FIFE::Image::getArea | ( | ) | const |
Definition at line 176 of file image.cpp.
References getHeight(), and getWidth().
Referenced by FIFE::RenderBackendSDL::attachRenderTarget(), and FIFE::RenderBackendOpenGL::attachRenderTarget().
Here is the caller graph for this function:| uint32_t FIFE::Image::getHeight | ( | ) | const |
Definition at line 160 of file image.cpp.
References FIFE::RectType< T >::h, m_shared, m_subimagerect, and m_surface.
Referenced by FIFE::CellRenderer::addImageToMap(), fcn::ClickLabel::adjustSize(), FIFE::RenderBackendOpenGL::attachRenderTarget(), FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindOutline(), FIFE::GLImage::copySubimage(), copySubimage(), FIFE::RenderBackendOpenGL::detachRenderTarget(), FIFE::Cursor::draw(), FIFE::GuiFont::drawMultiLineString(), FIFE::GLImage::generateGLSharedTexture(), getArea(), FIFE::GuiImage::getHeight(), FIFE::Camera::getMatchingInstances(), FIFE::InstanceRenderer::getMultiColorOverlay(), FIFE::GuiImageLoader::load(), FIFE::FloatingTextRenderer::render(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::OffRendererImageInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::OffRendererAnimationInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::OffRendererTextInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::Camera::renderOverlay(), FIFE::LayerCache::updatePosition(), and FIFE::LayerCache::updateVisual().
Here is the caller graph for this function:| void FIFE::Image::getPixelRGBA | ( | int32_t | x, |
| int32_t | y, | ||
| uint8_t * | r, | ||
| uint8_t * | g, | ||
| uint8_t * | b, | ||
| uint8_t * | a | ||
| ) |
Definition at line 181 of file image.cpp.
References isSharedImage(), m_subimagerect, m_surface, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
Referenced by FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindOutline(), FIFE::Camera::getMatchingInstances(), and FIFE::InstanceRenderer::getMultiColorOverlay().
Here is the caller graph for this function:
|
virtual |
Implements FIFE::IResource.
Reimplemented in FIFE::SDLImage.
|
inline |
Returns area of the image it occupies in the shared image.
Definition at line 151 of file image.h.
References m_subimagerect.
Referenced by copySubimage().
Here is the caller graph for this function:
|
inline |
Definition at line 95 of file image.h.
References m_surface.
Referenced by FIFE::RenderBackendSDL::attachRenderTarget(), FIFE::RenderBackendOpenGL::attachRenderTarget(), FIFE::GLImage::copySubimage(), FIFE::SubImageFont::SubImageFont(), and FIFE::SDLImage::useSharedImage().
Here is the caller graph for this function:
|
inline |
| uint32_t FIFE::Image::getWidth | ( | ) | const |
Definition at line 151 of file image.cpp.
References m_shared, m_subimagerect, m_surface, and FIFE::RectType< T >::w.
Referenced by FIFE::CellRenderer::addImageToMap(), fcn::ClickLabel::adjustSize(), FIFE::RenderBackendOpenGL::attachRenderTarget(), FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindOutline(), FIFE::GLImage::copySubimage(), copySubimage(), FIFE::RenderBackendOpenGL::detachRenderTarget(), FIFE::Cursor::draw(), FIFE::GuiFont::drawMultiLineString(), FIFE::GLImage::generateGLSharedTexture(), getArea(), FIFE::Camera::getMatchingInstances(), FIFE::InstanceRenderer::getMultiColorOverlay(), FIFE::GuiImage::getWidth(), FIFE::GuiImageLoader::load(), FIFE::LibRocketRenderInterface::LoadTexture(), FIFE::FloatingTextRenderer::render(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::OffRendererImageInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::OffRendererAnimationInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::OffRendererTextInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::Camera::renderOverlay(), FIFE::LayerCache::updatePosition(), and FIFE::LayerCache::updateVisual().
Here is the caller graph for this function:
|
inline |
Definition at line 121 of file image.h.
References m_xshift.
Referenced by FIFE::Cursor::draw(), FIFE::ImageLoader::load(), FIFE::LayerCache::updatePosition(), and FIFE::LayerCache::updateVisual().
Here is the caller graph for this function:
|
inline |
Definition at line 127 of file image.h.
References m_yshift.
Referenced by FIFE::Cursor::draw(), FIFE::ImageLoader::load(), FIFE::LayerCache::updatePosition(), and FIFE::LayerCache::updateVisual().
Here is the caller graph for this function:
|
pure virtual |
Invalidates the Image causing it to be reset or re-loaded.
Implemented in FIFE::GLImage, and FIFE::SDLImage.
|
inline |
Returns true if this image shares data with another one.
Definition at line 147 of file image.h.
References m_shared.
Referenced by FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindOutline(), copySubimage(), FIFE::Camera::getMatchingInstances(), FIFE::InstanceRenderer::getMultiColorOverlay(), getPixelRGBA(), and FIFE::ImageLoader::load().
Here is the caller graph for this function:
|
virtual |
Implements FIFE::IResource.
Reimplemented in FIFE::GLImage, and FIFE::SDLImage.
Definition at line 124 of file image.cpp.
References FIFE::ImageLoader::load(), FIFE::IResourceLoader::load(), FIFE::IResource::m_loader, FIFE::IResource::m_state, and FIFE::IResource::RES_LOADED.
Referenced by FIFE::Animation::getFrame(), FIFE::Animation::getFrameByTimestamp(), FIFE::SDLImage::load(), FIFE::GLImage::load(), FIFE::ImageManager::load(), and FIFE::SDLImage::useSharedImage().
Here is the caller graph for this function:
|
static |
Definition at line 362 of file image.cpp.
Referenced by FIFE::InstanceRenderer::bindColoring(), FIFE::InstanceRenderer::bindMultiOutline(), FIFE::InstanceRenderer::bindOutline(), FIFE::InstanceRenderer::getMultiColorOverlay(), and FIFE::RenderBackendSDL::putPixel().
Here is the caller graph for this function:
|
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, and FIFE::SDLImage.
Referenced by FIFE::CellRenderer::addImageToMap(), FIFE::Cursor::draw(), FIFE::SdlGuiGraphics::drawImage(), FIFE::OpenGLGuiGraphics::drawImage(), FIFE::GuiFont::drawMultiLineString(), FIFE::GuiFont::drawString(), FIFE::FloatingTextRenderer::render(), FIFE::CoordinateRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::CellRenderer::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::OffRendererImageInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::OffRendererAnimationInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::LightRendererResizeInfo::render(), FIFE::OffRendererTextInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::OffRendererResizeInfo::render(), FIFE::GenericRendererResizeInfo::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderOverlay(), and FIFE::Camera::renderOverlay().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in FIFE::GLImage.
|
inlinevirtual |
Reimplemented in FIFE::GLImage.
Definition at line 85 of file image.h.
Referenced by FIFE::InstanceRenderer::renderOverlay(), and FIFE::InstanceRenderer::renderUnsorted().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in FIFE::GLImage.
|
inlinevirtual |
|
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.
References m_shared, m_surface, m_xshift, and m_yshift.
Referenced by free(), Image(), FIFE::SDLImage::setSurface(), FIFE::GLImage::setSurface(), and ~Image().
Here is the caller graph for this function:
|
static |
Saves the SDL_Surface to png format.
Definition at line 231 of file image.cpp.
Referenced by FIFE::RenderBackendSDL::captureScreen(), FIFE::RenderBackendOpenGL::captureScreen(), and saveImage().
Here is the caller graph for this function:| void FIFE::Image::saveImage | ( | const std::string & | filename | ) |
Saves the image using given filename.
Definition at line 227 of file image.cpp.
References m_surface, and 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, and FIFE::SDLImage.
Referenced by FIFE::InstanceRenderer::getMultiColorOverlay(), and FIFE::ImageLoader::load().
Here is the caller graph for this function:
|
inline |
Definition at line 118 of file image.h.
References m_xshift.
Referenced by FIFE::ImageLoader::load(), FIFE::AnimationLoader::load(), FIFE::ObjectLoader::load(), and FIFE::AtlasLoader::parseObject().
Here is the caller graph for this function:
|
inline |
Definition at line 124 of file image.h.
References m_yshift.
Referenced by FIFE::ImageLoader::load(), FIFE::AnimationLoader::load(), FIFE::ObjectLoader::load(), and FIFE::AtlasLoader::parseObject().
Here is the caller graph for this function:
|
pure virtual |
After this call all image data will be taken from the given image and its subregion.
Implemented in FIFE::GLImage, and FIFE::SDLImage.
Referenced by FIFE::GuiImageLoader::load(), FIFE::ObjectLoader::load(), and FIFE::AtlasLoader::load().
Here is the caller graph for this function:
|
protected |
Definition at line 174 of file image.h.
Referenced by FIFE::GLImage::cleanup(), FIFE::GLImage::forceLoadInternal(), FIFE::GLImage::generateGLTexture(), getHeight(), getSize(), getWidth(), isSharedImage(), FIFE::GLImage::load(), FIFE::GLImage::render(), FIFE::GLImage::renderZ(), reset(), FIFE::SDLImage::useSharedImage(), and FIFE::GLImage::useSharedImage().
|
protected |
Definition at line 176 of file image.h.
Referenced by getHeight(), getPixelRGBA(), getSubImageRect(), getWidth(), FIFE::SDLImage::load(), FIFE::GLImage::load(), FIFE::SDLImage::useSharedImage(), FIFE::GLImage::useSharedImage(), and FIFE::GLImage::validateShared().
|
protected |
Definition at line 159 of file image.h.
Referenced by copySubimage(), detachSurface(), FIFE::SDLImage::finalize(), FIFE::GLImage::generateGLTexture(), getHeight(), getPixelRGBA(), FIFE::SDLImage::getSize(), getSize(), getSurface(), getWidth(), FIFE::GLImage::GLImage(), FIFE::GLImage::load(), FIFE::SDLImage::render(), FIFE::GLImage::render(), FIFE::GLImage::renderZ(), reset(), saveImage(), FIFE::GLImage::useSharedImage(), and FIFE::GLImage::validateShared().
|
protected |
Definition at line 161 of file image.h.
Referenced by free(), getXShift(), reset(), and setXShift().
|
protected |
Definition at line 163 of file image.h.
Referenced by free(), getYShift(), reset(), and setYShift().