00001 #ifndef _ARGBImage_H 00002 #define _ARGBImage_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 ARGBImage : public AnImage 00034 { 00035 private: 00036 00037 int* palign; 00038 int* p1; 00039 int** image; 00040 00041 protected: 00042 00043 void meanCurvature3Restoration(int iterations, double coeff, 00044 RImage* channel1, RImage* channel2, RImage* channel3); 00045 void geodesicMeanCurvature3Restoration(int iterations, double coeff, 00046 RImage* channel1, RImage* channel2, RImage* channel3); 00047 00048 void peronaMalik3Restoration(int iterations, double coeff, 00049 RImage* channel1, RImage* channel2, RImage* channel3); 00050 void geodesicPeronaMalik3Restoration(int iterations, double coeff, 00051 RImage* channel1, RImage* channel2, RImage* channel3); 00052 00053 void beltrami3Restoration(int iterations, double coeff, 00054 RImage* channel1, RImage* channel2, RImage* channel3); 00055 void geodesicBeltrami3Restoration(int iterations, double coeff, 00056 RImage* channel1, RImage* channel2, RImage* channel3); 00057 00058 public: 00059 00060 ARGBImage(int w, int h); 00061 ARGBImage(int w, int h, int data); 00062 ARGBImage(int w, int h, int* data); 00063 ARGBImage(int w, int h, unsigned char red, unsigned char green, unsigned char blue); 00064 ARGBImage(int w, int h, unsigned char* red, unsigned char* green, unsigned char* blue); 00065 ARGBImage(RImage& red, RImage& green, RImage& blue); 00066 virtual ~ARGBImage(){ delete[] image; p1=0; delete[] palign; } 00067 00068 00069 virtual unsigned char* getData(){ return (unsigned char*)p1; } 00070 00071 virtual void set(AnImage* src){ setData(src,0); } 00072 00073 virtual void set(FImage& data, int ch=0); 00074 virtual void set(RImage& data, int ch=0); 00075 virtual void set(CImage& data, int ctype=0, int ch=0); 00076 virtual void setChannel(AnImage* channel, int ch=0); 00077 virtual void setValues(unsigned char value); 00078 00079 virtual AnImage* copy(); 00080 00081 virtual AnImage* flipHorizontal(); 00082 virtual AnImage* flipVertical(); 00083 00084 virtual AnImage* rotate90Left(); 00085 virtual AnImage* rotate90Right(); 00086 virtual AnImage* rotate180(); 00087 00088 virtual AnImage* scaleDown(int multiplier=2); 00089 virtual AnImage* scaleUp(int multiplier=2); 00090 virtual AnImage* scaleUp(int multiplier, int r, int g, int b); 00091 virtual AnImage* zeroInterleaving(); 00092 00093 virtual AnImage* partImage(int x0=0, int y0=0, int w=256, int h=256){return 0;} 00094 virtual AnImage* subImage(int x0, int y0, int x1, int y1); 00095 virtual AnImage* smallImage(double xscale, double yscale); 00096 virtual AnImage* smallImage(int width); 00097 00098 virtual int available8BitsColors(); 00099 00100 virtual void setData(AnImage* src, AnImage* mask=0); 00101 00102 virtual int getRed(int x, int y){ return (0x00ff0000 & image[y][x]) >> 16; } 00103 virtual int getGreen(int x, int y){ return (0x0000ff00 & image[y][x]) >> 8; } 00104 virtual int getBlue(int x, int y){ return (0x000000ff & image[y][x]); } 00105 virtual int getGrey(int x, int y) // luminance 00106 { return (299*getRed(x,y)+587*getGreen(x,y)+114*getBlue(x,y))/1000; } 00107 00108 virtual void setRed(int x, int y, int val){ image[y][x]= (image[y][x] & 0xff00ffff) | val<<16; } 00109 virtual void setGreen(int x, int y, int val){ image[y][x]= (image[y][x] & 0xffff00ff) | val<<8; } 00110 virtual void setBlue(int x, int y, int val){ image[y][x]= (image[y][x] & 0xffffff00) | val; } 00111 virtual void setGrey(int x, int y, int val) 00112 { image[y][x]= 255<<24 | val<<16 | val<<8 | val; } 00113 00114 virtual void set(int x, int y, int rgb){ image[y][x]= rgb; } 00115 00116 virtual int get(int x, int y) 00117 { return (299*getRed(x,y)+587*getGreen(x,y)+114*getBlue(x,y))/1000; } 00118 00119 // RGB simulation 00120 virtual int getRGB(int x, int y){ return image[y][x]; } 00121 virtual void setRGB(int x, int y, int r, int g, int b){ image[y][x]= ( r << 16 | g << 8 | b ); } 00122 00123 virtual void restaure(int model, int chMode,int type, 00124 int iterations, double coeff,double rsat=0.5); 00125 00126 virtual void restaure(int type, int iterations, double coeff); 00127 00128 virtual void report(FILE* file); 00129 virtual void output(); 00130 }; 00131 00132 #endif