steghide  0.5.1
BmpFile.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20 
21 #ifndef SH_BMPFILE_H
22 #define SH_BMPFILE_H
23 
24 #include <vector>
25 
26 #include "CvrStgFile.h"
27 
28 class BinaryIO ;
29 class ColorPalette ;
30 
31 class BmpFile : public CvrStgFile {
32  public:
33  BmpFile (void) ;
34  BmpFile (BinaryIO *io) ;
35  ~BmpFile (void) ;
36 
37  void read (BinaryIO *io) ;
38  void write (void) ;
39 
40  std::list<CvrStgFile::Property> getProperties (void) const ;
41  std::vector<MatchingAlgorithm*> getMatchingAlgorithms (Graph* g, Matching* m) const ;
42 
43  unsigned long getNumSamples (void) const ;
44  void replaceSample (const SamplePos pos, const SampleValue* s) ;
45  SampleValue* getSampleValue (SamplePos pos) const ;
46 
47  std::vector<SampleValueAdjacencyList*> calcSVAdjacencyLists (const std::vector<SampleValue*>& svs) const ;
48 
49  unsigned short getBitCount (void) const ;
50  unsigned long getWidth (void) const ;
51  unsigned long getHeight (void) const ;
52  ColorPalette *getPalette (void) const ;
53 
54  protected:
55  typedef struct struct_BITMAPFILEHEADER {
56  unsigned short bfType ;
57  unsigned long bfSize ;
58  unsigned short bfReserved1 ;
59  unsigned short bfReserved2 ;
60  unsigned long bfOffBits ;
62 
63  /* windows bmp file format */
64  typedef struct struct_BITMAPINFOHEADER {
65  unsigned long biSize ;
66  signed long biWidth ;
67  signed long biHeight ;
68  unsigned short biPlanes ;
69  unsigned short biBitCount ;
70  unsigned long biCompression ;
71  unsigned long biSizeImage ;
72  signed long biXPelsPerMeter ;
73  signed long biYPelsPerMeter ;
74  unsigned long biClrUsed ;
75  unsigned long biClrImportant ;
77 
78  /* os/2 bmp file format */
79  typedef struct struct_BITMAPCOREHEADER {
80  unsigned long bcSize;
81  unsigned short bcWidth;
82  unsigned short bcHeight;
83  unsigned short bcPlanes;
84  unsigned short bcBitCount;
86 
87  private:
88  static const unsigned int IdBm = 19778 ;
89  static const unsigned short SizeBMFILEHEADER = 14 ;
90  static const unsigned short SizeBMINFOHEADER = 40 ;
91  static const unsigned short SizeBMCOREHEADER = 12 ;
92  static const unsigned int COMPRESSION_BI_RGB = 0 ;
93 
94  static const unsigned short SamplesPerVertex_SmallPalette = 2 ;
95  static const unsigned short SamplesPerVertex_LargePalette = 3 ;
96  static const unsigned short SamplesPerVertex_RGB = 2 ;
98  static const UWORD32 Radius_Palette = 400 ;
100  static const UWORD32 Radius_RGB = 100 ;
101 
104  static const EmbValue EmbValueModulus_RGB = 4 ; // if changed here - also change BmpRGBSampleValue::calcEValue
105 
106  enum SUBFORMAT { WIN, OS2 } ;
107 
120  std::vector<std::vector <unsigned char> > bitmap ;
121 
125  std::vector<BYTE> BitmapData ;
126 
128  std::vector<BYTE> atend ;
129 
130  void readheaders () ;
131  void bmpwin_readheaders () ;
132  void bmpos2_readheaders () ;
133  void writeheaders () ;
134  void bmpwin_writeheaders () ;
135  void bmpos2_writeheaders () ;
136  void readdata () ;
137  void writedata () ;
144  void calcIndex (SamplePos pos, unsigned long* index, unsigned short* firstbit) const ;
145  unsigned long calcLinelength () ;
146  SUBFORMAT getSubformat (void) const ;
147 } ;
148 
149 #endif /* ndef SH_BMPFILE_H */
BITMAPFILEHEADER bmfh
Definition: BmpFile.h:109
static const unsigned short SizeBMINFOHEADER
Definition: BmpFile.h:90
unsigned long bcSize
Definition: BmpFile.h:80
void bmpos2_writeheaders()
Definition: BmpFile.cc:703
static const unsigned short SamplesPerVertex_SmallPalette
Definition: BmpFile.h:94
Definition: BmpFile.h:106
static const UWORD32 Radius_RGB
the default radius for RGB images (100 = 10^2)
Definition: BmpFile.h:100
SampleValue * getSampleValue(SamplePos pos) const
Definition: BmpFile.cc:148
unsigned long biClrImportant
Definition: BmpFile.h:75
static const unsigned short SizeBMFILEHEADER
Definition: BmpFile.h:89
a graph constructed from a cover file and a message to be embedded
Definition: Graph.h:51
std::vector< MatchingAlgorithm * > getMatchingAlgorithms(Graph *g, Matching *m) const
Definition: BmpFile.cc:92
a cover-/stego-file
Definition: CvrStgFile.h:46
static const UWORD32 Radius_Palette
the default radius for palette images (400 = 20^2)
Definition: BmpFile.h:98
std::vector< std::vector< unsigned char > > bitmap
Definition: BmpFile.h:120
unsigned long getNumSamples(void) const
Definition: BmpFile.cc:104
std::vector< BYTE > atend
contains bytes that are appended at the end of the bitmap data (some image editors apparently do this...
Definition: BmpFile.h:128
static const EmbValue EmbValueModulus_RGB
Definition: BmpFile.h:104
static const unsigned int IdBm
Definition: BmpFile.h:88
UWORD32 SamplePos
Definition: common.h:67
struct BmpFile::struct_BITMAPCOREHEADER BITMAPCOREHEADER
unsigned short bfType
Definition: BmpFile.h:56
unsigned long bfOffBits
Definition: BmpFile.h:60
unsigned long bfSize
Definition: BmpFile.h:57
signed long biHeight
Definition: BmpFile.h:67
void calcIndex(SamplePos pos, unsigned long *index, unsigned short *firstbit) const
Definition: BmpFile.cc:305
std::list< CvrStgFile::Property > getProperties(void) const
Definition: BmpFile.cc:72
void bmpwin_readheaders()
Definition: BmpFile.cc:457
ColorPalette * getPalette(void) const
Definition: BmpFile.cc:395
the value of a sample in a CvrStgFile
Definition: SampleValue.h:61
static const unsigned short SamplesPerVertex_LargePalette
Definition: BmpFile.h:95
static const EmbValue EmbValueModulus_SmallPalette
Definition: BmpFile.h:102
unsigned short bcPlanes
Definition: BmpFile.h:83
unsigned long getHeight(void) const
Definition: BmpFile.cc:379
SUBFORMAT
Definition: BmpFile.h:106
a color palette
Definition: ColorPalette.h:36
void readdata()
Definition: BmpFile.cc:754
unsigned short biPlanes
Definition: BmpFile.h:68
unsigned long biSizeImage
Definition: BmpFile.h:71
void writeheaders()
Definition: BmpFile.cc:643
void bmpwin_writeheaders()
Definition: BmpFile.cc:679
unsigned long biClrUsed
Definition: BmpFile.h:74
ColorPalette * Palette
Definition: BmpFile.h:112
static const unsigned int COMPRESSION_BI_RGB
Definition: BmpFile.h:92
void writedata()
Definition: BmpFile.cc:808
unsigned short bcWidth
Definition: BmpFile.h:81
Definition: BmpFile.h:31
unsigned long UWORD32
Definition: common.h:45
unsigned long calcLinelength()
Definition: BmpFile.cc:721
represent a matching on a graph
Definition: Matching.h:41
struct BmpFile::struct_BITMAPFILEHEADER BITMAPFILEHEADER
provides methods for file i/o as needed by the rest of steghide
Definition: BinaryIO.h:33
static const EmbValue EmbValueModulus_LargePalette
Definition: BmpFile.h:103
unsigned short bcBitCount
Definition: BmpFile.h:84
void read(BinaryIO *io)
Definition: BmpFile.cc:55
SUBFORMAT getSubformat(void) const
Definition: BmpFile.cc:50
Definition: BmpFile.h:55
void replaceSample(const SamplePos pos, const SampleValue *s)
Definition: BmpFile.cc:119
unsigned long biCompression
Definition: BmpFile.h:70
unsigned short bfReserved2
Definition: BmpFile.h:59
unsigned long getWidth(void) const
Definition: BmpFile.cc:364
unsigned short bfReserved1
Definition: BmpFile.h:58
BITMAPINFOHEADER bmih
Definition: BmpFile.h:110
BmpFile(void)
signed long biWidth
Definition: BmpFile.h:66
Definition: BmpFile.h:64
Definition: BmpFile.h:79
std::vector< SampleValueAdjacencyList * > calcSVAdjacencyLists(const std::vector< SampleValue * > &svs) const
Definition: BmpFile.cc:172
static const unsigned short SamplesPerVertex_RGB
Definition: BmpFile.h:96
BITMAPCOREHEADER bmch
Definition: BmpFile.h:111
struct BmpFile::struct_BITMAPINFOHEADER BITMAPINFOHEADER
unsigned short getBitCount(void) const
Definition: BmpFile.cc:348
Definition: BmpFile.h:106
unsigned long biSize
Definition: BmpFile.h:65
void write(void)
Definition: BmpFile.cc:64
BYTE EmbValue
Definition: common.h:66
void readheaders()
Definition: BmpFile.cc:403
std::vector< BYTE > BitmapData
Definition: BmpFile.h:125
void bmpos2_readheaders()
Definition: BmpFile.cc:560
unsigned short biBitCount
Definition: BmpFile.h:69
signed long biYPelsPerMeter
Definition: BmpFile.h:73
unsigned short bcHeight
Definition: BmpFile.h:82
SUBFORMAT subformat
Definition: BmpFile.h:108
static const unsigned short SizeBMCOREHEADER
Definition: BmpFile.h:91
~BmpFile(void)
Definition: BmpFile.cc:45
signed long biXPelsPerMeter
Definition: BmpFile.h:72