BmpFile Class Reference

`#include <BmpFile.h>`

Inheritance diagram for BmpFile:

## Classes

struct | struct_BITMAPFILEHEADER
struct | struct_BITMAPINFOHEADER
struct | struct_BITMAPCOREHEADER

## Public Member Functions

| BmpFile (void)
| BmpFile (BinaryIO *io)
| ~BmpFile (void)
void | read (BinaryIO *io)
void | write (void)
std::list< CvrStgFile::Property > | getProperties (void) const
std::vector< MatchingAlgorithm * > | getMatchingAlgorithms (Graph *g, Matching *m) const
unsigned long | getNumSamples (void) const
void | replaceSample (const SamplePos pos, const SampleValue *s)
SampleValue * | getSampleValue (SamplePos pos) const
std::vector< SampleValueAdjacencyList * > | calcSVAdjacencyLists (const std::vector< SampleValue * > &svs) const
unsigned short | getBitCount (void) const
unsigned long | getWidth (void) const
unsigned long | getHeight (void) const
ColorPalette * | getPalette (void) const
Public Member Functions inherited from CvrStgFile
| CvrStgFile (void)
virtual | ~CvrStgFile (void)
void | transform (const std::string &fn)
const std::string & | getName (void) const
bool | is_std (void) const
unsigned long | getCapacity (void) const
std::string | getHRCapacity (void) const
unsigned short | getSamplesPerVertex (void) const
UWORD32 | getRadius (void) const
EmbValue | getEmbValueModulus (void) const
virtual EmbValue | getEmbeddedValue (const SamplePos pos) const

## Protected Types

typedef struct BmpFile::struct_BITMAPFILEHEADER | BITMAPFILEHEADER
typedef struct BmpFile::struct_BITMAPINFOHEADER | BITMAPINFOHEADER
typedef struct BmpFile::struct_BITMAPCOREHEADER | BITMAPCOREHEADER

## Private Types

enum | SUBFORMAT { WIN , OS2 }

## Private Member Functions

void | readheaders ()
void | bmpwin_readheaders ()
void | bmpos2_readheaders ()
void | writeheaders ()
void | bmpwin_writeheaders ()
void | bmpos2_writeheaders ()
void | readdata ()
void | writedata ()
void | calcIndex (SamplePos pos, unsigned long *index, unsigned short *firstbit) const
unsigned long | calcLinelength ()
SUBFORMAT | getSubformat (void) const

## Private Attributes

SUBFORMAT | subformat
BITMAPFILEHEADER | bmfh
BITMAPINFOHEADER | bmih
BITMAPCOREHEADER | bmch
ColorPalette * | Palette
std::vector< std::vector< unsigned char > > | bitmap
std::vector< BYTE > | BitmapData
std::vector< BYTE > | atend
| contains bytes that are appended at the end of the bitmap data (some image editors apparently do this)

## Static Private Attributes

static const unsigned int | IdBm = 19778
static const unsigned short | SizeBMFILEHEADER = 14
static const unsigned short | SizeBMINFOHEADER = 40
static const unsigned short | SizeBMCOREHEADER = 12
static const unsigned int | COMPRESSION_BI_RGB = 0
static const unsigned short | SamplesPerVertex_SmallPalette = 2
static const unsigned short | SamplesPerVertex_LargePalette = 3
static const unsigned short | SamplesPerVertex_RGB = 2
static const UWORD32 | Radius_Palette = 400
| the default radius for palette images (400 = 20^2)
static const UWORD32 | Radius_RGB = 100
| the default radius for RGB images (100 = 10^2)
static const EmbValue | EmbValueModulus_SmallPalette = 2
static const EmbValue | EmbValueModulus_LargePalette = 4
static const EmbValue | EmbValueModulus_RGB = 4

## Additional Inherited Members

Static Public Member Functions inherited from CvrStgFile
static CvrStgFile * | readFile (const std::string &fn)
Protected Member Functions inherited from CvrStgFile
void | setSamplesPerVertex (unsigned short spv)
void | setRadius (UWORD32 r)
void | setEmbValueModulus (EmbValue m)
void | setBinIO (BinaryIO *io)
BinaryIO * | getBinIO (void) const

