00001 00002 /*********************************************************************** 00003 filename: SILLYImage.h 00004 created: 10 Jun 2006 00005 author: Olivier Delannoy 00006 00007 purpose: Image class definition 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 _SILLYImage_h_ 00032 #define _SILLYImage_h_ 00033 #include "SILLYBase.h" 00034 #include "SILLYImageContext.h" 00035 #include "SILLYDataSource.h" 00036 #include "SILLYImageLoader.h" 00037 00038 // Start of section namespace SILLY 00039 namespace SILLY 00040 { 00041 00046 class SILLY_EXPORT Image 00047 { 00048 public: 00055 Image(DataSource& data); 00056 00061 ~Image(); 00062 00067 bool isValid() const; 00068 00069 00076 bool loadImageHeader(); 00077 00091 bool loadImageData(PixelFormat resultFormat = PF_RGBA, PixelOrigin origin = PO_TOP_LEFT); 00092 00097 size_t getWidth() const; 00098 00103 size_t getHeight() const; 00104 00109 PixelFormat getSourcePixelFormat() const; 00110 00115 PixelFormat getPixelFormat() const; 00116 00120 const byte* getPixelsDataPtr() const; 00125 size_t getPixelsDataSize() const; 00130 const char* getLoaderIdentifierString() const; 00131 private: 00132 bool allocate(); 00133 00134 private: 00135 00136 size_t d_bpp; 00137 PixelFormat d_pfSource; 00138 byte* d_pixels; 00139 DataSource* d_data; 00140 ImageContext* d_imageContext; 00141 ImageLoader* d_imageLoader; 00142 00143 // Disabled operation 00144 Image(Image&); 00145 Image& operator=(Image&); 00146 }; 00147 00148 } // End of section namespace SILLY 00149 00150 // Inclue inline function when needed 00151 #ifdef SILLY_OPT_INLINE 00152 #include "SILLYImage.icpp" 00153 #endif 00154 00155 #endif // end of guard _SILLYImage_h_