#include <BmpFile.h>
Classes | |
struct | struct_BITMAPCOREHEADER |
struct | struct_BITMAPFILEHEADER |
struct | struct_BITMAPINFOHEADER |
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 |
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 |
typedef struct BmpFile::struct_BITMAPCOREHEADER BmpFile::BITMAPCOREHEADER [protected] |
typedef struct BmpFile::struct_BITMAPFILEHEADER BmpFile::BITMAPFILEHEADER [protected] |
typedef struct BmpFile::struct_BITMAPINFOHEADER BmpFile::BITMAPINFOHEADER [protected] |
enum BmpFile::SUBFORMAT [private] |
BmpFile::BmpFile | ( | void | ) |
BmpFile::BmpFile | ( | BinaryIO * | io | ) |
BmpFile::~BmpFile | ( | void | ) |
void BmpFile::bmpos2_readheaders | ( | ) | [private] |
void BmpFile::bmpos2_writeheaders | ( | ) | [private] |
void BmpFile::bmpwin_readheaders | ( | ) | [private] |
void BmpFile::bmpwin_writeheaders | ( | ) | [private] |
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
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 |
unsigned long BmpFile::calcLinelength | ( | ) | [private] |
std::vector< SampleValueAdjacencyList * > BmpFile::calcSVAdjacencyLists | ( | const std::vector< SampleValue * > & | svs | ) | const [virtual] |
calculate a vector a SampleValueAdjacencyLists
svs | a vector of unique(!) sample values where svs[i]->getLabel() == i holds for all 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.
unsigned short BmpFile::getBitCount | ( | void | ) | const |
unsigned long BmpFile::getHeight | ( | void | ) | const |
std::vector< MatchingAlgorithm * > BmpFile::getMatchingAlgorithms | ( | Graph * | g, | |
Matching * | m | |||
) | const [virtual] |
get recommended list of matching algorithms
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.
unsigned long BmpFile::getNumSamples | ( | void | ) | const [virtual] |
get the number of samples in this CvrStgObject
Implements CvrStgObject.
ColorPalette * BmpFile::getPalette | ( | void | ) | const |
std::list< CvrStgFile::Property > BmpFile::getProperties | ( | void | ) | const [virtual] |
Implements CvrStgFile.
SampleValue * BmpFile::getSampleValue | ( | SamplePos | pos | ) | const [virtual] |
get the sample at position pos
pos | the position of a sample (must be in 0...getNumSamples()-1) |
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.
BmpFile::SUBFORMAT BmpFile::getSubformat | ( | void | ) | const [private] |
unsigned long BmpFile::getWidth | ( | void | ) | const |
void BmpFile::read | ( | BinaryIO * | io | ) | [virtual] |
Reimplemented from CvrStgFile.
void BmpFile::readdata | ( | ) | [private] |
void BmpFile::readheaders | ( | ) | [private] |
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()
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.
void BmpFile::write | ( | void | ) | [virtual] |
Reimplemented from CvrStgFile.
void BmpFile::writedata | ( | ) | [private] |
void BmpFile::writeheaders | ( | ) | [private] |
std::vector<BYTE> BmpFile::atend [private] |
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
std::vector<BYTE> BmpFile::BitmapData [private] |
contains the bitmap data in the same order as read from file (but without padding bytes)
BITMAPCOREHEADER BmpFile::bmch [private] |
BITMAPFILEHEADER BmpFile::bmfh [private] |
BITMAPINFOHEADER BmpFile::bmih [private] |
const unsigned int BmpFile::COMPRESSION_BI_RGB = 0 [static, private] |
const EmbValue BmpFile::EmbValueModulus_LargePalette = 4 [static, private] |
const EmbValue BmpFile::EmbValueModulus_RGB = 4 [static, private] |
const EmbValue BmpFile::EmbValueModulus_SmallPalette = 2 [static, private] |
const unsigned int BmpFile::IdBm = 19778 [static, private] |
ColorPalette* BmpFile::Palette [private] |
const UWORD32 BmpFile::Radius_Palette = 400 [static, private] |
const UWORD32 BmpFile::Radius_RGB = 100 [static, private] |
const unsigned short BmpFile::SamplesPerVertex_LargePalette = 3 [static, private] |
const unsigned short BmpFile::SamplesPerVertex_RGB = 2 [static, private] |
const unsigned short BmpFile::SamplesPerVertex_SmallPalette = 2 [static, private] |
const unsigned short BmpFile::SizeBMCOREHEADER = 12 [static, private] |
const unsigned short BmpFile::SizeBMFILEHEADER = 14 [static, private] |
const unsigned short BmpFile::SizeBMINFOHEADER = 40 [static, private] |
SUBFORMAT BmpFile::subformat [private] |