## Member Typedef Documentation

## BITMAPCOREHEADER

typedef struct BmpFile::struct_BITMAPCOREHEADER BmpFile::BITMAPCOREHEADER

protected

## BITMAPFILEHEADER

typedef struct BmpFile::struct_BITMAPFILEHEADER BmpFile::BITMAPFILEHEADER

protected

## BITMAPINFOHEADER

typedef struct BmpFile::struct_BITMAPINFOHEADER BmpFile::BITMAPINFOHEADER

protected

## Member Enumeration Documentation

## SUBFORMAT

enum BmpFile::SUBFORMAT

private

Enumerator
WIN |
OS2 |

## Constructor & Destructor Documentation

## BmpFile() [1/2]

BmpFile::BmpFile | ( | void |  | ) |

## BmpFile() [2/2]

BmpFile::BmpFile | ( | BinaryIO * | io | ) |

## ~BmpFile()

BmpFile::~BmpFile | ( | void |  | ) |

## Member Function Documentation

## bmpos2_readheaders()

void BmpFile::bmpos2_readheaders | ( |  | ) |

private

## bmpos2_writeheaders()

void BmpFile::bmpos2_writeheaders | ( |  | ) |

private

## bmpwin_readheaders()

void BmpFile::bmpwin_readheaders | ( |  | ) |

private

## bmpwin_writeheaders()

void BmpFile::bmpwin_writeheaders | ( |  | ) |

private

## calcIndex()

void BmpFile::calcIndex | ( | SamplePos | pos,
|  | unsigned long * | index,
|  | unsigned short * | firstbit ) const

private

translate a sample position into a <index,firstbit> pair "pointing" into the BitmapData array

Parameters

  pos | a sample position
  index | a pointer to a variable that will contain the array index used to access the pos-th sample
  firstbit | the firstbit in BitmapData[index] that belongs to the sample with the given position

## calcLinelength()

unsigned long BmpFile::calcLinelength | ( |  | ) |

private

## calcSVAdjacencyLists()

std::vector< SampleValueAdjacencyList * > BmpFile::calcSVAdjacencyLists | ( | const std::vector< SampleValue * > & | svs | ) | const

virtual

calculate a vector a SampleValueAdjacencyLists

Parameters

  svs | a vector of unique(!) sample values where svs[i]->getLabel() == i holds for all i

Returns
  a vector of SampleValueAdjacencyLists where retval[i] only contains sample values with getEmbValue() == i

Every row in the adjacency lists must be sorted in the following order: The first sample value has the least distance to the source sample value, the last has the largest distance. If two sample values in one row have the same distance to the source sample value, the order does not matter.

May be overridden in derived class to provide a faster version.

Reimplemented from CvrStgFile.

## getBitCount()

unsigned short BmpFile::getBitCount | ( | void |  | ) | const

## getHeight()

unsigned long BmpFile::getHeight | ( | void |  | ) | const

## getMatchingAlgorithms()

std::vector< MatchingAlgorithm * > BmpFile::getMatchingAlgorithms | ( | Graph * | g,
|  | Matching * | m ) const

virtual

get recommended list of matching algorithms

Parameters

  m | an empty matching - will be used in construction of MatchingAlgorithm objects

The MatchingAlgorithm objects returned by this function should be deleted by the caller if they are no longer needed.

Reimplemented from CvrStgFile.

## getNumSamples()

unsigned long BmpFile::getNumSamples | ( | void |  | ) | const

virtual

get the number of samples in this CvrStgObject

Implements CvrStgObject.

## getPalette()

ColorPalette * BmpFile::getPalette | ( | void |  | ) | const

## getProperties()

std::list< CvrStgFile::Property > BmpFile::getProperties | ( | void |  | ) | const

virtual

Implements CvrStgFile.

## getSampleValue()

SampleValue * BmpFile::getSampleValue | ( | SamplePos | pos | ) | const

