Public Member Functions

mxgui::basic_image_base< T > Class Template Reference
[Mxgui level 1]

#include <image.h>

Inherited by mxgui::basic_image< T >, mxgui::ResourceImage, and mxgui::TgaImage.

List of all members.

Public Member Functions

 basic_image_base ()
 basic_image_base (short height, short width)
short int getHeight () const
short int getWidth () const
virtual const T * getData () const
virtual bool getScanLine (mxgui::Point p, mxgui::Color colors[], unsigned short length) const
template<typename U >
void draw (U &surface, Point p) const
template<typename U >
void clippedDraw (U &surface, Point p, Point a, Point b) const
virtual ~basic_image_base ()=0

Detailed Description

template<typename T>
class mxgui::basic_image_base< T >

Base class from which image classes derive. This class is pure virtual and as such it is not meant to be directly instantiated.


Constructor & Destructor Documentation

template<typename T >
mxgui::basic_image_base< T >::basic_image_base (  )  [inline]

Default constructor

template<typename T >
mxgui::basic_image_base< T >::basic_image_base ( short  height,
short  width 
) [inline]

Construct an Image

Parameters:
height the image's height
width the image's width
template<typename T >
mxgui::basic_image_base< T >::~basic_image_base (  )  [pure virtual]

Virtual destructor


Member Function Documentation

template<typename T >
template<typename U >
void mxgui::basic_image_base< T >::clippedDraw ( U &  surface,
Point  p,
Point  a,
Point  b 
) const

Draw part of an image on a surface

Parameters:
surface an object that provides pixel iterators.
p point of the upper left corner where the image will be drawn. Negative coordinates are allowed, as long as the clipped view has positive or zero coordinates
a Upper left corner of clipping rectangle
b Lower right corner of clipping rectangle
template<typename T >
template<typename U >
void mxgui::basic_image_base< T >::draw ( U &  surface,
Point  p 
) const

Draw an image on a surface

Parameters:
surface an object that provides pixel iterators.
p point of the upper left corner where the image will be drawn
template<typename T >
virtual const T* mxgui::basic_image_base< T >::getData (  )  const [inline, virtual]

Image classes that derive form this class can be divided in two kinds: those that make the whole image available as const T* pointer, and those that load only a small portion of the image at a time in order to minimize RAM usage. This member function can be used to differentiate between the two: if the returned pointer is not NULL then it is a valid pointer to the whole image that can be used to draw the whole image in an optimized way. Otherwise the only way to get image data is to use getScanLine() to retrieve the image one scanline at a time. Note that getScanLine() always work for any kind of image.

Returns:
a const pointer to the image's data if available, or NULL otherwise

Reimplemented in mxgui::basic_image< T >.

template<typename T >
short int mxgui::basic_image_base< T >::getHeight (  )  const [inline]
Returns:
the image's height
template<typename T >
bool mxgui::basic_image_base< T >::getScanLine ( mxgui::Point  p,
mxgui::Color  colors[],
unsigned short  length 
) const [virtual]

Get pixels from tha image. This member function can be used to get up to a full horizontal line of pixels from an image.

Parameters:
p Start point, within <0,0> and <getWidth()-1,getHeight()-1>
colors pixel data is returned here. Array size must be equal to the length parameter
length number of pixel to retrieve from the starting point. start.x()+length must be less or equal to getWidth()
Returns:
true if success. If false then it means the class does not represent a valid image, or a disk error occurred in case the image is stored on disk.

Reimplemented in mxgui::ResourceImage, and mxgui::TgaImage.

template<typename T >
short int mxgui::basic_image_base< T >::getWidth (  )  const [inline]
Returns:
the image's width

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