steghide  0.5.1
Classes | Public Member Functions | Protected Types | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
BmpFile Class Reference

#include <BmpFile.h>

Inheritance diagram for BmpFile:
CvrStgFile CvrStgObject

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::PropertygetProperties (void) const
 
std::vector< MatchingAlgorithm * > getMatchingAlgorithms (Graph *g, Matching *m) const
 
unsigned long getNumSamples (void) const
 
void replaceSample (const SamplePos pos, const SampleValue *s)
 
SampleValuegetSampleValue (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
 
ColorPalettegetPalette (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
 
ColorPalettePalette
 
std::vector< std::vector
< unsigned char > > 
bitmap
 
std::vector< BYTEBitmapData
 
std::vector< BYTEatend
 contains bytes that are appended at the end of the bitmap data (some image editors apparently do this) More...
 

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) More...
 
static const UWORD32 Radius_RGB = 100
 the default radius for RGB images (100 = 10^2) More...
 
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 CvrStgFilereadFile (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)
 
BinaryIOgetBinIO (void) const
 

Member Typedef Documentation

Member Enumeration Documentation

enum BmpFile::SUBFORMAT
private
Enumerator
WIN 
OS2 

Constructor & Destructor Documentation

BmpFile::BmpFile ( void  )
BmpFile::BmpFile ( BinaryIO io)
BmpFile::~BmpFile ( void  )

Member Function Documentation

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

Parameters
posa sample position
indexa pointer to a variable that will contain the array index used to access the pos-th sample
firstbitthe 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

Parameters
svsa 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.

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

Parameters
man 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

Parameters
posthe 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.

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()

Parameters
posthe position of the sample (must be in 0...getNumSamples()-1)
sthe 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

Member Data Documentation

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
staticprivate
const EmbValue BmpFile::EmbValueModulus_LargePalette = 4
staticprivate
const EmbValue BmpFile::EmbValueModulus_RGB = 4
staticprivate
const EmbValue BmpFile::EmbValueModulus_SmallPalette = 2
staticprivate
const unsigned int BmpFile::IdBm = 19778
staticprivate
ColorPalette* BmpFile::Palette
private
const UWORD32 BmpFile::Radius_Palette = 400
staticprivate
const UWORD32 BmpFile::Radius_RGB = 100
staticprivate
const unsigned short BmpFile::SamplesPerVertex_LargePalette = 3
staticprivate
const unsigned short BmpFile::SamplesPerVertex_RGB = 2
staticprivate
const unsigned short BmpFile::SamplesPerVertex_SmallPalette = 2
staticprivate
const unsigned short BmpFile::SizeBMCOREHEADER = 12
staticprivate
const unsigned short BmpFile::SizeBMFILEHEADER = 14
staticprivate
const unsigned short BmpFile::SizeBMINFOHEADER = 40
staticprivate
SUBFORMAT BmpFile::subformat
private

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