00001 #ifndef _RGBs16Image_H 00002 #define _RGBs16Image_H 00003 00004 00005 00025 #include <stdio.h> 00026 00027 #include "AnImage.hpp" 00028 #include "RImage.hpp" 00029 #include "FImage.hpp" 00030 #include "CImage.hpp" 00031 00032 00033 class RGBs16Image : public AnImage 00034 { 00035 private: 00036 00037 short* palign; 00038 short* p1; 00039 short** image; 00040 00041 public: 00042 00043 RGBs16Image(int w, int h); 00044 RGBs16Image(int w, int h, short data); 00045 RGBs16Image(int w, int h, short* data); 00046 RGBs16Image(int w, int h, short red, short green, short blue); 00047 RGBs16Image(int w, int h, short* red, short* green, short* blue); 00048 RGBs16Image(RImage& red, RImage& green, RImage& blue); 00049 virtual ~RGBs16Image(){ delete[] image; p1=0; delete[] palign; } 00050 00051 00052 virtual unsigned char* getData(){ return (unsigned char*)p1; } 00053 00054 virtual void set(AnImage* src){ setData(src,0); } 00055 00056 virtual void set(FImage& data, int ch=0); 00057 virtual void set(RImage& data, int ch=0); 00058 virtual void set(CImage& data, int ctype=0, int ch=0); 00059 virtual void setChannel(AnImage* channel, int ch=0); 00060 virtual void setValues(short value); 00061 00062 virtual AnImage* copy(); 00063 00064 // data limits of each image type 00065 virtual int getMinBoundaryValue(){ return -32768; } 00066 virtual int getMaxBoundaryValue(){ return 32767; } 00067 virtual int getPower2MaxRangeBoundary(){ return 15; } 00068 00069 virtual AnImage* flipHorizontal(); 00070 virtual AnImage* flipVertical(); 00071 00072 virtual AnImage* rotate90Left(); 00073 virtual AnImage* rotate90Right(); 00074 virtual AnImage* rotate180(); 00075 00076 virtual AnImage* scaleDown(int multiplier=2); 00077 virtual AnImage* scaleUp(int multiplier=2); 00078 virtual AnImage* scaleUp(int multiplier, int r, int g, int b); 00079 virtual AnImage* zeroInterleaving(); 00080 00081 virtual AnImage* partImage(int x0=0, int y0=0, int w=256, int h=256){return 0;} 00082 virtual AnImage* subImage(int x0, int y0, int x1, int y1); 00083 virtual AnImage* smallImage(double xscale, double yscale); 00084 virtual AnImage* smallImage(int width); 00085 00086 virtual int available8BitsColors(); 00087 00088 virtual void setData(AnImage* src, AnImage* mask=0); 00089 00090 virtual int getRed(int x, int y){ return image[y][x*3]; } 00091 virtual int getGreen(int x, int y){ return image[y][x*3+1]; } 00092 virtual int getBlue(int x, int y){ return image[y][x*3+2]; } 00093 virtual int getGrey(int x, int y) // luminance 00094 { return (299*getRed(x,y)+587*getGreen(x,y)+114*getBlue(x,y))/1000; } 00095 00096 virtual void setRed(int x, int y, int value){ image[y][x*3]=value; } 00097 virtual void setGreen(int x, int y, int value){ image[y][x*3+1]=value; } 00098 virtual void setBlue(int x, int y, int value){ image[y][x*3+2]=value; } 00099 virtual void setGrey(int x, int y, int value) 00100 { 00101 image[y][x*3]=value; 00102 image[y][x*3+1]=value; 00103 image[y][x*3+2]=value; 00104 } 00105 00106 virtual void set(int x, int y, int rgb){ } 00107 00108 virtual int get(int x, int y) 00109 { return (299*getRed(x,y)+587*getGreen(x,y)+114*getBlue(x,y))/1000; } 00110 00111 // RGB simulation 00112 virtual void setRGB(int x, int y, int r, int g, int b) 00113 { 00114 image[y][x*3]=r; 00115 image[y][x*3+1]=g; 00116 image[y][x*3+2]=b; 00117 } 00118 00119 virtual void report(FILE* file); 00120 virtual void output(); 00121 }; 00122 00123 #endif