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

PixmapImageTile Class Reference

This class provides storage for a pixmap image tile in RAM. More...

#include <imagetile.h>

Inheritance diagram for PixmapImageTile:

Inheritance graph
[legend]
Collaboration diagram for PixmapImageTile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PixmapImageTile ()
 PixmapImageTile (const PixmapFormat &pf, uint width, uint height)
 ~PixmapImageTile ()
void setup (const PixmapFormat &pf, uint width, uint height)
uint width () const
 Get width and height of tile:.

uint height () const
uint DataSize () const
void GetPixel8 (uint x, uint y, uint8 *p) const
void PutPixel8 (uint x, uint y, const uint8 *p)
void GetPixel16 (uint x, uint y, uint16 *p) const
void PutPixel16 (uint x, uint y, const uint16 *p)
void GetPixelF (uint x, uint y, flt *p) const
void PutPixelF (uint x, uint y, const flt *p)

Public Attributes

char * data
 image data storage or NULL (swapped out)


Private Member Functions

void _ZapPixelFuncs ()
 Set default (i.e. CritAssert(0)-like) get/put pixel functions:.

int _SetPixelFuncs (const PixmapFormat &pf)
 PixmapImageTile (const PixmapImageTile &)
 DO NOT USE THESE:.

void operator= (const PixmapImageTile &)

Private Attributes

uint w
uint h
 size of the image (tile) in pixels

size_t size
 size of data[] in bytes

PixmapImageTile::Methods meth

Friends

class PixmapImageTileInternal

Detailed Description

This class provides storage for a pixmap image tile in RAM.

For internal use only.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
THIS CLASS IS NOT INTENDED TO BE USED EXTERNALLY; USE PixmapImage INSTEAD.

The image data is stored as dense as possible in the buffer data[]. In order to set or get pixels, use setpixel() and getpixel(). You must use SetFormat() or the apropriate constructor to set the pixmap format before starting to store data.

NOTE: You are responsible for (de)allocating (or swapping in/out) memory for this type; the data member is public and needs to be externally controlled. This type can merely calculate the required amount of memory.

NOTE: This type is not "C++-safe"; do NOT use copy constructor or assignment operator for this type.

Definition at line 56 of file imagetile.h.


Constructor & Destructor Documentation

PixmapImageTile::PixmapImageTile const PixmapImageTile  )  [private]
 

DO NOT USE THESE:.

PixmapImageTile::PixmapImageTile  ) 
 

Default constructor which can also be used for arrays. Sets width=height=size=0, data=NULL. Use setup() lateron so set the format and size.

Definition at line 647 of file imagetile.cc.

References _ZapPixelFuncs().

PixmapImageTile::PixmapImageTile const PixmapFormat pf,
uint  width,
uint  height
 

Set format and size. Note that the format is not stored inside the image tile and an assertion will fail if the format is not supported. Data is NOT allocated for that.

Definition at line 655 of file imagetile.cc.

References _SetPixelFuncs(), CritAssert, data, and uint.

PixmapImageTile::~PixmapImageTile  ) 
 

Definition at line 666 of file imagetile.cc.


Member Function Documentation

int PixmapImageTile::_SetPixelFuncs const PixmapFormat pf  )  [private]
 

Choose the correct pixel functions according to the format. This also sets the >size< value according to width and height. Will return 0 on success and 1 for a non-supported format. See the implementation on supported formats.

Definition at line 548 of file imagetile.cc.

References _ZapPixelFuncs(), PixmapFormat::bits(), flt, h, meth, PixmapFormat::nchannels(), PixmapFormat::SameBitsForAll(), size, and w.

Referenced by PixmapImageTile(), and setup().

void PixmapImageTile::_ZapPixelFuncs  )  [private]
 

Set default (i.e. CritAssert(0)-like) get/put pixel functions:.

Definition at line 537 of file imagetile.cc.

