Crazy Eddies GUI System  0.7.2
CEGUITGAImageCodec.h
1 /***********************************************************************
2  filename: CEGUITGAImageCodec.h
3  created: 03/06/2006
4  author: Olivier Delannoy
5 
6  purpose: This codec provide TGA image loading, it's the default
7  codec
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUITGAImageCodec_h_
32 #define _CEGUITGAImageCodec_h_
33 #include "../../CEGUIImageCodec.h"
34 
35 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
36 # ifdef CEGUITGAIMAGECODEC_EXPORTS
37 # define CEGUITGAIMAGECODEC_API __declspec(dllexport)
38 # else
39 # define CEGUITGAIMAGECODEC_API __declspec(dllimport)
40 # endif
41 #else
42 # define CEGUITGAIMAGECODEC_API
43 #endif
44 
45 namespace CEGUI
46 {
54 class CEGUITGAIMAGECODEC_API TGAImageCodec : public ImageCodec
55 {
60  struct ImageTGA
61  {
62  int channels;
63  int sizeX;
64  int sizeY;
65  unsigned char *data;
66  };
67 
69  static void flipVertImageTGA(ImageTGA* img);
71  static void flipHorzImageTGA(ImageTGA* img);
72 
77  static ImageTGA* loadTGA(const unsigned char* buffer, size_t buffer_size);
82  static void convertRGBToRGBA(ImageTGA* img);
83 
84 public:
85  TGAImageCodec();
86 
87  ~TGAImageCodec();
88 
89  // Took this code from http://www.gametutorials.com still ne
90  // tImageTGA *LoadTGA(const char *filename)
91  //
92  // This is our cool function that loads the targa (TGA) file, then returns it's data.
93  // This tutorial supports 16, 24 and 32 bit images, along with RLE compression.
94  //
95  //
96  // Ben Humphrey (DigiBen)
97  // Game Programmer
98  // DigiBen@GameTutorials.com
99  // Co-Web Host of www.GameTutorials.com
100  Texture* load(const RawDataContainer& data, Texture* result);
101 
102 protected:
103 private:
104 };
105 
106 } // End of CEGUI namespace section
107 
108 #endif // end of guard _CEGUITGAImageCodec_h_