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

Image.h

00001 /*
00002   File: Image.h
00003 
00004   Copyright(C) C. Kotterink, Computed Graphics
00005 */
00006 #ifndef IMAGE_H
00007 #define IMAGE_H
00008 
00009 #include<RefCount.h>
00010 #include<Color3.h>
00011 
00012 #include<string>
00013 
00014 class Image;
00015 typedef RefCount<Image> RefImage;
00016 
00019 class Image
00020 {
00021 public:
00022     typedef enum Type {
00023         GrayScale,
00024         GrayScaleAlpha,
00025         RGB,
00026         RGBA
00027     };
00028 
00029     static bool find(RefImage &image, const string &name);
00030     static RefImage &store(RefImage &image, const string &name);
00031 
00032     Image(
00033       unsigned int w = 100, unsigned int h = 100, Type t = RGB,
00034       uint8 *buf = NULL)
00035         : buffer(buf), width(w), height(h), type(t) {
00036     }
00037     ~Image();
00038 
00039     unsigned int getWidth() { return width; };
00040     unsigned int getHeight() { return height; };
00041     Type getType() { return type; }
00042     unsigned int getComponents();
00043     unsigned int lineSize() {
00044         return width*getComponents();
00045     }
00046     uint8 *data() {
00047         return buffer;
00048     }
00049     uint8 *getLineBuffer(unsigned short line);
00050     void setColor(unsigned int w, unsigned int h, Color3 &c);
00051     Color3 color(unsigned int w, unsigned int h);
00052     void insertAlpha(const Image &i);
00053 
00054     // Flip
00055     void flipV();
00056     
00057     void allocate();
00058     void deallocate();
00059 
00060 protected:
00061     Type type;
00062     uint8 *buffer;
00063     unsigned int width;
00064     unsigned int height;
00065 };
00066 #endif

This documentation was generated using doxygen. If you have any comments or additions please mail me.