Main Page Namespace List Class Hierarchy Alphabetical List Data Structures File List Namespace Members Data Fields Globals

# ExCImageLoader.h

Go to the documentation of this file.

    00001 /************************************************************************/
    00002 /* Ex Nihlo Engine by Hermanns Christophe                                                               */
    00003 /************************************************************************/
    00004 /* This program is free software; you can redistribute it and/or                */
    00005 /* modify it under the terms of the GNU General Public License                  */
    00006 /* as published by the Free Software Foundation; either version 2               */
    00007 /* of the License, or (at your option) any later version.                               */
    00008 /*                                                                                                                                              */
    00009 /* This program 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.                                 */
    00012 /*                                                                                                                                              */
    00013 /* See the GNU General Public License for more details.                                 */
    00014 /*                                                                                                                                              */
    00015 /* You should have received a copy of the GNU General Public License    */
    00016 /* along with this program; if not, write to the Free Software                  */
    00017 /* Foundation, Inc., 59 Temple Place - Suite 330,                                               */
    00018 /* Boston, MA  02111-1307, USA.                                                                                 */
    00019 /*                                                                                                                                              */
    00020 /* If you use a important part of this code please send me a mail               */
    00021 /* I just want to see where my code go thks :)                                                  */
    00022 /************************************************************************/
    00023
    00024 /************************************************************************/
    00025 /* Contact                                                              */
    00026 /************************************************************************/
    00027 /* ExNihilo Website :www.ploksoftware.org                               */
    00028 /*                                                                      */
    00029 /* Hermanns Christophe ExNihilo creator and main programmer             */
    00030 /*                                                                      */
    00031 /* Mail             : Data@ploksoftware.org                                                             */
    00032 /* ICQ              : 8030901                                                                                   */
    00033 /* MSN Messenger    : Data_7@hotmail.com                                                                */
    00034 /*                                                                      */
    00035 /* Benjamin Michotte Linux port, webmaster                              */
    00036 /*                                                                      */
    00037 /* Mail             :binny@ploksoftware.org                             */
    00038 /*                                                                      */
    00039 /************************************************************************/
    00040
    00041 /************************************************************************/
    00042 /* File Description                                                                                             */
    00043 /************************************************************************/
    00044 /* File Name   :InputActionList.h                                                                               */
    00045 /*                                                                                                                                              */
    00046 /* Star Date   :03/15/2002                                                                                              */
    00047 /*                                                                                                                                              */
    00048 /* Last Update :                                                        */
    00049
    00050 #ifndef __EXCIMAGELOADER__
    00051 #define __EXCIMAGELOADER__
    00052 //--------------------------------
    00053 // File to include
    00054 //--------------------------------
    00055 #include "ExDefine.h"
    00056 #include "ExMath.h"
    00057 #include "ExNihiloExecption.h"
    00058
    00059 //--------------------------------
    00060 // Define type
    00061 //--------------------------------
    00062 #define TGA_RGB          2              // Normal RGB file
    00063 #define TGA_A            3              // ALPHA file
    00064 #define TGA_RLE         10              // Run-Length Encoded (RLE) file
    00065 //-------------------------------
    00066 enum TextureType
    00067 {
    00068         BMP,TGA,PCX,JPG,RGB,RAW,PPM,UNKNOWN
    00069 };
    00070 //-------------------------------
    00071 class ExCImageLoader
    00072 {
    00073 private:
    00074 //--------------------------------
    00075 // Variable
    00076 //--------------------------------
    00077         typedef struct
    00078         {
    00079                 unsigned char manufacturer;
    00080                 unsigned char version;
    00081                 unsigned char encoding;
    00082                 unsigned char bits;
    00083                 unsigned char xMin;
    00084                 unsigned char yMin;
    00085                 unsigned char xMax;
    00086                 unsigned char yMax;
    00087                 unsigned char *palette;
    00088         } PCXHEADER;
    00089 //--------------------------------
    00090 // Methode
    00091 //--------------------------------
    00092         unsigned char *LoadPCXFile(std::string filename, PCXHEADER *pcxHeader);
    00093         //void DecodeJPG(jpeg_decompress_struct* cinfo, tImage *pImageData);
    00094         TextureType FindTextureType(std::string FileName);
    00095 public:
    00096 //--------------------------------
    00097 // Variable
    00098 //--------------------------------
    00099         TextureType             m_TextureType;
    00100         int                             m_channels;                     // The channels in the image (3 = RGB : 4 = RGBA)
    00101         int                             m_sizeX;                                // The width of the image in pixels
    00102         int                             m_sizeY;                                // The height of the image in pixels
    00103         long int                m_scaledWidth;
    00104         long int                m_scaledHeight;
    00105         unsigned int    m_type; // RGB,RGBA...
    00106         unsigned char   *m_data;        // The image pixel data
    00107         unsigned char   *m_palette;
    00108
    00109 //--------------------------------
    00110 // Constructor // Destructor
    00111 //--------------------------------
    00112         ExCImageLoader(void);
    00113         ExCImageLoader(std::string FileName);
    00114         ~ExCImageLoader(void);
    00115 //--------------------------------
    00116 // Methode
    00117 //--------------------------------
    00118         bool LoadImage(std::string FileName);
    00119         bool LoadImage(const char *strFileName);
    00120         bool LoadBMP(const char *strFileName);
    00121
    00122         bool LoadBMP(std::string strFileName);
    00123         bool LoadTGA(std::string strFileName);
    00124         bool LoadJPG(std::string strFileName);
    00125         bool LoadPCX(std::string strFileName);
    00126         bool LoadRAW(std::string strFileName);
    00127         bool LoadRGB(std::string strFileName);
    00128         bool LoadPPM(std::string strFileName);
    00129 };
    00130
    00131 #endif //__EXCIMAGELOADER__
    00132
    00133
    00134
    00135
    00136
    00137
    00138
    00139
    00140
    00141
    00142