Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

ddgImage Class Reference

A convenience object to store a 2D image. More...

#include <ddgimage.h>

Class diagram for ddgImage:

ddgFrameBuffer

List of all members.


Public Members

 ddgImage ( unsigned short ch = 4)
Create an image but don't allocate memory. More...

 ddgImage ( unsigned short r, unsigned short c, unsigned short ch = 4)
Create an image and allocate memory.

 ~ddgImage ()
Destroy and image.

unsigned char* buffer (void)
Return the data block.

unsigned short channels (void)
Return the number of channels in the image.

void channels (unsigned short c )
Set the number of channels in the image.

unsigned short cols (void)
Return the width of the image.

unsigned short rows (void)
Return the height of the image.

bool allocate ( unsigned short r, unsigned short c, unsigned short ch = 0 )
Allocate a image buffer to be filled by the user. Return true on error.

void set (unsigned short r, unsigned short c, unsigned char d1, unsigned char d2 = 0, unsigned char d3 = 0, unsigned char d4 = 0)
Set a data entry in the image.

void get (unsigned short r, unsigned short c, unsigned char *d1, unsigned char *d2 = 0, unsigned char *d3 = 0, unsigned char *d4 = 0)
Get a data entry in the image.

unsigned char* get (unsigned short r, unsigned short c, unsigned char **p)
Get a pointer to a data entry in the image.

void copy (unsigned short sr, unsigned short sc,unsigned short dr, unsigned short dc)
Copy a value from one place to another.

void import ( ddgImage * isrc, unsigned int sc, unsigned int sr, unsigned int dc, unsigned int dr, unsigned int nc, unsigned int nr)
Copy block from one image to another.

bool readMemory ( unsigned char *buf )
Load an image buffer from a memory buffer. More...

bool readFile ( ddgStr *file )
Load an image buffer from a file try to determine the file automatically.

bool readRGB ( const char *filename)
Load an image buffer from an SGI RGB file.

bool readTGA (const char *filename)
Load an image buffer from a TGA file. More...

bool readPNG (const char *filename)
Load an image buffer from a PNG file.

bool readBW (const char *filename)
Load an image buffer from an old SGI format file.

bool writeTGA (const char *filename)
Save an image buffer from a file.

bool writePNG (const char *filename)
Save an image buffer to a file.

bool mapColorToAlpha ( unsigned char *color = NULL)
Add an alpha component to an RGB image alpha map will be transparent where the specific color is present and solid otherwise. More...

bool mapLuminanceToRGBA ( void )
Convert a LUMINANCE image to a full RGBA texture.

bool mapLuminanceToRGB ( void )
Convert a LUMINANCE image to a full RGB texture.

bool mapBrightNessToAlpha ( void )
Convert RGA image to RGBA image where A = ( R+G+B )/ 3.


Detailed Description

A convenience object to store a 2D image.

Images can be read from .rgb and TGA files. An image can store an arbitrary 2D set of data.


Member Function Documentation

ddgImage::ddgImage (unsigned short ch = 4)

Create an image but don't allocate memory.

ch is the number of channels (1-4). The t flag is true if this is an OpenGL texture which needs to be a power of 2.

bool ddgImage::readMemory (unsigned char * buf)

Load an image buffer from a memory buffer.

Return true on error.

bool ddgImage::readTGA (const char * filename)

Load an image buffer from a TGA file.

supports 8 bit color index black and white and 24 bit rgb images.

bool ddgImage::mapColorToAlpha (unsigned char * color = NULL)

Add an alpha component to an RGB image alpha map will be transparent where the specific color is present and solid otherwise.

If no color is specified, the color at location 0,0 is used.


The documentation for this class was generated from the following files:
Generated at Sun Sep 17 19:27:54 2000 for Digital Dawn Graphics Toolkit by doxygen 0.49-991205 written by Dimitri van Heesch, © 1997-1999