IvfTgaImage.h

00001 //
00002 // Copyright 1999-2003 by John Aspras
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 John Aspras
00023 //
00024 
00025 #ifndef _CIvfTgaImage_h_
00026 #define _CIvfTgaImage_h_
00027 
00028 #include <ivfimage/IvfFileImage.h>
00029 
00030 IvfSmartPointer(CIvfTgaImage);
00031 
00037 class IVFEXT_API CIvfTgaImage : public CIvfFileImage {
00038 private:
00039         bool m_alphaChannel;
00040 
00041 typedef struct                                                                  
00042 {
00043         GLubyte * imageData;                                                                    // Image Data (Up To 32 Bits)
00044         GLuint  bpp;                                                                                    // Image Color Depth In Bits Per Pixel
00045         GLuint  width;                                                                                  // Image Width
00046         GLuint  height;                                                                                 // Image Height
00047         GLuint  texID;                                                                                  // Texture ID Used To Select A Texture
00048         GLuint  type;                                                                                   // Image Type (GL_RGB, GL_RGBA)
00049 } Texture;      
00050 
00051 
00052 typedef struct
00053 {
00054         GLubyte Header[12];                                                                     // TGA File Header
00055 } TGAHeader;
00056 
00057 typedef struct
00058 {
00059         GLubyte         header[6];                                                              // First 6 Useful Bytes From The Header
00060         GLuint          bytesPerPixel;                                                  // Holds Number Of Bytes Per Pixel Used In The TGA File
00061         GLuint          imageSize;                                                              // Used To Store The Image Size When Setting Aside Ram
00062         GLuint          temp;                                                                   // Temporary Variable
00063         GLuint          type;   
00064         GLuint          Height;                                                                 //Height of Image
00065         GLuint          Width;                                                                  //Width ofImage
00066         GLuint          Bpp;                                                                    // Bits Per Pixel
00067 } TGA;
00068 
00069 Texture texture;
00070 TGAHeader tgaheader;                                                                    // TGA header
00071 TGA tga;                                                                                            // TGA image data
00072 
00073 bool LoadTGA(Texture * texture, char * filename);               // Load a TGA file
00074 
00075 bool LoadUncompressedTGA(Texture *, char *, FILE *);    // Load an Uncompressed file
00076 bool LoadCompressedTGA(Texture *, char *, FILE *);              // Load a Compressed file
00077 
00078 public:
00080         CIvfTgaImage();
00081 
00083         CIvfTgaImage(const char* name);
00084 
00086         virtual ~CIvfTgaImage();
00087         
00088         IvfClassInfo("CIvfTgaImage",CIvfFileImage);
00089 
00091         virtual bool read();
00092 
00099         void setAlphaChannel(bool flag);
00100 };
00101 
00102 #endif 

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