source: GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITexture.h @ 1812

Revision 1812, 4.3 KB checked in by gumbau, 18 years ago (diff)
RevLine 
[1812]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    Crazy Eddie's GUI System (http://www.cegui.org.uk)
11    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
12
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2.1 of the License, or (at your option) any later version.
17
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    Lesser General Public License for more details.
22
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26*************************************************************************/
27#ifndef _CEGUITexture_h_
28#define _CEGUITexture_h_
29
30#include "CEGUIBase.h"
31#include "CEGUIString.h"
32
33// Start of CEGUI namespace section
34namespace CEGUI
35{
36/*!
37\brief
38        Abstract base class specifying the required interface for Texture objects.
39
40        Texture objects are created via the Renderer.  The actual inner workings of any Texture object
41        are dependant upon the Renderer (and underlying API) in use.  This base class defines the minimal
42        set of functions that is required for the rest of the system to work.  Texture objects are only
43        created through the Renderer object's texture creation functions.
44*/
45class CEGUIEXPORT Texture
46{
47public:
48        /*************************************************************************
49                Abstract Interface
50        *************************************************************************/
51        /*!
52        \brief
53                Returns the current pixel width of the texture
54
55        \return
56                ushort value that is the current width of the texture in pixels
57        */
58        virtual ushort  getWidth(void) const = 0;
59
60
61        /*!
62        \brief
63                Returns the current pixel height of the texture
64
65        \return
66                ushort value that is the current height of the texture in pixels
67        */
68        virtual ushort  getHeight(void) const = 0;
69
70
71        /*!
72        \brief
73                Loads the specified image file into the texture.  The texture is resized as required to hold the image.
74
75        \param filename
76                The filename of the image file that is to be loaded into the texture
77
78    \param resourceGroup
79        Resource group identifier to be passed to the resource provider when loading the image file.
80
81        \return
82                Nothing.
83        */
84        virtual void    loadFromFile(const String& filename, const String& resourceGroup) = 0;
85
86
87        /*!
88        \brief
89                Loads (copies) an image in memory into the texture.  The texture is resized as required to hold the image.
90
91        \param buffPtr
92                Pointer to the buffer containing the image data
93
94        \param buffWidth
95                Width of the buffer (in 0xAARRGGBB pixels)
96
97        \param buffHeight
98                Height of the buffer (in 0xAARRGGBB pixels)
99
100        \return
101                Nothing.
102        */
103        virtual void    loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight) = 0;
104
105
106        /*!
107        \brief
108                Return a pointer to the Renderer object that created and owns this Texture
109
110        \return
111                Pointer to the Renderer object that owns the Texture
112        */
113        Renderer*       getRenderer(void) const                 {return d_owner;}
114
115
116protected:
117        /*************************************************************************
118                Construction and Destruction
119        *************************************************************************/
120        /*!
121        \brief
122                Constructor for Texture base class.  This is never called by client code.
123        */
124        Texture(Renderer* owner) : d_owner(owner) {}
125
126public:         // luabind compatibility
127        /*!
128        \brief
129                Destructor for Texture base class.  This is never called by client code.
130        */
131        virtual ~Texture(void) {}
132
133private:
134        Renderer* d_owner;              //<! Renderer object that created and owns this texture
135};
136
137} // End of  CEGUI namespace section
138
139#endif  // end of guard _CEGUITexture_h_
Note: See TracBrowser for help on using the repository browser.