00001 # ifndef SomeClass_Bitmap_h
00002 # define SomeClass_Bitmap_h SomeClass_Bitmap_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 # include "Root.h"
00022 # include "Coord.h"
00023 # include "ImageFilter.h"
00024
00025 namespace Conjecture {
00026
00027 typedef unsigned char Pixel;
00028
00029
00035
00036 class Bitmap : public Root {
00037
00038 public:
00039
00040 Bitmap(uint32_t width, uint32_t height);
00041
00042 Bitmap(const std::string &filename);
00043
00044 ~Bitmap();
00045
00046
00047
00048 inline const Pixel operator() (uint32_t x, uint32_t y) const {
00049 return ( (_pixels[at(x,y)] & (1 << (x & 0x07))) == 0 ? 0 : 1);
00050 }
00051
00052 inline const Pixel mask(uint32_t x, uint32_t y) const {
00053 return ( (_mask[at(x,y)] & (1 << (x & 0x07))) == 0 ? 0 : 1);
00054 }
00055
00056 inline const uint32_t width() const {
00057 return this->_width;
00058 }
00059
00060 inline const uint32_t height() const {
00061 return this->_height;
00062 }
00063
00064
00065
00066
00067
00068
00069
00073 Bitmap clone(void) const;
00074
00082 const Bitmap clone(Coord a, Coord b) const;
00083
00089 bool filter(ImageFilter &imfilter);
00090
00097 static void test(int argc = 0, const char* argv[] = NULL);
00098
00099 protected:
00100
00101
00102
00103
00104
00105
00106 private:
00107
00108
00109
00110
00111
00112
00119 inline uint32_t at(uint32_t x, uint32_t y) const {
00120 return (y * _linesize + (x >> 3));
00121 }
00122
00123
00124
00125
00126 typedef uint32_t PixelBlock;
00127
00128 uint32_t _width;
00129 uint32_t _height;
00130 uint32_t _linesize;
00131 PixelBlock *_pixels;
00132 PixelBlock *_mask;
00133
00134 };
00135 }
00136
00137 # endif // SomeClass_h
00138