FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::Image Class Reference

#include <image.h>

Inheritance diagram for FIFE::Image:
Inheritance graph
Collaboration diagram for FIFE::Image:
Collaboration graph

List of all members.

Public Member Functions

 Image (SDL_Surface *surface)
 Image (const uint8_t *data, unsigned int width, unsigned int height)
virtual void invalidate ()=0
virtual void render (const Rect &rect, SDL_Surface *dst, unsigned char alpha=255)=0
void render (const Rect &rect, unsigned char alpha=255)
SDL_Surface * detachSurface ()
- Public Member Functions inherited from FIFE::ResourceClass
const ResourceLocationgetResourceLocation ()
virtual void setResourceLocation (const ResourceLocation &location)
int getPoolId ()
- Public Member Functions inherited from FIFE::FifeClass
fifeid_t getFifeId ()
virtual void addRef ()
virtual void decRef ()
virtual unsigned int getRefCount ()
- Public Member Functions inherited from FIFE::IReferenceCounted
virtual void addRef ()=0
virtual void decRef ()=0
virtual unsigned int getRefCount ()=0
- Public Member Functions inherited from FIFE::AbstractImage
virtual SDL_Surface * getSurface ()=0
virtual unsigned int getWidth () const =0
virtual unsigned int getHeight () const =0
virtual const RectgetArea ()=0
virtual bool putPixel (int x, int y, int r, int g, int b, int a=255)=0
virtual void drawLine (const Point &p1, const Point &p2, int r, int g, int b, int a=255)=0
virtual void drawTriangle (const Point &p1, const Point &p2, const Point &p3, int r, int g, int b, int a=255)=0
virtual void drawRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
virtual void fillRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
virtual void drawQuad (const Point &p1, const Point &p2, const Point &p3, const Point &p4, int r, int g, int b, int a=255)=0
virtual void drawVertex (const Point &p, const uint8_t size, int r, int g, int b, int a=255)=0
virtual void drawLightPrimitive (const Point &p, uint8_t intensity, float radius, int subdivisions, float xstretch, float ystretch, uint8_t red, uint8_t green, uint8_t blue)=0
virtual void getPixelRGBA (int x, int y, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a)=0
virtual void pushClipArea (const Rect &cliparea, bool clear=true)=0
virtual void popClipArea ()=0
virtual const RectgetClipArea () const =0
virtual void saveImage (const std::string &filename)=0
virtual void setAlphaOptimizerEnabled (bool enabled)=0
virtual bool isAlphaOptimizerEnabled ()=0

Protected Member Functions

virtual void setClipArea (const Rect &cliparea, bool clear)=0
virtual void clearClipArea ()

Detailed Description

Base Class for Images.

Definition at line 138 of file image.h.


Constructor & Destructor Documentation

FIFE::Image::Image ( SDL_Surface *  surface)

Constructor.

Note:
Takes ownership of the SDL Surface
Parameters:
surfaceSDL Surface in RGBA format

Definition at line 37 of file image.cpp.

FIFE::Image::Image ( const uint8_t *  data,
unsigned int  width,
unsigned int  height 
)

Constructor

Parameters:
dataPointer to the imagedata (needs to be in RGBA, 8 bits per channel).
widthWidth of the image.
heightHeight of the image.

Definition at line 42 of file image.cpp.


Member Function Documentation

void FIFE::Image::clearClipArea ( )
protectedvirtual

Clears any possible clip areas

See also:
pushClipArea

Definition at line 171 of file image.cpp.

References setClipArea().

SDL_Surface * FIFE::Image::detachSurface ( )

Removes underlying SDL_Surface from the image (if exists) and returns this

Note:
this effectively causes SDL_Surface not to be freed on destruction

Definition at line 74 of file image.cpp.

virtual void FIFE::Image::invalidate ( )
pure virtual

Invalidates the Image causing it to be reset or re-loaded

Implemented in FIFE::GLImage, and FIFE::SDLImage.

virtual void FIFE::Image::render ( const Rect rect,
SDL_Surface *  dst,
unsigned char  alpha = 255 
)
pure virtual

Renders itself to the Destination surface at the rectangle rect.

Parameters:
rectThe position and clipping where to draw this image to.
targetTarget surface to draw to, e.g. main screen or other image
alphaThe alpha value, with which to draw self. opaque by default.

Implemented in FIFE::GLImage, and FIFE::SDLImage.

Referenced by FIFE::Cursor::draw(), and render().

Here is the caller graph for this function:

void FIFE::Image::render ( const Rect rect,
unsigned char  alpha = 255 
)

Renders itself to the main screen at the rectangle rect. Convenience function

Parameters:
rectThe position and clipping where to draw this image to.
alphaThe alpha value, with which to draw self.

Definition at line 140 of file image.cpp.

References render().

virtual void FIFE::Image::setClipArea ( const Rect cliparea,
bool  clear 
)
protectedpure virtual

Sets given clip area into image

See also:
pushClipArea

Implemented in FIFE::GLImage, and FIFE::SDLImage.

Referenced by clearClipArea().

Here is the caller graph for this function:


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