Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuImage.h

Go to the documentation of this file.
00001 /*      Modified by Christoper Steinbach
00002         Modified March 2002
00003 
00004         Modified to add capabilities for fast read and write
00005         for PPM files and other data sets.
00006 
00007         added functions such as set_extents ()
00008                                 set_data ()
00009                                 setrgb ()
00010                                 set_xy (x, y, r, g, b);
00011 
00012         I added some of the functions because I needed to read from
00013         a file into a buffer, but the header was not a part of the
00014         buffer that image should contain, and
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,  // 32 bit rgba (alpha is ignored!!!)
00039     vuBMP_GREY   //  8 bit monochrome
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: // member data
00111 
00113         byte *spix;
00114 
00116         int maxx;
00117 
00119         int maxy;
00120 
00121 
00122  public: // operator overloading
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

Generated on Wed Dec 15 21:20:34 2004 for vuVolume by  doxygen 1.3.9.1