References PixmapImageTile::Methods::getpixel16, PixmapImageTile::Methods::getpixel8, PixmapImageTile::Methods::getpixelF, meth, PixmapImageTile::Methods::putpixel16, PixmapImageTile::Methods::putpixel8, and PixmapImageTile::Methods::putpixelF.

Referenced by _SetPixelFuncs(), and PixmapImageTile().

uint PixmapImageTile::DataSize  )  const [inline]
 

Get size in memory; this is the size of the tile and has the same value independent of data being present or not.

Definition at line 117 of file imagetile.h.

References size, and uint.

void PixmapImageTile::GetPixel16 uint  x,
uint  y,
uint16 p
const [inline]
 

Definition at line 135 of file imagetile.h.

References PixmapImageTile::Methods::getpixel16, meth, uint, and uint16.

void PixmapImageTile::GetPixel8 uint  x,
uint  y,
uint8 p
const [inline]
 

Get pixel at (x,y) and store values in *p. Set pixel at (x,y) to values passed in *p. p[] is an array with one entry for each channel. The values in p[] are the raw values in the image; there is no scaling applied. This means that valid values for p[] in an image with 4 bit per channel range from 0..15 (=2^4-1). Hence, do not use the 8 bit versions for images which have channels with greater bit depth. These functions cannot be used for images saved as flt values (an assertion will fail in that case). NOTE: No range check is done for speed reasons. No check if *data is NULL (swapped out) is performed.

Definition at line 131 of file imagetile.h.

References PixmapImageTile::Methods::getpixel8, meth, uint, and uint8.

void PixmapImageTile::GetPixelF uint  x,
uint  y,
flt p
const [inline]
 

Like above pixel functions but using flt values. If the image is stored as flt values (see FloatBits in PixmapFormat), the raw flt values are returned. If the image is stored as integer values, the values are scaled to the flt range 0..1 (inclusive both "borders").

Definition at line 145 of file imagetile.h.

References flt, PixmapImageTile::Methods::getpixelF, meth, and uint.

uint PixmapImageTile::height  )  const [inline]
 

Definition at line 113 of file imagetile.h.

References h, and uint.

void PixmapImageTile::operator= const PixmapImageTile  )  [private]
 

void PixmapImageTile::PutPixel16 uint  x,
uint  y,
const uint16 p
[inline]
 

Definition at line 137 of file imagetile.h.

References meth, PixmapImageTile::Methods::putpixel16, uint, and uint16.

void PixmapImageTile::PutPixel8 uint  x,
uint  y,
const uint8 p
[inline]
 

Definition at line 133 of file imagetile.h.

References meth, PixmapImageTile::Methods::putpixel8, uint, and uint8.

void PixmapImageTile::PutPixelF uint  x,
uint  y,
const flt p
[inline]
 

Definition at line 147 of file imagetile.h.

References flt, meth, PixmapImageTile::Methods::putpixelF, and uint.

void PixmapImageTile::setup const PixmapFormat pf,
uint  width,
uint  height
 

Set the format and size. If some other format was already set, the stored information is freed. No data is alloctated.

Definition at line 637 of file imagetile.cc.

References _SetPixelFuncs(), CritAssert, h, uint, and w.

uint PixmapImageTile::width  )  const [inline]
 

Get width and height of tile:.

Definition at line 112 of file imagetile.h.

References uint, and w.


Friends And Related Function Documentation

friend class PixmapImageTileInternal [friend]
 

Definition at line 58 of file imagetile.h.


Member Data Documentation

char* PixmapImageTile::data
 

image data storage or NULL (swapped out)

Definition at line 63 of file imagetile.h.

