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

PixmapFormat Class Reference

This class describes a pixmap format. More...

#include <format.h>

Collaboration diagram for PixmapFormat:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Format {
  None = 0, Gray, GrayA, RGB,
  RGBA, RGBFT, _LASTF
}
 General image formats. These just represent what type of data is present in the channels. More...

enum  CommonID {
  Gray_1, Gray_8, Gray_16, GrayA_8,
  GrayA_16, RGB_8, RGB_16, RGBA_8,
  RGBA_16, RGB_555, RGB_565, RGBFT_f,
  _LASTID
}
 Commonly used formats for convenience:. More...


Public Member Functions

 PixmapFormat (CommonID cid)
 Construct a commonly used pixmap format:.

 PixmapFormat (Format id, const signed char *bits)
 PixmapFormat (const PixmapFormat &pf)
 Copy constructor:.

 ~PixmapFormat ()
void set (CommonID cid)
 Assign a format; this works like the constructors above.

void set (Format id, const signed char *bits)
PixmapFormatoperator= (CommonID cid)
PixmapFormatoperator= (const PixmapFormat &pf)
Format format () const
short int nchannels () const
signed char bits (short int c) const
 No range check on the channel index c=0..nchannels()-1.

signed char SameBitsForAll () const
bool operator== (const PixmapFormat &pf) const
 Compare two pixmap formats if they match exactly.

bool operator!= (const PixmapFormat &pf) const
bool operator== (Format fmt) const
 Compare format (identifier), not bit depths:.

bool operator!= (Format fmt) const

Static Public Attributes

const int MaxChannels = 6
const signed char FloatBits = -1
 Special value for the bits[]:.

const short int _nchannels [_LASTF]
 Returns the number of channels when indexed with a format:.


Private Member Functions

void _set (CommonID cid)
void _set (Format fmt, const signed char *bits)

Private Attributes

FMT f
 See above; this stores the actual format information.


Detailed Description

This class describes a pixmap format.

The pixmap format is specified by the number of channels and the number of bits in each channel. There are a number of constructors for connonly used values.

See also:
File format.h for more information.
Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [

Definition at line 59 of file format.h.


Member Enumeration Documentation

enum PixmapFormat::CommonID
 

Commonly used formats for convenience:.

These are just shortcuts for commonly used formats.

Enumeration values:
Gray_1  1 bit black/white bitmap
Gray_8  8 bit grayscale
Gray_16  16 bit grayscale
GrayA_8  8 bit grayscale with 8 bit alpha channel
GrayA_16  16 bit grayscale with 16 bit alpha channel
RGB_8  RGB, 8 bit per channel.
RGB_16  RGB, 16 bit per channel.
RGBA_8  RGB+alpha, 8 bit per channel.
RGBA_16  RGB+alpha, 16 bit per channel.
RGB_555  RGB, 5 bit per channel.
RGB_565  RGB, 5 bit for red,blue and 6 bit for green.
RGBFT_f  RGBFT, flt values.
_LASTID  (internal use; must be last)

Definition at line 89 of file format.h.

enum PixmapFormat::Format
 

General image formats. These just represent what type of data is present in the channels.

Enumeration values:
None  (no format)
Gray  grayscale; 1 channel
GrayA  grayscale [0] with alpha [1]; 2 channels
RGB  red [0], green [1], blue [2]; 3 channels
RGBA  red [0], green [1], blue [2], alpha [3]; 4 channels
RGBFT  RGB + filter [3], transmit [4]; 5 channels.
_LASTF  (internal use; must be last)

Definition at line 70 of file format.h.

Referenced by format().


Constructor & Destructor Documentation

PixmapFormat::PixmapFormat CommonID  cid  )  [inline]
 

Construct a commonly used pixmap format:.

Definition at line 139 of file format.h.

References _set().

PixmapFormat::PixmapFormat Format  id,
const signed char *  bits
[inline]
 

Construct a pixmap format by specifying a format (e.g. RGB) and the number of bits in each channel. Use FloatBits for flt representation. bits[] is an array with one entry for each channel; the number of channels is known from the format. For example, for format RGBA, there are 4 channels and their width in bits is specified in the order R-G-B-A (as suggested by the format "mnemonic").

