BmpRGBSampleValue Class Reference

a sample in a bmp rgb (i.e. 24-bit) file

`#include <BmpRGBSampleValue.h>`

Inheritance diagram for BmpRGBSampleValue:

## Public Member Functions

| BmpRGBSampleValue (BYTE r, BYTE g, BYTE b)
| BmpRGBSampleValue (RGBTriple t)
UWORD32 | calcDistance (const SampleValue *s) const
SampleValue * | getNearestTargetSampleValue (EmbValue t) const
std::string | getName (void) const
BYTE | getRed (void) const
BYTE | getGreen (void) const
BYTE | getBlue (void) const
Public Member Functions inherited from BmpSampleValue
| BmpSampleValue (void)
Public Member Functions inherited from SampleValue
| SampleValue (void)
virtual | ~SampleValue (void)
virtual bool | isNeighbour (const SampleValue *s) const
EmbValue | getEmbeddedValue (void) const
UWORD32 | getKey (void) const
bool | operator== (const SampleValue &sv) const
bool | operator!= (const SampleValue &sv) const
bool | operator< (const SampleValue &sv) const
UWORD32 | getNumEdges (EmbValue t) const
void | setNumEdges (EmbValue t, UWORD32 ne)
void | incNumEdges (EmbValue t)
void | decNumEdges (EmbValue t)
void | setLabel (unsigned long l)
unsigned long | getLabel (void) const
void | print (unsigned short spc=0) const

## Private Types

enum | COLOR { RED , GREEN , BLUE }
enum | DIRECTION { UP , DOWN }

## Private Member Functions

UWORD32 | calcKey (const RGBTriple &rgb) const
EmbValue | calcEValue (const RGBTriple &rgb) const
BYTE | plus (BYTE a, BYTE b) const
BYTE | minus (BYTE a, BYTE b) const
void | addNTSVCandidates (std::vector< RGBTriple > &cands, const BYTE cube[3][2], COLOR fc, DIRECTION fd, COLOR i1, COLOR i2, EmbValue t) const

## Private Attributes

RGBTriple | Color

## Additional Inherited Members

Protected Attributes inherited from SampleValue
EmbValue | EValue
| the bit that is embedded in this sample value - must be set in constructor of derived class
UWORD32 | Key
| the key of this sample value - must be different for two different sample values - must be set in constructor of derived class

## Member Enumeration Documentation

## COLOR

enum BmpRGBSampleValue::COLOR

private

Enumerator
RED |
GREEN |
BLUE |

## DIRECTION

enum BmpRGBSampleValue::DIRECTION

private

Enumerator
UP |
DOWN |

## Constructor & Destructor Documentation

## BmpRGBSampleValue() [1/2]

BmpRGBSampleValue::BmpRGBSampleValue | ( | BYTE | r,
|  | BYTE | g,
|  | BYTE | b )

## BmpRGBSampleValue() [2/2]

BmpRGBSampleValue::BmpRGBSampleValue | ( | RGBTriple | t | ) |

## Member Function Documentation

## addNTSVCandidates()

void BmpRGBSampleValue::addNTSVCandidates | ( | std::vector< RGBTriple > & | cands,
|  | const BYTE | cube[3][2],
|  | COLOR | fc,
|  | DIRECTION | fd,
|  | COLOR | i1,
|  | COLOR | i2,
|  | EmbValue | t ) const

private

add candidates for the nearest target sample value

Parameters

  cands | the candidates vector
  cube | the color values describing the current search cube
  fc | the fixed color
  fd | the fixed side of the fixed color

## calcDistance()

UWORD32 BmpRGBSampleValue::calcDistance | ( | const SampleValue * | s | ) | const

virtual

calculate the distance between the sample value s and this sample value

Parameters

  s | a sample value of the same type as this

Returns
  the distance

Reimplemented from BmpSampleValue.

## calcEValue()

EmbValue BmpRGBSampleValue::calcEValue | ( | const RGBTriple & | rgb | ) | const

inline private

## calcKey()

UWORD32 BmpRGBSampleValue::calcKey | ( | const RGBTriple & | rgb | ) | const

inline private

## getBlue()

BYTE BmpRGBSampleValue::getBlue | ( | void |  | ) | const

inline virtual

get the blue color component

Implements BmpSampleValue.

## getGreen()

BYTE BmpRGBSampleValue::getGreen | ( | void |  | ) | const

inline virtual

get the green color component

Implements BmpSampleValue.

## getName()

std::string BmpRGBSampleValue::getName | ( | void |  | ) | const

virtual

return a short name uniquely identifying this sample value

Implements SampleValue.

## getNearestTargetSampleValue()

SampleValue * BmpRGBSampleValue::getNearestTargetSampleValue | ( | EmbValue | t | ) | const

virtual

get the nearest (with the least distance to this sample value) sample value whose embedded value equals the specified target

Parameters

  t | the target embedded value

If two or more target sample values have equal distance each of them should be returned with equal probability.

The returned SampleValue object should be deleted by the callser.

Implements SampleValue.

## getRed()

BYTE BmpRGBSampleValue::getRed | ( | void |  | ) | const

inline virtual

get the red color component

Implements BmpSampleValue.

## minus()

BYTE BmpRGBSampleValue::minus | ( | BYTE | a,
|  | BYTE | b ) const

private

substract the BYTE b from the BYTE a

Returns
  max(0, a - b)

## plus()

BYTE BmpRGBSampleValue::plus | ( | BYTE | a,
|  | BYTE | b ) const

private

add the BYTEs a and b

Returns
  min(255, a + b)

## Member Data Documentation

## Color

RGBTriple BmpRGBSampleValue::Color

private

The documentation for this class was generated from the following files:

- BmpRGBSampleValue.h
- BmpRGBSampleValue.cc