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

Pixel Class Reference

Reference to a pixel inside a Bmp. More...

#include <Bmp.h>

Collaboration diagram for Pixel:

Collaboration graph
[legend]
List of all members.

Public Methods

 Pixel ()
 Construct a NULL-Pixel. More...

 Pixel (unsigned char *pixPtr)
 Construct a Pixel. More...

virtual ~Pixel ()
unsigned char * getPixPointer ()
 provides low-level acces to the pixel pointer. More...

const unsigned char * getPixPointer () const
int color (int rgb) const
 return one color channel of the pixel. More...

void set_color (int rgb, unsigned char value)
 set the color of one channel. More...

bool hasTransparentColor () const
 Tests if a pixel is transparent ( = black). More...

void countMisMatches (const Pixel &other, long &matchCounter, long &mismatchCounter, int max_dist)
 function for fuzzy pixel comparison. More...

long distance (const Pixel &other) const
 calculates the color-distance between two Pixels. More...

Pixel & operator++ ()
 increments to the next pixel (rightwards, line by line). More...

bool operator== (const Pixel &other) const
bool operator!= (const Pixel &other) const

Static Public Methods

void defineTransparentColor (unsigned char red, unsigned char green, unsigned char blue)
 defines the transparent color (default = 0, 0, 0). More...

void useTransparentColor (bool enabled)
 control whether a transparent color should be used (default is no). More...


Private Attributes

unsigned char * pix

Static Private Attributes

unsigned char transparent_red = 0
unsigned char transparent_green = 0
unsigned char transparent_blue = 0
bool use_transparent_color = false

Detailed Description

Reference to a pixel inside a Bmp.

Definition at line 40 of file Bmp.h.


Constructor & Destructor Documentation

Pixel   [inline]
 

Construct a NULL-Pixel.

Definition at line 50 of file Bmp.h.

Pixel unsigned char *    pixPtr [inline]
 

Construct a Pixel.

Parameters:
pixPtr  pointer into Bmp bitmap
See also:
Bmp::getPixel

Definition at line 55 of file Bmp.h.

virtual ~Pixel   [inline, virtual]
 

Definition at line 56 of file Bmp.h.


Member Function Documentation

unsigned char* getPixPointer   [inline]
 

provides low-level acces to the pixel pointer.

Definition at line 59 of file Bmp.h.

Referenced by Bmp::getPositions().

const unsigned char* getPixPointer   const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 61 of file Bmp.h.

int color int    rgb const [inline]
 

return one color channel of the pixel.

Parameters:
rgb  channel selector (0 = red, 1 = green, 2 = blue)
Returns:
value of the channel

Definition at line 67 of file Bmp.h.

Referenced by Pixel::countMisMatches(), Pixel::distance(), rs::halfBmp(), Pixel::hasTransparentColor(), and Pixel::operator==().

void set_color int    rgb,
unsigned char    value
[inline]
 

set the color of one channel.

Parameters:
rgb  channel selector (0 = red, 1 = green, 2 = blue)
value  new value for the channel

Definition at line 73 of file Bmp.h.

bool hasTransparentColor   const [inline]
 

Tests if a pixel is transparent ( = black).

Returns:
true if transparent
See also:
defineTransparentColor

Definition at line 79 of file Bmp.h.

Referenced by Pixel::countMisMatches(), and Pixel::distance().

void defineTransparentColor unsigned char    red,
unsigned char    green,
unsigned char    blue
[static]
 

defines the transparent color (default = 0, 0, 0).

Parameters:
red  value for red channel
green  value for green channel
blue  value for blue channel

Definition at line 43 of file Bmp.cpp.

void useTransparentColor bool    enabled [inline, static]
 

control whether a transparent color should be used (default is no).

Parameters:
enabled  if true = > transparent color will be used

Definition at line 96 of file Bmp.h.

void countMisMatches const Pixel &    other,
long &    matchCounter,
long &    mismatchCounter,
int    max_dist
[inline]
 

function for fuzzy pixel comparison.

Parameters:
other  Pixel to compare with
matchCounter  if none of the color channels differ more than max_dist matchCounter is incremented
mismatchCounter  otherwise mismatchCounter is incremented
max_dist  maximum color difference counted as match
Note:
if one of the Pixel's hasTransparentColor() the comparison neither counts as mismatch nor as match.

Definition at line 109 of file Bmp.h.

long distance const Pixel &    other const [inline]
 

calculates the color-distance between two Pixels.

Parameters:
other  the other pixel
Returns:
distance color distance

Definition at line 128 of file Bmp.h.

Pixel& operator++   [inline]
 

increments to the next pixel (rightwards, line by line).

Note:
be careful: you may run out of the bitmap with this operator

Definition at line 141 of file Bmp.h.

bool operator== const Pixel &    other const [inline]
 

Definition at line 146 of file Bmp.h.

bool operator!= const Pixel &    other const [inline]
 

Definition at line 153 of file Bmp.h.


Member Data Documentation

unsigned char* pix [private]
 

Definition at line 42 of file Bmp.h.

Referenced by Pixel::color(), Pixel::getPixPointer(), Pixel::operator++(), Pixel::Pixel(), and Pixel::set_color().

unsigned char transparent_red = 0 [static, private]
 

Definition at line 35 of file Bmp.cpp.

Referenced by Pixel::hasTransparentColor().

unsigned char transparent_green = 0 [static, private]
 

Definition at line 36 of file Bmp.cpp.

Referenced by Pixel::hasTransparentColor().

unsigned char transparent_blue = 0 [static, private]
 

Definition at line 37 of file Bmp.cpp.

Referenced by Pixel::hasTransparentColor().

bool use_transparent_color = false [static, private]
 

Definition at line 38 of file Bmp.cpp.

Referenced by Pixel::hasTransparentColor(), and Pixel::useTransparentColor().


The documentation for this class was generated from the following files:
Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen