00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _vuImage_H_
00018 #define _vuImage_H_
00019
00020 #include "vuSimpleTypes.h"
00021 #include "vuColourRGBa.h"
00022
00023 #include <string.h>
00024
00025 namespace ns_vu1112113 {
00026 };
00034 class vuImage
00035 {
00036 public:
00037 enum vuImageFormat {
00038 vuBMP_RGBA,
00039 vuBMP_GREY
00040 };
00041
00042 public:
00044 vuImage(dword width=0, dword height=0);
00046 virtual ~vuImage();
00048 vuImage(const vuImage &other);
00050 bool init(int sizx, int sizy);
00051
00053 void get_extents(int & sizx, int & sizy);
00057 void set_extents (int sizx, int sizy);
00059 bool set_xy(int x, int y, const vuColourRGBa& col);
00064 bool set_xy(int x, int y, unsigned char r, unsigned char g, unsigned char b);
00067 bool get_xy(int x, int y, vuColourRGBa & col);
00069 const byte* get_rgb() const;
00071 byte* get_buffer();
00072
00075 bool set_rgb(byte* rgb);
00076
00079 void set_rgb (int start, int number_copied, byte* rgb);
00080
00082 void elim_data (byte* rgb);
00083
00085 bool set_data (byte* rgb);
00086
00089 friend bool get_difference (vuImage &img1, vuImage &img2, int* temp);
00090 int getWidth () const;
00091 int getHeight () const;
00092
00094 void blit(int x=0, int y=0);
00096 void clear(const byte r = 0, const byte g = 0, const byte b = 0);
00097
00098
00099
00101 void initOpenGL();
00102 void glResize(dword width, dword height);
00103 void glRender();
00104
00107 bool writeToFile(const char *fileName, vuImageFormat fmt=vuBMP_RGBA);
00108 bool readFromFile(const char *fileName, vuImageFormat fmt=vuBMP_RGBA);
00109
00110 private:
00111
00113 byte *spix;
00114
00116 int maxx;
00117
00119 int maxy;
00120
00121
00122 public:
00123 vuImage operator=(const vuImage &other);
00124 vuImage &operator+=(vuImage &other);
00125 vuImage &operator*=(float scale);
00126
00127 private:
00128 void _copy(const vuImage &other);
00129 };
00130
00131
00132
00133 #endif