Definition at line 148 of file format.h.

References _set().

PixmapFormat::PixmapFormat const PixmapFormat pf  )  [inline]
 

Copy constructor:.

Definition at line 151 of file format.h.

References f.

PixmapFormat::~PixmapFormat  )  [inline]
 

Definition at line 152 of file format.h.


Member Function Documentation

void PixmapFormat::_set Format  fmt,
const signed char *  bits
[private]
 

Definition at line 82 of file format.cc.

References _LASTF, _nchannels, Assert, PixmapFormat::FMT::bits, f, and PixmapFormat::FMT::format.

void PixmapFormat::_set CommonID  cid  )  [private]
 

For internal use only.

Internally used:

Definition at line 75 of file format.cc.

References _LASTID, Assert, commons, and f.

Referenced by operator=(), PixmapFormat(), and set().

signed char PixmapFormat::bits short int  c  )  const [inline]
 

No range check on the channel index c=0..nchannels()-1.

Definition at line 168 of file format.h.

References PixmapFormat::FMT::bits, and f.

Referenced by PixmapImageTile::_SetPixelFuncs(), operator==(), and SameBitsForAll().

Format PixmapFormat::format  )  const [inline]
 

Query format, number of channels and bits per channel (FloatBits for flt):

Definition at line 165 of file format.h.

References f, PixmapFormat::FMT::format, and Format.

short int PixmapFormat::nchannels  )  const [inline]
 

Definition at line 166 of file format.h.

References _nchannels, f, and PixmapFormat::FMT::format.

Referenced by PixmapImageTile::_SetPixelFuncs(), operator==(), and SameBitsForAll().

bool PixmapFormat::operator!= Format  fmt  )  const [inline]
 

Definition at line 184 of file format.h.

References f, and PixmapFormat::FMT::format.

bool PixmapFormat::operator!= const PixmapFormat pf  )  const [inline]
 

Definition at line 179 of file format.h.

References operator==().

PixmapFormat& PixmapFormat::operator= const PixmapFormat pf  )  [inline]
 

Definition at line 160 of file format.h.

References f.

PixmapFormat& PixmapFormat::operator= CommonID  cid  )  [inline]
 

Definition at line 158 of file format.h.

References _set().

bool PixmapFormat::operator== Format  fmt  )  const [inline]
 

Compare format (identifier), not bit depths:.

Definition at line 183 of file format.h.

References f, and PixmapFormat::FMT::format.

bool PixmapFormat::operator== const PixmapFormat pf  )  const
 

Compare two pixmap formats if they match exactly.

Definition at line 91 of file format.cc.

References bits(), f, PixmapFormat::FMT::format, and nchannels().

Referenced by operator!=().

signed char PixmapFormat::SameBitsForAll  )  const
 

Check if all channels have equal number of bits and return the number of bits in that case. If the number of channels is 0 (format None) or the channels have different number of bits, 0 is returned.

Definition at line 64 of file format.cc.

References bits(), and nchannels().

Referenced by PixmapImageTile::_SetPixelFuncs().

void PixmapFormat::set Format  id,
const signed char *  bits
[inline]
 

Definition at line 156 of file format.h.

References _set().

void PixmapFormat::set CommonID  cid  )  [inline]
 

Assign a format; this works like the constructors above.

Definition at line 155 of file format.h.

References _set().


Member Data Documentation

const short int PixmapFormat::_nchannels [static]
 

Initial value:

{
    0,   
    1,   
    2,   
    3,   
    4,   
    5,   
}
Returns the number of channels when indexed with a format:.

Definition at line 53 of file format.cc.

Referenced by _set(), and nchannels().

FMT PixmapFormat::f [private]
 

See above; this stores the actual format information.

Definition at line 132 of file format.h.

Referenced by _set(), bits(), format(), nchannels(), operator!=(), operator=(), operator==(), and PixmapFormat().

const signed char PixmapFormat::FloatBits = -1 [static]
 

Special value for the bits[]:.

Definition at line 112 of file format.h.

const int PixmapFormat::MaxChannels = 6 [static]
 

Definition at line 63 of file format.h.


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