Crazy Eddies GUI System 0.7.5

CEGUITGAImageCodec.h

00001 /***********************************************************************
00002         filename:       CEGUITGAImageCodec.h
00003         created:        03/06/2006
00004         author:         Olivier Delannoy 
00005         
00006         purpose:        This codec provide TGA image loading, it's the default 
00007                 codec 
00008 *************************************************************************/
00009 /***************************************************************************
00010  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00011  *
00012  *   Permission is hereby granted, free of charge, to any person obtaining
00013  *   a copy of this software and associated documentation files (the
00014  *   "Software"), to deal in the Software without restriction, including
00015  *   without limitation the rights to use, copy, modify, merge, publish,
00016  *   distribute, sublicense, and/or sell copies of the Software, and to
00017  *   permit persons to whom the Software is furnished to do so, subject to
00018  *   the following conditions:
00019  *
00020  *   The above copyright notice and this permission notice shall be
00021  *   included in all copies or substantial portions of the Software.
00022  *
00023  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00024  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00025  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00026  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00027  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00028  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00029  *   OTHER DEALINGS IN THE SOFTWARE.
00030  ***************************************************************************/
00031 #ifndef _CEGUITGAImageCodec_h_
00032 #define _CEGUITGAImageCodec_h_
00033 #include "../../CEGUIImageCodec.h"
00034 
00035 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
00036 #   ifdef CEGUITGAIMAGECODEC_EXPORTS
00037 #       define CEGUITGAIMAGECODEC_API __declspec(dllexport)
00038 #   else
00039 #       define CEGUITGAIMAGECODEC_API __declspec(dllimport)
00040 #   endif
00041 #else
00042 #   define CEGUITGAIMAGECODEC_API
00043 #endif
00044 
00045 namespace CEGUI 
00046 {
00054 class CEGUITGAIMAGECODEC_API TGAImageCodec : public ImageCodec
00055 {
00060     struct ImageTGA
00061     {
00062         int channels;        
00063         int sizeX;           
00064         int sizeY;           
00065         unsigned char *data; 
00066     };
00067     
00069     static void flipVertImageTGA(ImageTGA* img);
00071     static void flipHorzImageTGA(ImageTGA* img);
00072 
00077     static ImageTGA* loadTGA(const unsigned char* buffer, size_t buffer_size);
00082     static void convertRGBToRGBA(ImageTGA* img);
00083         
00084 public:
00085     TGAImageCodec();
00086 
00087     ~TGAImageCodec();
00088     
00089     // Took this code from http://www.gametutorials.com still ne
00090     // tImageTGA *LoadTGA(const char *filename)
00091     //
00092     // This is our cool function that loads the targa (TGA) file, then returns it's data.  
00093     // This tutorial supports 16, 24 and 32 bit images, along with RLE compression.
00094     //
00095     //
00096     // Ben Humphrey (DigiBen)
00097     // Game Programmer
00098     // DigiBen@GameTutorials.com
00099     // Co-Web Host of www.GameTutorials.com
00100     Texture* load(const RawDataContainer& data, Texture* result);
00101 
00102 protected:
00103 private:
00104 };
00105 
00106 } // End of CEGUI namespace section 
00107 
00108 #endif // end of guard _CEGUITGAImageCodec_h_