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