Main Page | Alphabetical List | Class List | File List | Class Members

CTexture Class Reference

The main class for texture loading. It also allows some simple operations on alpha channel. More...

List of all members.

Public Member Functions

int getWidth () const
 returns texture width

int getHeight () const
 returns texture height

bool isAlpha () const
 true if texture is in RGBA format

unsigned char * getData () const
 returns texture data (see isAlpha to test if the texture format is RGB or RGBA)

const char * getName () const
 returns the name of the texture (filename in most cases)

void computeNormals (double scale=1.0, double norme=1.0)
 Convert texture to a normal texture.

void convertToNormal (double scale=1.0, double norme=1.0)
 Same as computeNormals.

virtual void convert2Alpha (unsigned char r, unsigned char g, unsigned char b, unsigned char tolerence)
 Same as computeAlpha with alpha_color functor.

virtual void loadAlphaMap (CTexture *)
 Load an alpha map from the red component of another CTexture.

void loadAlphaMap (const char *)
 Load an alpha map from the red component of an image file.

void computeAlpha (const alpha_functor &af)
 Compute alpha map from an alpha_functor (see alpha_zero and alpha_one).

CTexturecomputeNextMIPMapLevel (const mipmap_functor &mip) const
 Compute next MIP-map level map from a mipmap_functor.

CTextureconvolve (CTexture *kernel) const
 Convolves the texture by the kernel.

void copy (int x, int y, const CTexture *tex, const copy_functor &cpy=copy_std())
 Copy texture tex at coords x,y.

void convert (const convert_functor &cnv=convert_std())
 Convert a texture.

CTexturedifference (const CTexture *)
 Compute difference with texture.

CTextureextract (int x, int y, int w, int h)
 Extracts a part of a texture as a new texture (with a copy of the data).

int memsize () const
 Returns the size of texture data in memory.

void flipY ()
 Apply an horizontal flip.

void flipX ()
 Apply a vertical flip.

void setDataOwner (bool b)
 Tell if the instance should erase its RGB(A) data when deleted.

unsigned char get (int i, int j, int c) const
 Retrieve color component.

unsigned char & set (int i, int j, int c)
 Access color component.

unsigned char getmod (int i, int j, int c) const
 Retrieve color component (modulo).

unsigned char getclp (int i, int j, int c) const
 Retrieve color component (clamp).

unsigned char getlin (double i, double j, int c) const
 Retrieve color component (linear interpolation).

unsigned char tex2D (double i, double j, int c) const
 Retrieve color component (linear interpolation), access in normalized texture space.


Static Public Member Functions

CTextureloadTexture (const char *)
 Load a CTexture from an image file.

void saveTexture (const CTexture *, const char *)
 Save a CTexture to an image file.


Detailed Description

The main class for texture loading. It also allows some simple operations on alpha channel.


Member Function Documentation

CTexture* CTexture::computeNextMIPMapLevel const mipmap_functor &  mip  )  const
 

Compute next MIP-map level map from a mipmap_functor.

Works only on textures with width and height that are power of 2.

void CTexture::computeNormals double  scale = 1.0,
double  norme = 1.0
 

Convert texture to a normal texture.

Luminance is used as an height field to compute normals by finite differencing. The scale factor applies to the height map.

virtual void CTexture::convert2Alpha unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  tolerence
[virtual]
 

Same as computeAlpha with alpha_color functor.

Deprecated.

void CTexture::convertToNormal double  scale = 1.0,
double  norme = 1.0
 

Same as computeNormals.

Deprecated.

CTexture* CTexture::convolve CTexture kernel  )  const
 

Convolves the texture by the kernel.

A new texture is created

void CTexture::copy int  x,
int  y,
const CTexture tex,
const copy_functor &  cpy = copy_std()
 

Copy texture tex at coords x,y.

If the texture goes outside of borders, it is clipped.

CTexture* CTexture::loadTexture const char *   )  [static]
 

Load a CTexture from an image file.

The format is automaticaly deduced from extension.

void CTexture::saveTexture const CTexture ,
const char * 
[static]
 

Save a CTexture to an image file.

The format is automaticaly deduced from extension.


The documentation for this class was generated from the following file:
Generated on Tue Sep 21 17:28:12 2004 for libTexture by doxygen 1.3.5