Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

RGBs32Image.hpp

00001 #ifndef _RGBs32Image_H
00002 #define _RGBs32Image_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 RGBs32Image : public AnImage
00034 {
00035 private:
00036 
00037 int*    palign;
00038 int*    p1;
00039 int**   image;
00040 
00041 public:
00042 
00043 RGBs32Image(int w, int h);
00044 RGBs32Image(int w, int h, int data);
00045 RGBs32Image(int w, int h, int* data);
00046 RGBs32Image(int w, int h, int red, int green, int blue);
00047 RGBs32Image(int w, int h, int* red, int* green, int* blue);
00048 RGBs32Image(RImage& red, RImage& green, RImage& blue);
00049 virtual ~RGBs32Image(){ 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(int value);
00061 
00062 virtual AnImage* copy();
00063 
00064 // data limits of each image type
00065 virtual int getMinBoundaryValue(){ return -2147483648; }
00066 virtual int getMaxBoundaryValue(){ return 2147483647; }
00067 virtual int getPower2MaxRangeBoundary(){ return 31; }
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 L= 0.299*R + 0.587*G + 0.114*B;
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
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com