00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef IMG_RASTER_IMAGE_H
00028 #define IMG_RASTER_IMAGE_H
00029
00030 #include <ost/base.hh>
00031 #include <ost/img/vecmat.hh>
00032 #include <ost/img/normalizer_impl.hh>
00033
00034 namespace ost { namespace img {
00035
00036
00037 class Data;
00038 class Point;
00039
00041
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 class DLLEXPORT_OST_IMG_BASE RasterImage {
00061 typedef unsigned char uchar;
00062 public:
00064 enum Mode {GREY=1, PHASECOLOR, SIGNCOLOR};
00065
00067 struct Pixel {
00068 uchar r,g,b;
00070 Pixel(): r(0), g(0), b(0) {}
00072 Pixel(const Pixel& p) {r=p.r; g=p.g; b=p.b;}
00074 Pixel(uchar rr,uchar gg,uchar bb): r(rr), g(gg), b(bb) {}
00076 Pixel(uchar rgb[3]) {r=rgb[0]; g=rgb[1]; b=rgb[2];}
00077 };
00078
00080 RasterImage(unsigned int width, unsigned int height);
00081
00082
00083 RasterImage(unsigned int width, unsigned int height, uchar *dptr);
00084
00085 ~RasterImage();
00086
00087 unsigned int GetWidth() const {return width_;}
00088 unsigned int GetHeight() const {return height_;}
00089
00091 void SetPixel(unsigned int x, unsigned int y, const Pixel& p);
00093 Pixel GetPixel(unsigned int x, unsigned int y) const;
00094
00096 uchar* GetDataPtr() const {return (uchar *)data_;}
00097
00099
00103 uchar* ReleaseDataPtr() {external_data_=true; return (uchar *)data_;}
00104
00106 void Fill(const Data& d, int logscale, const Vec3& offset, int z, const NormalizerPtr& norm,
00107 Mode mode=GREY, bool fast_low_mag_flag=true, bool fast_high_mag_flag=true);
00108 void Fill(const Data& d, int logscale, const Vec3& offset, int z, const NormalizerPtr& norm,
00109 Mode mode, bool fast_low_mag_flag, bool fast_high_mag_flag,int x1,int y1,int x2,int y2);
00110
00111
00112 private:
00113 unsigned int width_,height_;
00114 Pixel *data_;
00115 bool external_data_;
00116
00117 int wh2i(int w, int h) const {return h*width_+w;}
00118 };
00119
00120 }}
00121
00122 #endif