IvfImage.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfImage_h_
00026 #define _CIvfImage_h_
00027 
00028 #include <ivf/IvfBase.h>
00029 #include <ivf/IvfGL.h> // OpenGL stuff
00030 
00031 IvfSmartPointer(CIvfImage);
00032 
00040 class IVF_API CIvfImage : public CIvfBase {
00041 private:
00042         int m_size[2];
00043         int m_channels;
00044         double m_ratio;
00045         GLubyte* m_imageMap;
00046         GLint m_internalFormat;
00047 public:
00049         CIvfImage();
00050 
00052         virtual ~CIvfImage();
00053 
00054         IvfClassInfo("CIvfImage",CIvfBase);
00055 
00062         void clear();
00063 
00070         bool valid(int x, int y);
00071 
00073         void setPixel(int x, int y, GLubyte red, GLubyte green, GLubyte blue);
00074 
00076         void setValue(int x, int y, int channel, GLubyte value);
00077 
00079         void setPixelAlpha(int x, int y, GLubyte alpha);
00080 
00082         void getPixel(int x, int y, GLubyte &red, GLubyte &green, GLubyte &blue);
00083 
00085         GLubyte getPixelAlpha(int x, int y);
00086 
00088         void fillColor(GLubyte red, GLubyte green, GLubyte blue);
00089 
00091         void fillColorAlpha(GLubyte alpha);
00092 
00094         void fillRect(int x1, int y1, int x2, int y2, GLubyte red, GLubyte green, GLubyte blue);
00095 
00097         void fillRectAlpha(int x1, int y1, int x2, int y2, GLubyte alpha);
00098 
00100         void drawFrame(int x1, int y1, int x2, int y2, GLubyte red, GLubyte green, GLubyte blue);
00101 
00103         void drawFrameAlpha(int x1, int y1, int x2, int y2, GLubyte alpha);
00104 
00115         void replaceColor(GLubyte srcRed, GLubyte srcGreen, GLubyte srcBlue, GLubyte tgtRed, GLubyte tgtGreen, GLubyte tgtBlue);
00116 
00125         void createAlphaMask(int treshold, int component, int over, int under);
00126 
00128         void createAlphaFromColor();
00129 
00137         void setChannels(int channels);
00138 
00140         int getChannels();
00141 
00148         void setInternalFormat(GLint format);
00149 
00151         GLint getInternalFormat();
00152 
00159         void setSize(int width, int height);
00160 
00162         int getHeight();
00163 
00165         int getWidth();
00166 
00168         double getRatio();
00169 
00171         void setImageMap(void* image);
00172 
00178         GLubyte* getImageMap();
00179 
00181         GLint getFormat();
00182 };
00183 
00184 
00185 
00186 #endif 
00187 

Generated on Fri Sep 1 15:36:45 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO