Crazy Eddie's GUI System  0.8.7
Texture.h
1 /***********************************************************************
2  created: 21/2/2004
3  author: Paul D Turner
4 
5  purpose: Defines abstract interface for texture objects. Texture
6  objects are created & destroyed by the Renderer.
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUITexture_h_
31 #define _CEGUITexture_h_
32 
33 #include "CEGUI/Base.h"
34 #include "CEGUI/String.h"
35 #include "CEGUI/Size.h"
36 #include "CEGUI/Vector.h"
37 #include "CEGUI/Rect.h"
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
52 class CEGUIEXPORT Texture :
53  public AllocatedObject<Texture>
54 {
55 public:
62  {
82  PF_RGBA_DXT5
83  };
84 
89  virtual ~Texture() {}
90 
98  virtual const String& getName() const = 0;
99 
108  virtual const Sizef& getSize() const = 0;
109 
118  virtual const Sizef& getOriginalDataSize() const = 0;
119 
129  virtual const Vector2f& getTexelScaling() const = 0;
130 
146  virtual void loadFromFile(const String& filename,
147  const String& resourceGroup) = 0;
148 
166  virtual void loadFromMemory(const void* buffer,
167  const Sizef& buffer_size,
168  PixelFormat pixel_format) = 0;
169 
182  virtual void blitFromMemory(const void* sourceData, const Rectf& area) = 0;
183 
194  virtual void blitToMemory(void* targetData) = 0;
195 
218  virtual bool isPixelFormatSupported(const PixelFormat fmt) const = 0;
219 };
220 
221 } // End of CEGUI namespace section
222 
223 #endif // end of guard _CEGUITexture_h_
Definition: MemoryAllocatedObject.h:110
String class used within the GUI system.
Definition: String.h:64
Abstract base class specifying the required interface for Texture objects.
Definition: Texture.h:54
virtual void loadFromMemory(const void *buffer, const Sizef &buffer_size, PixelFormat pixel_format)=0
Loads (copies) an image in memory into the texture. The texture is resized as required to hold the im...
PixelFormat
Enumerated type containing the supported pixel formats that can be passed to loadFromMemory.
Definition: Texture.h:62
@ PF_RGBA_DXT1
S3 DXT1 texture compression (RGBA).
Definition: Texture.h:78
@ PF_RGBA_DXT3
S3 DXT1 texture compression (RGBA).
Definition: Texture.h:80
@ PF_RGB_DXT1
S3 DXT1 texture compression (RGB).
Definition: Texture.h:76
@ PF_RGB_565
Each pixel is 2 bytes. RGB in that order.
Definition: Texture.h:70
@ PF_PVRTC2
PVR texture compression. Each pixel is 2 bits.
Definition: Texture.h:72
@ PF_RGB
Each pixel is 3 bytes. RGB in that order.
Definition: Texture.h:64
@ PF_RGBA
Each pixel is 4 bytes. RGBA in that order.
Definition: Texture.h:66
@ PF_PVRTC4
PVR texture compression. Each pixel is 4 bits.
Definition: Texture.h:74
@ PF_RGBA_4444
Each pixel is 2 bytes. RGBA in that order.
Definition: Texture.h:68
virtual const Sizef & getOriginalDataSize() const =0
Returns the original pixel size of the data loaded into the texture.
virtual const String & getName() const =0
Returns the name given to the texture when it was created.
virtual const Vector2f & getTexelScaling() const =0
Returns pixel to texel scale values that should be used for converting pixel values to texture co-ord...
virtual void blitToMemory(void *targetData)=0
Performs a complete blit from the texture surface to memory.
virtual const Sizef & getSize() const =0
Returns the current pixel size of the texture.
virtual void loadFromFile(const String &filename, const String &resourceGroup)=0
Loads the specified image file into the texture. The texture is resized as required to hold the image...
virtual void blitFromMemory(const void *sourceData, const Rectf &area)=0
Performs an area memory blit to the texture.
virtual bool isPixelFormatSupported(const PixelFormat fmt) const =0
Return whether the specified pixel format is supported by the system for the CEGUI::Texture implement...
virtual ~Texture()
Destructor for Texture base class.
Definition: Texture.h:89
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1