Keos::CImage Class Reference

Class for the manipulation of images. More...

#include <KeosImage.h>

List of all members.

Public Member Functions

 CImage (const TVector2I &Size=TVector2I(1, 1), TPixelFormat Format=PXF_A8R8G8B8)
 Default constructor.
 CImage (const TVector2I &Size, TPixelFormat Format, const uchar *pPixels)
 Constructor.
const TVector2IGetSize () const
 Return the image dimensions.
TPixelFormat GetFormat () const
 Return the pixels format of the image.
const ucharGetData () const
 Return the array of pixels.
void Fill (const CColor &Color)
 Fill the image with a color.
void SetPixel (int x, int y, const uchar *pPix)
 Change one pixel (no conversion).
void SetPixel (int x, int y, const CColor &Color)
 Change one pixel with CColor (conversion).
void GetPixel (int x, int y, uchar *pPix) const
 Get one pixel (no conversion).
CColor GetPixel (int x, int y) const
 Get one pixel in CColor (conversion).
void CopyImage (const CImage &Src)
 Copy an image.
CImage SubImage (const CRectangle &Rect) const
 Create a new image from a part of the current image.
void Flip ()
 Turn the image (vertical symmetry).
void Mirror ()
 Turn the image (horizontal symmetry).


Detailed Description

Class for the manipulation of images.

Definition at line 32 of file KeosImage.h.


Constructor & Destructor Documentation

Keos::CImage::CImage ( const TVector2I Size = TVector2I(1, 1),
TPixelFormat  Format = PXF_A8R8G8B8 
)

Default constructor.

Parameters:
Size Image dimensions (default 1x1).
Format Pixels format (default PXF_A8R8G8B8).

Definition at line 36 of file KeosImage.cpp.

Keos::CImage::CImage ( const TVector2I Size,
TPixelFormat  Format,
const uchar pPixels 
)

Constructor.

Parameters:
Size Image dimensions.
Format Pixels format.
pPixels Pointer on the array of pixels.

Definition at line 43 of file KeosImage.cpp.


Member Function Documentation

const TVector2I & Keos::CImage::GetSize (  )  const

Return the image dimensions.

Definition at line 50 of file KeosImage.cpp.

Referenced by Keos::CImagesLoader::SaveToFile().

TPixelFormat Keos::CImage::GetFormat (  )  const

Return the pixels format of the image.

Definition at line 56 of file KeosImage.cpp.

Referenced by Keos::CMaterial::CreateTexture().

const uchar * Keos::CImage::GetData (  )  const

Return the array of pixels.

Definition at line 62 of file KeosImage.cpp.

void Keos::CImage::Fill ( const CColor Color  ) 

Fill the image with a color.

Definition at line 68 of file KeosImage.cpp.

References Keos::GetBytesPerPixel(), and SetPixel().

void Keos::CImage::SetPixel ( int  x,
int  y,
const uchar pPix 
)

Change one pixel (no conversion).

Parameters:
x Position X of the pixel.
y Position Y of the pixel.
pPix Bytes array with the new pixel.

Definition at line 79 of file KeosImage.cpp.

References Keos::GetBytesPerPixel(), and Keos::CVector2< T >::x.

Referenced by CopyImage(), Fill(), and Keos::CFontManager::LoadFont().

void Keos::CImage::SetPixel ( int  x,
int  y,
const CColor Color 
)

Change one pixel with CColor (conversion).

Parameters:
x Position X of the pixel.
y Position Y of the pixel.
Color The new color of the pixel.

Definition at line 85 of file KeosImage.cpp.

References Keos::ConvertPixel(), Keos::CColor::GetAlpha(), Keos::CColor::GetBlue(), Keos::GetBytesPerPixel(), Keos::CColor::GetGreen(), Keos::CColor::GetRed(), Keos::PXF_A8R8G8B8, and Keos::CVector2< T >::x.

void Keos::CImage::GetPixel ( int  x,
int  y,
uchar pPix 
) const

Get one pixel (no conversion).

Parameters:
x Position X of the pixel.
y Position Y of the pixel.
pPix Bytes array with the pixel.

Definition at line 94 of file KeosImage.cpp.

References Keos::GetBytesPerPixel(), and Keos::CVector2< T >::x.

Referenced by CopyImage(), and Keos::CFontManager::LoadFont().

CColor Keos::CImage::GetPixel ( int  x,
int  y 
) const

Get one pixel in CColor (conversion).

Parameters:
x Position X of the pixel.
y Position Y of the pixel.
Returns:
The color of the pixel.

Definition at line 101 of file KeosImage.cpp.

References Keos::ConvertPixel(), Keos::GetBytesPerPixel(), Keos::PXF_A8R8G8B8, and Keos::CVector2< T >::x.

void Keos::CImage::CopyImage ( const CImage Src  ) 

Copy an image.

Make the conversion of pixels if the format or the dimensions are different.

Parameters:
Src Image to be copied.

Definition at line 111 of file KeosImage.cpp.

References Keos::ConvertPixel(), Keos::GetBytesPerPixel(), GetPixel(), m_Format, m_Pixels, m_Size, SetPixel(), Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

CImage Keos::CImage::SubImage ( const CRectangle Rect  )  const

Create a new image from a part of the current image.

Parameters:
Rect Source rectangle.
Returns:
The new image.

Definition at line 172 of file KeosImage.cpp.

References Assert, Keos::GetBytesPerPixel(), Keos::CRectangle::Height(), Keos::INT_IN, Keos::CRectangle::Left(), Keos::CRectangle::Right(), Keos::CRectangle::Top(), Keos::CRectangle::Width(), Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

void Keos::CImage::Flip (  ) 

Turn the image (vertical symmetry).

Definition at line 194 of file KeosImage.cpp.

References Keos::GetBytesPerPixel(), Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

void Keos::CImage::Mirror (  ) 

Turn the image (horizontal symmetry).

Definition at line 207 of file KeosImage.cpp.

References Keos::GetBytesPerPixel(), Keos::CVector2< T >::x, and Keos::CVector2< T >::y.


The documentation for this class was generated from the following files:
Generated on Fri Mar 9 14:29:24 2007 for Keos by  doxygen 1.5.1-p1