BmpRGBSampleValue.h

Go to the documentation of this file.
00001 /*
00002  * steghide 0.5.1 - a steganography program
00003  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  */
00020 
00021 #ifndef SH_BMPRGBSAMPLEVALUE_H
00022 #define SH_BMPRGBSAMPLEVALUE_H
00023 
00024 #include "BmpSampleValue.h"
00025 #include "RGBTriple.h"
00026 #include "common.h"
00027 
00032 class BmpRGBSampleValue : public BmpSampleValue {
00033         public:
00034         BmpRGBSampleValue (BYTE r, BYTE g, BYTE b) ;
00035         BmpRGBSampleValue (RGBTriple t) ;
00036 
00037         UWORD32 calcDistance (const SampleValue *s) const ;
00038         SampleValue* getNearestTargetSampleValue (EmbValue t) const ;
00039         std::string getName (void) const ;
00040 
00041         BYTE getRed (void) const { return Color.Red ; } ;
00042         BYTE getGreen (void) const { return Color.Green ; } ;
00043         BYTE getBlue (void) const { return Color.Blue ; } ;
00044 
00045         private:
00046         RGBTriple Color ;
00047 
00048         UWORD32 calcKey (const RGBTriple& rgb) const
00049                 { return (((UWORD32) rgb.Red << 16) | ((UWORD32) rgb.Green << 8) | ((UWORD32) rgb.Blue)) ;} ;
00050 
00051         EmbValue calcEValue (const RGBTriple& rgb) const
00052                 // { /* for Modulus 8 */ return ((EmbValue) (((rgb.Red & 1) << 2) | ((rgb.Green & 1) << 1) | (rgb.Blue & 1))) ; } ;
00053                 { /* for Modulus 4 */ return ((EmbValue) ((((rgb.Red & 1) ^ (rgb.Green & 1)) << 1) | ((rgb.Red & 1) ^ (rgb.Blue & 1)))) ; } ;
00054 
00055         enum COLOR { RED, GREEN, BLUE } ;
00056         enum DIRECTION { UP, DOWN } ;
00057 
00062         BYTE plus (BYTE a, BYTE b) const ;
00063 
00068         BYTE minus (BYTE a, BYTE b) const ;
00069 
00077         void addNTSVCandidates (std::vector<RGBTriple>& cands, const BYTE cube[3][2], COLOR fc, DIRECTION fd, COLOR i1, COLOR i2, EmbValue t) const ;
00078 } ;
00079 
00080 #endif // ndef SH_BMPRGBSAMPLEVALUE_H

Generated on Thu Jan 3 18:39:32 2008 for steghide by  doxygen 1.5.4