00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef _IMAGE_H_
00027 #define _IMAGE_H_
00028
00029 #include <stdexcept>
00030
00031 namespace halftoner
00032 {
00033
00037 class Image
00038 {
00039 private:
00042
00043 unsigned char* pixels;
00045 int width;
00047 int height;
00049
00050 public:
00059 Image(int width, int height) throw(std::invalid_argument);
00060
00064 ~Image() throw();
00065
00068
00072 int getWidth() const throw();
00073
00078 int getHeight() const throw();
00079
00089 int getColorAt(int x, int y) const throw (std::out_of_range);
00090
00095 unsigned char* getCopy() const throw();
00097
00100
00109 void setColorAt(int x, int y, int color) throw (std::out_of_range);
00110
00119 void setLine(int line, int* colors, int width) throw (std::out_of_range);
00121
00122 private:
00125
00129 unsigned char* getPixels() const throw();
00130
00140 unsigned char* getPixel(int x, int y) const throw(std::out_of_range);
00142
00143 public:
00146
00153 static int calculateOffset(int x, int y, int width) throw();
00155 };
00156
00157 }
00158
00159 #endif