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

# Keos::CTexture Class Reference

Wrapper class for the ITextureBase. More...

`#include <KeosTexture.h>`

List of all members.

## Public Member Functions

void | Create (const TVector2I &Size, TPixelFormat Format, ulong nFlags=0, const String &strName="")
| Create an empty texture.
void | CreateFromFile (const String &strFilename, TPixelFormat Format, ulong nFlags=0)
| Create texture from a file.
void | CreateFromImage (const CImage &Image, TPixelFormat Format, ulong nFlags=0, const String &strName="")
| Create texture from an image.
void | SaveToFile (const String &strFilename) const
| Save the texture in a file.
void | Update (const CRectangle &Rect=CRectangle(-1,-1,-1,-1))
| Update the pixels of the texture.
CImage & | GetPixels ()
| Return an image with the pixels of the texture.
const TVector2I & | GetSize () const
| Return the dimensions of the texture.
TPixelFormat | GetFormat () const
| Return the format of the texture.
const String & | GetName () const
| Return the name associated to the texture.
const ITextureBase * | GetTexture () const
| Return a pointer on the intern texture.
bool | operator== (const CTexture &Texture) const
| == operator.
bool | operator!= (const CTexture &Texture) const
| != operator.

## Private Member Functions

void | Load (const CImage &Image, TPixelFormat Format, ulong nFlags, const String &strName)
| Create the texture and fills it with pixels spent in parameter.

## Private Attributes

CSmartPtr< ITextureBase, CCOMRefCounted > | m_Texture
| Pointer on the texture.

## Detailed Description

Wrapper class for the ITextureBase.

Definition at line 34 of file KeosTexture.h.

## Member Function Documentation

void Keos::CTexture::Create | ( | const TVector2I & | Size,
|  | TPixelFormat | Format,
|  | ulong | nFlags = `0`,
|  | const String & | strName = `""`
| ) |

| Create an empty texture.

Parameters:

  | Size | Dimensions.
  | Format | Pixel format.
  | nFlags | Load options (default 0).
  | strName | Name associated to the texture (default "").

Definition at line 37 of file KeosTexture.cpp.

References CreateFromImage().

void Keos::CTexture::CreateFromFile | ( | const String & | strFilename,
|  | TPixelFormat | Format,
|  | ulong | nFlags = `0`
| ) |

| Create texture from a file.

Parameters:

  | strFilename | Path of the file.
  | Format | Pixel format.
  | nFlags | Load options (default 0).

Definition at line 44 of file KeosTexture.cpp.

References Load(), and m_Texture.

Referenced by Keos::CModel::CModel().

void Keos::CTexture::CreateFromImage | ( | const CImage & | Image,
|  | TPixelFormat | Format,
|  | ulong | nFlags = `0`,
|  | const String & | strName = `""`
| ) |

| Create texture from an image.

Parameters:

  | Image | Image to be loaded.
  | Format | Pixel format.
  | nFlags | Load options (default 0).
  | strName | Name associated to the texture (default "").

Definition at line 60 of file KeosTexture.cpp.

References Load(), and m_Texture.

Referenced by Keos::CModel::CModel(), and Create().

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

| Return the format of the texture. Definition at line 147 of file KeosTexture.cpp. References m_Texture.

const String & Keos::CTexture::GetName | ( |  | ) | const

| Return the name associated to the texture. Definition at line 153 of file KeosTexture.cpp. References m_Texture.

CImage & Keos::CTexture::GetPixels | ( |  | ) |

| Return an image with the pixels of the texture. Definition at line 135 of file KeosTexture.cpp. References m_Texture. Referenced by Load().

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

| Return the dimensions of the texture. Definition at line 141 of file KeosTexture.cpp. References m_Texture. Referenced by Load(), and Update().

const ITextureBase * Keos::CTexture::GetTexture | ( |  | ) | const

| Return a pointer on the intern texture. Definition at line 159 of file KeosTexture.cpp. References m_Texture. Referenced by Keos::CFontManager::DrawString(), and Keos::CModel::Render().

void Keos::CTexture::Load | ( | const CImage & | Image,
|  | TPixelFormat | Format,
|  | ulong | nFlags,
|  | const String & | strName
| ) | `[private]`

| Create the texture and fills it with pixels spent in parameter.

Parameters:

  | Image | Pixels to be copied in the texture.
  | Format | Pixel format.
  | nFlags | Load options.
  | strName | Name associated to the texture.

Definition at line 70 of file KeosTexture.cpp.

References Keos::CAP_NON_POWER_OF_2_TEXTURES, Keos::CAP_TEXTURE_COMPRESSION_DXT, Keos::CImage::CopyImage(), Keos::FormatCompressed(), GetPixels(), GetSize(), LOADINGFAILED_EXCEPT, m_Texture, Keos::NearestPowerOfTwo(), Keos::PXF_A8R8G8B8, Renderer, and Update().

Referenced by CreateFromFile(), and CreateFromImage().

bool Keos::CTexture::operator!= | ( | const CTexture & | Texture | ) | const

| != operator. Definition at line 171 of file KeosTexture.cpp.

bool Keos::CTexture::operator== | ( | const CTexture & | Texture | ) | const

| == operator. Definition at line 165 of file KeosTexture.cpp. References m_Texture.

void Keos::CTexture::SaveToFile | ( | const String & | strFilename | ) | const

| Save the texture in a file.

Parameters:

  | strFilename | Path of the target file.

Definition at line 120 of file KeosTexture.cpp.

References m_Texture.

void Keos::CTexture::Update | ( | const CRectangle & | Rect = `CRectangle(-1,-1,-1,-1)` | ) |

| Update the pixels of the texture.

Parameters:

  | Rect | Rectangle to update in the texture (default (-1,-1,-1,-1)).

Definition at line 126 of file KeosTexture.cpp.

References GetSize(), and m_Texture.

Referenced by Load().

## Member Data Documentation

CSmartPtr<ITextureBase, CCOMRefCounted> Keos::CTexture::m_Texture`[private]`

| Pointer on the texture. Definition at line 110 of file KeosTexture.h. Referenced by CreateFromFile(), CreateFromImage(), GetFormat(), GetName(), GetPixels(), GetSize(), GetTexture(), Load(), operator==(), SaveToFile(), and Update().

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

- KeosEngine/KeosTexture.h
- KeosEngine/KeosTexture.cpp