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