00001 /*********************************************************************** 00002 filename: directfb-texture.cpp 00003 author: Keith Mok 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Permission is hereby granted, free of charge, to any person obtaining 00007 * a copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sublicense, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be 00015 * included in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00020 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00021 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00022 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00023 * OTHER DEALINGS IN THE SOFTWARE. 00024 ***************************************************************************/ 00025 #ifndef _directfbtexture_h_ 00026 #define _directfbtexture_h_ 00027 00028 #include "CEGUIBase.h" 00029 #include "CEGUIRenderer.h" 00030 #include "CEGUITexture.h" 00031 #include "directfb-renderer.h" 00032 00033 #include <list> 00034 00035 // Start of CEGUI namespace section 00036 namespace CEGUI 00037 { 00038 00043 class DirectfbTexture : public Texture 00044 { 00045 private: 00046 /************************************************************************* 00047 Friends (to allow construction and destruction) 00048 *************************************************************************/ 00049 friend Texture* DirectfbRenderer::createTexture(void); 00050 friend Texture* DirectfbRenderer::createTexture(const String& filename, const String& resourceGroup); 00051 friend Texture* DirectfbRenderer::createTexture(float size); 00052 friend void DirectfbRenderer::destroyTexture(Texture* texture); 00053 00054 00055 /************************************************************************* 00056 Construction & Destruction (by Renderer object only) 00057 *************************************************************************/ 00058 DirectfbTexture(Renderer* owner); 00059 virtual ~DirectfbTexture(void); 00060 00061 public: 00069 virtual ushort getWidth(void) const {return d_width;} 00070 00078 virtual ushort getHeight(void) const {return d_height;} 00079 00093 virtual void loadFromFile(const String& filename, const String& resourceGroup); 00094 00095 00115 virtual void loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat); 00116 00117 00125 IDirectFBSurface* getFBTexture(void) const {return d_fbtexture;} 00126 00127 00138 void setFBTextureSize(uint size); 00139 00140 00141 private: 00142 /************************************************************************* 00143 Implementation Data 00144 *************************************************************************/ 00145 IDirectFBSurface* d_fbtexture; 00146 ushort d_width; 00147 ushort d_height; 00148 /************************************************************************* 00149 Implementation Functions 00150 *************************************************************************/ 00151 // safely free directfb texture (can be called multiple times with no ill effect) 00152 void freeFBTexture(void); 00153 }; 00154 00155 } // End of CEGUI namespace section 00156 00157 00158 #endif // end of guard _directfbtexture_h_