steghide  0.5.1
BmpRGBSampleValue.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_BMPRGBSAMPLEVALUE_H
22 #define SH_BMPRGBSAMPLEVALUE_H
23 
24 #include "BmpSampleValue.h"
25 #include "RGBTriple.h"
26 #include "common.h"
27 
33  public:
34  BmpRGBSampleValue (BYTE r, BYTE g, BYTE b) ;
36 
37  UWORD32 calcDistance (const SampleValue *s) const ;
39  std::string getName (void) const ;
40 
41  BYTE getRed (void) const { return Color.Red ; } ;
42  BYTE getGreen (void) const { return Color.Green ; } ;
43  BYTE getBlue (void) const { return Color.Blue ; } ;
44 
45  private:
47 
48  UWORD32 calcKey (const RGBTriple& rgb) const
49  { return (((UWORD32) rgb.Red << 16) | ((UWORD32) rgb.Green << 8) | ((UWORD32) rgb.Blue)) ;} ;
50 
51  EmbValue calcEValue (const RGBTriple& rgb) const
52  // { /* for Modulus 8 */ return ((EmbValue) (((rgb.Red & 1) << 2) | ((rgb.Green & 1) << 1) | (rgb.Blue & 1))) ; } ;
53  { /* for Modulus 4 */ return ((EmbValue) ((((rgb.Red & 1) ^ (rgb.Green & 1)) << 1) | ((rgb.Red & 1) ^ (rgb.Blue & 1)))) ; } ;
54 
55  enum COLOR { RED, GREEN, BLUE } ;
56  enum DIRECTION { UP, DOWN } ;
57 
62  BYTE plus (BYTE a, BYTE b) const ;
63 
68  BYTE minus (BYTE a, BYTE b) const ;
69 
77  void addNTSVCandidates (std::vector<RGBTriple>& cands, const BYTE cube[3][2], COLOR fc, DIRECTION fd, COLOR i1, COLOR i2, EmbValue t) const ;
78 } ;
79 
80 #endif // ndef SH_BMPRGBSAMPLEVALUE_H