Crazy Eddies GUI System  0.6.2
directfb-texture.h
1 /***********************************************************************
2  filename: directfb-texture.cpp
3  author: Keith Mok
4 *************************************************************************/
5 /***************************************************************************
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23  * OTHER DEALINGS IN THE SOFTWARE.
24  ***************************************************************************/
25 #ifndef _directfbtexture_h_
26 #define _directfbtexture_h_
27 
28 #include "CEGUIBase.h"
29 #include "CEGUIRenderer.h"
30 #include "CEGUITexture.h"
31 #include "directfb-renderer.h"
32 
33 #include <list>
34 
35 // Start of CEGUI namespace section
36 namespace CEGUI
37 {
38 
43 class DirectfbTexture : public Texture
44 {
45 private:
46  /*************************************************************************
47  Friends (to allow construction and destruction)
48  *************************************************************************/
50  friend Texture* DirectfbRenderer::createTexture(const String& filename, const String& resourceGroup);
51  friend Texture* DirectfbRenderer::createTexture(float size);
52  friend void DirectfbRenderer::destroyTexture(Texture* texture);
53 
54 
55  /*************************************************************************
56  Construction & Destruction (by Renderer object only)
57  *************************************************************************/
58  DirectfbTexture(Renderer* owner);
59  virtual ~DirectfbTexture(void);
60 
61 public:
69  virtual ushort getWidth(void) const {return d_width;}
70 
78  virtual ushort getHeight(void) const {return d_height;}
79 
93  virtual void loadFromFile(const String& filename, const String& resourceGroup);
94 
95 
115  virtual void loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat);
116 
117 
125  IDirectFBSurface* getFBTexture(void) const {return d_fbtexture;}
126 
127 
138  void setFBTextureSize(uint size);
139 
140 
141 private:
142  /*************************************************************************
143  Implementation Data
144  *************************************************************************/
145  IDirectFBSurface* d_fbtexture;
146  ushort d_width;
147  ushort d_height;
148  /*************************************************************************
149  Implementation Functions
150  *************************************************************************/
151  // safely free directfb texture (can be called multiple times with no ill effect)
152  void freeFBTexture(void);
153 };
154 
155 } // End of CEGUI namespace section
156 
157 
158 #endif // end of guard _directfbtexture_h_