00001 # ifndef PixelLine_h
00002 # define PixelLine_h PixelLine_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 # include "Root.h"
00021
00022 namespace Conjecture {
00023 class OptIm;
00024
00025
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class PixelLine : public Root {
00050 public:
00051 static const u1 MaxPixels = 31;
00052
00053
00054 PixelLine(u4 pixels);
00055
00056
00057
00058 inline u1 holes() const { return this->_holes; }
00059 inline u4 pixels() const { return this->_pixels; }
00060 inline u1 black() const { return this->_black; }
00061
00062
00063
00064
00065
00066
00067
00073 inline bool get(unsigned i) const {
00074 return (this->pixels() & (1<<i)) ? true : false;
00075 }
00076
00083 void set(unsigned i);
00084
00091 void clear(unsigned i);
00092
00094 std::string str(char on = '#', char off = '.', u1 size = 31) const;
00095 inline std::string str(u1 size) const { return this->str('#','.',size); }
00096
00104 void assign(const PixelLine& other, u1 rightdel = 0);
00105
00106 static void test(int argc = 0, const char* argv[] = NULL);
00107
00108 protected:
00109
00110
00111 inline const bool & updated() const { return this->_updated; }
00112 inline void updatedIs(const bool & updated) { this->_updated = updated; }
00113 inline void blackIs(const u1 & black) { this->_black = black; }
00114 inline void holesIs(const u1 & holes) { this->_holes = holes; }
00115 inline void pixelsIs(const u4 & pixels) { this->_pixels = pixels; }
00116
00117
00118
00119 inline void rawset(unsigned i) { this->_pixels |= (1<<i); }
00120 inline void rawclear(unsigned i) { this->_pixels &= ~(1<<i); }
00121
00122 inline void rawline(u4 pixels) { this->_pixels = pixels; this->updatedIs(false); }
00123
00124
00125 private:
00127 friend class PixFilt;
00129 friend class OptIm;
00130
00131
00132
00133
00134
00135
00136 void updateMeta();
00137
00138
00139
00140
00148 u4 _pixels;
00149
00160 unsigned int _holes:4;
00161
00166 u1 _black:5;
00167
00173 bool _updated;
00174
00182 };
00183 }
00184
00185 # endif // PixelLine_h
00186