virtual

get the sample at position pos

Parameters

  pos | the position of a sample (must be in 0...getNumSamples()-1)

Returns
  the sample at the given position

The sample object is created in this function and should be deleted by the caller. The derived class should check the condition(s) given above in its Implementation of this function.

Implements CvrStgObject.

## getSubformat()

BmpFile::SUBFORMAT BmpFile::getSubformat | ( | void |  | ) | const

private

## getWidth()

unsigned long BmpFile::getWidth | ( | void |  | ) | const

## read()

void BmpFile::read | ( | BinaryIO * | io | ) |

virtual

Reimplemented from CvrStgFile.

## readdata()

void BmpFile::readdata | ( |  | ) |

private

## readheaders()

void BmpFile::readheaders | ( |  | ) |

private

## replaceSample()

void BmpFile::replaceSample | ( | const SamplePos | pos,
|  | const SampleValue * | s )

virtual

replace a sample thus (possibly) altering the value of the bit returned by SampleValue->getBit()

Parameters

  pos | the position of the sample (must be in 0...getNumSamples()-1)
  s | the sample value that should replace the current sample value (must be of correct type for this CvrStgObject)

The derived class should check the condition(s) given above in its Implementation of this function.

Implements CvrStgObject.

## write()

void BmpFile::write | ( | void |  | ) |

virtual

Reimplemented from CvrStgFile.

## writedata()

void BmpFile::writedata | ( |  | ) |

private

## writeheaders()

void BmpFile::writeheaders | ( |  | ) |

private

## Member Data Documentation

## atend

std::vector<BYTE> BmpFile::atend

private

## bitmap

std::vector<std::vector <unsigned char> > BmpFile::bitmap

private

contains the bitmap in the following format bitmap[i] is the pixel data of the i-th row of the bitmap bitmap[i][j] is the j-th byte of the pixel data of the i-th row of the bitmap if bitcount is < 8 then bitmap[i][j] contains the pixels as read in from the file (i.e. in the "wrong" direction) this is taken care of in the calcRCB function

## BitmapData

std::vector<BYTE> BmpFile::BitmapData

private

contains the bitmap data in the same order as read from file (but without padding bytes)

## bmch

BITMAPCOREHEADER BmpFile::bmch

private

## bmfh

BITMAPFILEHEADER BmpFile::bmfh

private

## bmih

BITMAPINFOHEADER BmpFile::bmih

private

## COMPRESSION_BI_RGB

const unsigned int BmpFile::COMPRESSION_BI_RGB = 0

static private

## EmbValueModulus_LargePalette

const EmbValue BmpFile::EmbValueModulus_LargePalette = 4

static private

## EmbValueModulus_RGB

const EmbValue BmpFile::EmbValueModulus_RGB = 4

static private

## EmbValueModulus_SmallPalette

const EmbValue BmpFile::EmbValueModulus_SmallPalette = 2

static private

## IdBm

const unsigned int BmpFile::IdBm = 19778

static private

## Palette

ColorPalette* BmpFile::Palette

private

## Radius_Palette

const UWORD32 BmpFile::Radius_Palette = 400

static private

## Radius_RGB

const UWORD32 BmpFile::Radius_RGB = 100

static private

## SamplesPerVertex_LargePalette

const unsigned short BmpFile::SamplesPerVertex_LargePalette = 3

static private

## SamplesPerVertex_RGB

const unsigned short BmpFile::SamplesPerVertex_RGB = 2

static private

## SamplesPerVertex_SmallPalette

const unsigned short BmpFile::SamplesPerVertex_SmallPalette = 2

static private

## SizeBMCOREHEADER

const unsigned short BmpFile::SizeBMCOREHEADER = 12

static private

## SizeBMFILEHEADER

const unsigned short BmpFile::SizeBMFILEHEADER = 14

static private

## SizeBMINFOHEADER

const unsigned short BmpFile::SizeBMINFOHEADER = 40

static private

## subformat

SUBFORMAT BmpFile::subformat

private

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

- BmpFile.h
- BmpFile.cc