Crazy Eddies GUI System  0.6.2
CEGUITexture.h
1 /***********************************************************************
2  filename: CEGUITexture.h
3  created: 21/2/2004
4  author: Paul D Turner
5 
6  purpose: Defines abstract interface for texture objects. Texture
7  objects are created & destroyed by the Renderer.
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUITexture_h_
32 #define _CEGUITexture_h_
33 
34 #include "CEGUIBase.h"
35 #include "CEGUIString.h"
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
49 class CEGUIEXPORT Texture
50 {
51 public:
57  {
61  PF_RGBA
62  };
63 
64  /*************************************************************************
65  Abstract Interface
66  *************************************************************************/
74  virtual ushort getWidth(void) const = 0;
75 
89  virtual ushort getOriginalWidth(void) const { return getWidth(); }
90 
99  virtual float getXScale(void) const { return 1.0f / static_cast<float>(getOriginalWidth()); }
100 
108  virtual ushort getHeight(void) const = 0;
109 
122  virtual ushort getOriginalHeight(void) const { return getHeight(); }
123 
132  virtual float getYScale(void) const { return 1.0f / static_cast<float>(getOriginalHeight()); }
133 
147  virtual void loadFromFile(const String& filename, const String& resourceGroup) = 0;
148 
149 
169  virtual void loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat) = 0;
170 
171 
179  Renderer* getRenderer(void) const {return d_owner;}
180 
181 
182 protected:
183  /*************************************************************************
184  Construction and Destruction
185  *************************************************************************/
190  Texture(Renderer* owner) : d_owner(owner) {}
191 
196  virtual ~Texture(void) {}
197 
198 private:
199  Renderer* d_owner; //<! Renderer object that created and owns this texture
200 };
201 
202 } // End of CEGUI namespace section
203 
204 #endif // end of guard _CEGUITexture_h_