00001 # ifndef OptIm32_h
00002 # define OptIm32_h OptIm32_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 # include <vector>
00021 # include "Root.h"
00022 # include "PixelLine32.h"
00023
00024 namespace SomeName {
00025 class Image;
00026 class ImageArgs;
00027
00028
00073
00074 class OptIm32 : public Root {
00075 public:
00076
00077 OptIm32(const Image* image, const ImageArgs& config);
00078 OptIm32(const std::vector<unsigned int>& rows, u1 width = PixelLine32::MaxPixels);
00079
00080
00081
00082 inline const u1 & width() const { return this->_width; }
00083 inline const std::vector<PixelLine32> & cols() const { return this->_cols; }
00084 inline const std::vector<PixelLine32> & rows() const { return this->_rows; }
00085
00086
00087
00088
00089
00090
00091 void init(const std::vector<unsigned int>& rows, u1 width);
00092
00094 int rblack(u1 i) const { return this->rows()[i].black(); }
00096 int rholes(u1 i) const { return this->rows()[i].holes(); }
00098 int cblack(u1 i) const { return this->cols()[i].black(); }
00100 int choles(u1 i) const { return this->cols()[i].holes(); }
00101
00105 std::string str(char on = '#', char off = '.') const;
00106
00107 static void test(int argc = 0, const char* argv[] = NULL);
00108
00109 protected:
00110
00111
00112 inline void widthIs(const u1 & width) { this->_width = width; }
00113 inline void colsIs(const std::vector<PixelLine32> & cols) { this->_cols = cols; }
00114 inline void rowsIs(const std::vector<PixelLine32> & rows) { this->_rows = rows; }
00115
00116
00117
00118 std::string rawstr(const std::vector<PixelLine32>& vec, char on = '1', char off = '0', unsigned char size = PixelLine32::MaxPixels) const;
00119
00120 private:
00121
00122
00123 inline u1& widthRef() { return this->_width; }
00124 inline std::vector<PixelLine32>& colsRef() { return this->_cols; }
00125 inline std::vector<PixelLine32>& rowsRef() { return this->_rows; }
00126
00127
00128
00129
00130
00131
00132
00133 u1 _width;
00134 std::vector<PixelLine32> _cols;
00135 std::vector<PixelLine32> _rows;
00136 };
00137 }
00138
00139 # endif // OptIm32_h
00140