Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# 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 TVector2I & | GetSize () const
| Return the image dimensions.
TPixelFormat | GetFormat () const
| Return the pixels format of the image.
const uchar * | GetData () 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).

## Private Attributes

TVector2I | m_Size
| Image dimensions.
TPixelFormat | m_Format
| Pixels format.
std::vector< uchar > | m_Pixels
| Pixels vector.

## 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.

References Keos::GetBytesPerPixel().

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 45 of file KeosImage.cpp.

References Keos::GetBytesPerPixel().

## Member Function Documentation

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 115 of file KeosImage.cpp.

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

Referenced by Keos::CTexture::Load(), and Keos::CImagesLoader::SaveToFile().

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

| Fill the image with a color. Definition at line 72 of file KeosImage.cpp. References Keos::GetBytesPerPixel(), m_Format, m_Pixels, and SetPixel().

void Keos::CImage::Flip | ( |  | ) |

| Turn the image (vertical symmetry). Definition at line 198 of file KeosImage.cpp. References Keos::GetBytesPerPixel(), m_Format, m_Pixels, m_Size, Keos::CVector2< T >::x, and Keos::CVector2< T >::y. Referenced by Keos::CImagesLoader::SaveToFile().

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

| Return the array of pixels. Definition at line 66 of file KeosImage.cpp. References m_Pixels. Referenced by Keos::COGLTexture::Update(), and Keos::CD3D9Texture::UpdateSurface().

TPixelFormat Keos::CImage::GetFormat | ( |  | ) | const

| Return the pixels format of the image. Definition at line 60 of file KeosImage.cpp. References m_Format. Referenced by Keos::COGLTexture::Update(), Keos::CD3D9Texture::Update(), and Keos::CD3D9Texture::UpdateSurface().

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 105 of file KeosImage.cpp.

References Keos::ConvertPixel(), Keos::GetBytesPerPixel(), m_Format, m_Pixels, m_Size, 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 98 of file KeosImage.cpp.

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

Referenced by Keos::CFontManager::LoadFont().

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

| Return the image dimensions. Definition at line 54 of file KeosImage.cpp. References m_Size. Referenced by Keos::CImagesLoader::SaveToFile().

void Keos::CImage::Mirror | ( |  | ) |

| Turn the image (horizontal symmetry). Definition at line 211 of file KeosImage.cpp. References Keos::GetBytesPerPixel(), m_Format, m_Pixels, m_Size, Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

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 89 of file KeosImage.cpp.

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

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 83 of file KeosImage.cpp.

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

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

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 176 of file KeosImage.cpp.

References Assert, Keos::GetBytesPerPixel(), Keos::INT_IN, m_Format, m_Pixels, m_Size, Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

Referenced by Keos::COGLTexture::Update().

## Member Data Documentation

TPixelFormat Keos::CImage::m_Format`[private]`

| Pixels format. Definition at line 119 of file KeosImage.h. Referenced by CopyImage(), Fill(), Flip(), GetFormat(), GetPixel(), Mirror(), SetPixel(), and SubImage().

std::vector<uchar> Keos::CImage::m_Pixels`[private]`

| Pixels vector. Definition at line 121 of file KeosImage.h. Referenced by CopyImage(), Fill(), Flip(), GetData(), GetPixel(), Mirror(), SetPixel(), and SubImage().

TVector2I Keos::CImage::m_Size`[private]`

| Image dimensions. Definition at line 117 of file KeosImage.h. Referenced by CopyImage(), Flip(), GetPixel(), GetSize(), Mirror(), SetPixel(), and SubImage().

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

- KeosEngine/KeosImage.h
- KeosEngine/KeosImage.cpp