Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

CTexture Class Reference

Texture class. More...

#include <Texture.h>

Inheritance diagram for CTexture:

CXMLResource CResource CEntity COpenGLTexture List of all members.

Public Member Functions

virtual int LoadXML (TiXmlNode *pDataNode, CString strFilename)
virtual int SaveXML (TiXmlNode *pDataNode, CString strFilename)
virtual void Bind ()
void Destroy ()
virtual void Release ()
UINT GetDepth ()
UINT GetWidth ()
UINT GetHeight ()
FIBITMAP * GetBitmap ()
void GetPixel (tRGBA *pPixel, UINT x, UINT y)
void SetPixel (UINT x, UINT y, tRGBA color)
CString & GetTextureFilename ()
bool IsMasked ()
tRGBA & GetMask ()
void SetMask (tRGBA color)
virtual UINT Create ()
virtual bool IsOfType (eEntityType eType)

Protected Attributes

tRGBA m_Mask
FIBITMAP * m_pBitmap
CString m_strTextureFilename

Detailed Description

Texture class.

This class is a generic texture wrapper for FreeImage (FBITMAP), that can load a variety of image file formats.

Definition at line 22 of file Texture.h.


Member Function Documentation

void CTexture::Bind  )  [virtual]
 

Method details: Binds this texture as current one

Reimplemented in COpenGLTexture.

Definition at line 173 of file Texture.cpp.

Referenced by CBitmapFont::Create(), CGUIElement::Draw(), and CBitmapFont::Draw().

UINT CTexture::Create  )  [virtual]
 

Method details:

Returns:
1 if created succesfully, 0 otherwise

Reimplemented in COpenGLTexture.

Definition at line 17 of file Texture.cpp.

void CTexture::Destroy  )  [virtual]
 

Method details: Clean-up

Reimplemented from CXMLResource.

Reimplemented in COpenGLTexture.

Definition at line 220 of file Texture.cpp.

References m_pBitmap.

Referenced by COpenGLTexture::Destroy().

FIBITMAP * CTexture::GetBitmap  ) 
 

Method details:

Returns:
Pointer to FreeImage structure that stores the raw image data
Definition at line 149 of file Texture.cpp.

References m_pBitmap.

UINT CTexture::GetDepth  ) 
 

Method details:

Returns:
Depth of the texture
Definition at line 134 of file Texture.cpp.

References m_pBitmap.

Referenced by COpenGLTexture::Create().

UINT CTexture::GetHeight  ) 
 

Method details:

Returns:
Height of the texture
Definition at line 144 of file Texture.cpp.

References m_pBitmap.

Referenced by COpenGLTexture::Create(), CGUIProgressBar::Draw(), and CGUIButton::Draw().

tRGBA & CTexture::GetMask  ) 
 

Method details:

Returns:
Const. Reference to RGBA value of the mask color
Definition at line 162 of file Texture.cpp.

References m_Mask.

void CTexture::GetPixel tRGBA *  pPixel,
UINT  x,
UINT  y
 

Method details:

Parameters:
pPixel - Pointer to RGBA structure that will contain pixel RGBA values
x,y - pixel coordinates
Definition at line 178 of file Texture.cpp.

References m_pBitmap.

CString & CTexture::GetTextureFilename  ) 
 

Method details:

Returns:
Const. Reference to texture' filename
Definition at line 210 of file Texture.cpp.

References m_strTextureFilename.

Referenced by CGUIElement::GetProperties(), and SaveXML().

UINT CTexture::GetWidth  ) 
 

Method details:

Returns:
Width of the texture
Definition at line 139 of file Texture.cpp.

References m_pBitmap.

Referenced by COpenGLTexture::Create(), CGUIProgressBar::Draw(), and CGUIButton::Draw().

bool CTexture::IsMasked  ) 
 

Method details:

Returns:
True if this texture has a mask, False otherwise
Definition at line 154 of file Texture.cpp.

References m_Mask.

Referenced by COpenGLTexture::Create(), and CGUIElement::Draw().

bool CTexture::IsOfType eEntityType  eType  )  [virtual]
 

Method details: This is an implementation of Custom RTTI

Reimplemented from CXMLResource.

Reimplemented in COpenGLTexture.

Definition at line 229 of file Texture.cpp.

References CXMLResource::IsOfType().

Referenced by COpenGLTexture::IsOfType().

int CTexture::LoadXML TiXmlNode pDataNode,
CString  strFilename
[virtual]
 

Method details:

Parameters:
pDataNode - Pointer to XML Node that holds data for the texture
strFilename - String containing filename where the data for the texture is stored

Reimplemented from CXMLResource.

Reimplemented in COpenGLTexture.

Definition at line 23 of file Texture.cpp.

References TiXmlElement::Attribute(), CXMLResource::LoadXML(), m_Mask, m_strTextureFilename, and TiXmlNode::pcValue().

Referenced by CTextureManager::LoadResource(), and COpenGLTexture::LoadXML().

void CTexture::Release  )  [virtual]
 

Method details: Releases the texture

Reimplemented in COpenGLTexture.

Definition at line 215 of file Texture.cpp.

int CTexture::SaveXML TiXmlNode pDataNode,
CString  strFilename
[virtual]
 

Method details:

Parameters:
pDataNode - Pointer to XML Node that will be the parent hold the data for this texture
strFilename - String containing filename where the data for the texture is stored

Reimplemented from CXMLResource.

Reimplemented in COpenGLTexture.

Definition at line 84 of file Texture.cpp.

References CEntity::GetName(), GetTextureFilename(), TiXmlNode::InsertEndChild(), m_Mask, TiXmlDocument::SaveFile(), TiXmlElement::SetAttribute(), and TiXmlNode::ToElement().

Referenced by CTextureManager::SaveXML(), and COpenGLTexture::SaveXML().

void CTexture::SetMask tRGBA  color  ) 
 

Method details:

Parameters:
color - New color for the mask
Definition at line 167 of file Texture.cpp.

References m_Mask.

void CTexture::SetPixel UINT  x,
UINT  y,
tRGBA  color
 

Method details:

Parameters:
x,y - pixel coordinates
color - new RGBA value for the pixel
Definition at line 196 of file Texture.cpp.

References m_pBitmap.


Member Data Documentation

tRGBA CTexture::m_Mask [protected]
 

Mask color Definition at line 123 of file Texture.h.

Referenced by GetMask(), IsMasked(), LoadXML(), SaveXML(), and SetMask().

FIBITMAP* CTexture::m_pBitmap [protected]
 

Pointer to FreeImage structure for raw image data Definition at line 124 of file Texture.h.

Referenced by Destroy(), GetBitmap(), GetDepth(), GetHeight(), GetPixel(), GetWidth(), and SetPixel().

CString CTexture::m_strTextureFilename [protected]
 

Texture filename Definition at line 125 of file Texture.h.

Referenced by GetTextureFilename(), and LoadXML().


The documentation for this class was generated from the following files:
Generated on Sun Jul 17 21:34:30 2005 for OpenGL GUI by doxygen 1.3.8