Referenced by PixmapImageTileInternal::getpixel16_1(), PixmapImageTileInternal::getpixel16_12(), PixmapImageTileInternal::getpixel16_555(), PixmapImageTileInternal::getpixel16_565(), PixmapImageTileInternal::getpixel8_1(), PixmapImageTileInternal::getpixel8_555(), PixmapImageTileInternal::getpixel8_565(), PixmapImageTileInternal::getpixel_1(), PixmapImageTileInternal::getpixel_2(), PixmapImageTileInternal::getpixel_3(), PixmapImageTileInternal::getpixel_4(), PixmapImageTileInternal::getpixel_5(), PixmapImageTileInternal::getpixelF_1(), PixmapImageTileInternal::getpixelF_555(), PixmapImageTileInternal::getpixelF_565(), PixmapImageTile(), PixmapImageTileInternal::putpixel16_1(), PixmapImageTileInternal::putpixel16_12(), PixmapImageTileInternal::putpixel16_555(), PixmapImageTileInternal::putpixel16_565(), PixmapImageTileInternal::putpixel8_1(), PixmapImageTileInternal::putpixel8_555(), PixmapImageTileInternal::putpixel8_565(), PixmapImageTileInternal::putpixel_1(), PixmapImageTileInternal::putpixel_2(), PixmapImageTileInternal::putpixel_3(), PixmapImageTileInternal::putpixel_4(), PixmapImageTileInternal::putpixel_5(), PixmapImageTileInternal::putpixelF_1(), PixmapImageTileInternal::putpixelF_555(), and PixmapImageTileInternal::putpixelF_565().

uint PixmapImageTile::h [private]
 

size of the image (tile) in pixels

Definition at line 60 of file imagetile.h.

Referenced by _SetPixelFuncs(), height(), and setup().

struct PixmapImageTile::Methods PixmapImageTile::meth [private]
 

Pointers to the get/put pixel functions to be used for the format. These pointers are never NULL, if they cannot be used then they point to a version which will abort the program via an assertion.

Referenced by _SetPixelFuncs(), _ZapPixelFuncs(), GetPixel16(), GetPixel8(), GetPixelF(), PutPixel16(), PutPixel8(), and PutPixelF().

size_t PixmapImageTile::size [private]
 

size of data[] in bytes

Definition at line 61 of file imagetile.h.

Referenced by _SetPixelFuncs(), and DataSize().

uint PixmapImageTile::w [private]
 

Definition at line 60 of file imagetile.h.

Referenced by _SetPixelFuncs(), PixmapImageTileInternal::getpixel16_1(), PixmapImageTileInternal::getpixel16_12(), PixmapImageTileInternal::getpixel16_555(), PixmapImageTileInternal::getpixel16_565(), PixmapImageTileInternal::getpixel8_1(), PixmapImageTileInternal::getpixel8_555(), PixmapImageTileInternal::getpixel8_565(), PixmapImageTileInternal::getpixel_1(), PixmapImageTileInternal::getpixel_2(), PixmapImageTileInternal::getpixel_3(), PixmapImageTileInternal::getpixel_4(), PixmapImageTileInternal::getpixel_5(), PixmapImageTileInternal::getpixelF_1(), PixmapImageTileInternal::getpixelF_555(), PixmapImageTileInternal::getpixelF_565(), PixmapImageTileInternal::putpixel16_1(), PixmapImageTileInternal::putpixel16_12(), PixmapImageTileInternal::putpixel16_555(), PixmapImageTileInternal::putpixel16_565(), PixmapImageTileInternal::putpixel8_1(), PixmapImageTileInternal::putpixel8_555(), PixmapImageTileInternal::putpixel8_565(), PixmapImageTileInternal::putpixel_1(), PixmapImageTileInternal::putpixel_2(), PixmapImageTileInternal::putpixel_3(), PixmapImageTileInternal::putpixel_4(), PixmapImageTileInternal::putpixel_5(), PixmapImageTileInternal::putpixelF_1(), PixmapImageTileInternal::putpixelF_555(), PixmapImageTileInternal::putpixelF_565(), setup(), and width().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:34 2005 for Ray by doxygen 1.3.5