Faith::Image Class Reference

#include <faith/image.h>

List of all members.

Public Types

 IgnoreEndian
 BigEndian
 LittleEndian
enum  Endian { IgnoreEndian, BigEndian, LittleEndian }

Public Member Functions

 Image ()
 ~Image ()
 Image (const Size &sz, int depth, int numColor=0, Endian bitOrder=IgnoreEndian)
 Image (int w, int h, int depth, int numColor=0, Endian bitOrder=IgnoreEndian)
 Image (const Image &copy)
 Image (unsigned char *data, int w, int h, int depth, int pitch, Endian bitOrder)
 Image (const char *filename)
void create (int w, int h, int depth, int numColor=0, Endian bitOrder=IgnoreEndian)
Imageoperator= (const Image &copy)
bool operator== (const Image &other) const
bool operator!= (const Image &other) const
void detach ()
bool hasAlpha () const
void setAlpha (bool enabled)
bool isNull () const
Faith::Image createAlphaMask () const
int width () const
int height () const
int pitch () const
int bytesPerLine () const
int numBytes () const
int depth () const
Size size () const
Rect rect () const
unsigned char * scanLine (int i)
const unsigned char * scanLine (int i) const
unsigned char * bits ()
const unsigned char * bits () const
const unsigned char *const * jumpTable () const
unsigned int pixelIndex (int x, int y) const
Rgb pixel (int x, int y) const
void setPixel (int x, int y, unsigned int pixel)
void reset ()
Rgb color (int i) const
void setColor (int i, Rgb color)
void save (const char *filename) const


Member Enumeration Documentation

enum Faith::Image::Endian

Enumerator:
IgnoreEndian 
BigEndian 
LittleEndian 


Constructor & Destructor Documentation

Faith::Image::Image (  ) 

Faith::Image::~Image (  ) 

Faith::Image::Image ( const Size sz,
int  depth,
int  numColor = 0,
Endian  bitOrder = IgnoreEndian 
)

Faith::Image::Image ( int  w,
int  h,
int  depth,
int  numColor = 0,
Endian  bitOrder = IgnoreEndian 
)

Faith::Image::Image ( const Image copy  ) 

Faith::Image::Image ( unsigned char *  data,
int  w,
int  h,
int  depth,
int  pitch,
Endian  bitOrder 
)

construct an image from data. The data is used as is and is not copied nor destroyed, so you must make sure that it outlives the existance of this instance of Image, and is deleted by you.

Parameters:
data is the data that is maintained by you
w is the width of the image
h is the height of the image
depth is the number of bits per pixel, 1, 8, or 32
pitch is the number of bytes per line. An 8 bit-per-pixel image usually has this as the same as w. The generation of the jumpTable() is dependant on this

Faith::Image::Image ( const char *  filename  ) 


Member Function Documentation

const unsigned char* Faith::Image::bits (  )  const [inline]

unsigned char* Faith::Image::bits (  )  [inline]

int Faith::Image::bytesPerLine (  )  const [inline]

Rgb Faith::Image::color ( int  i  )  const

Returns:
the given color number i in the color table (or does nothing if a color table doesn't exist

void Faith::Image::create ( int  w,
int  h,
int  depth,
int  numColor = 0,
Endian  bitOrder = IgnoreEndian 
)

Faith::Image Faith::Image::createAlphaMask (  )  const

Returns:
a 1 bit per pixel image representing how transparent this image is

int Faith::Image::depth (  )  const

Returns:
1, 8, or 32

void Faith::Image::detach (  ) 

bool Faith::Image::hasAlpha (  )  const

int Faith::Image::height (  )  const

bool Faith::Image::isNull (  )  const

Returns:
whether the image is null. An image that is null is one that has been constructed with the default ctor

const unsigned char* const* Faith::Image::jumpTable (  )  const

Returns:
the array with a pointer to each scanLine

int Faith::Image::numBytes (  )  const

bool Faith::Image::operator!= ( const Image other  )  const [inline]

Image& Faith::Image::operator= ( const Image copy  ) 

bool Faith::Image::operator== ( const Image other  )  const

int Faith::Image::pitch (  )  const

Returns:
the number of bytes used for each scanline

Rgb Faith::Image::pixel ( int  x,
int  y 
) const

Returns:
the color at the given position

unsigned int Faith::Image::pixelIndex ( int  x,
int  y 
) const

Returns:
the data stored at the given position.
If it is an indexed-color pixel, it returns the index, otherwise it will return the actual color

Rect Faith::Image::rect (  )  const

Returns:
a rectangle where the origin is zero: Rect(0, 0, width(), height())

void Faith::Image::reset (  ) 

nullifies the image. Deletes the data. isNull() returns true

void Faith::Image::save ( const char *  filename  )  const

const unsigned char* Faith::Image::scanLine ( int  i  )  const

unsigned char* Faith::Image::scanLine ( int  i  ) 

Returns:
the array of pixels as stored by me. you can cast what I return to the Faith::Rgb type if it's a 32bpp image

void Faith::Image::setAlpha ( bool  enabled  ) 

create or eliminate the alpha channel

void Faith::Image::setColor ( int  i,
Rgb  color 
)

void Faith::Image::setPixel ( int  x,
int  y,
unsigned int  pixel 
)

changes the color of the pixel at the given pixel

if the image has a depth of 8 bpp or less, the pixel is a position in the color table. The results are undefined if pixel is more than the last color

Size Faith::Image::size (  )  const

Returns:
the geometry of the rectangle

int Faith::Image::width (  )  const


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 00:23:09 2006 for Faith by  doxygen 1.4.7