CEGUITexture.h

00001 /***********************************************************************
00002         filename:       CEGUITexture.h
00003         created:        21/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines abstract interface for texture objects.  Texture
00007                                 objects are created & destroyed by the Renderer.
00008 *************************************************************************/
00009 /***************************************************************************
00010  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00011  *
00012  *   Permission is hereby granted, free of charge, to any person obtaining
00013  *   a copy of this software and associated documentation files (the
00014  *   "Software"), to deal in the Software without restriction, including
00015  *   without limitation the rights to use, copy, modify, merge, publish,
00016  *   distribute, sublicense, and/or sell copies of the Software, and to
00017  *   permit persons to whom the Software is furnished to do so, subject to
00018  *   the following conditions:
00019  *
00020  *   The above copyright notice and this permission notice shall be
00021  *   included in all copies or substantial portions of the Software.
00022  *
00023  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00024  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00025  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00026  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00027  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00028  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00029  *   OTHER DEALINGS IN THE SOFTWARE.
00030  ***************************************************************************/
00031 #ifndef _CEGUITexture_h_
00032 #define _CEGUITexture_h_
00033 
00034 #include "CEGUIBase.h"
00035 #include "CEGUIString.h"
00036 
00037 // Start of CEGUI namespace section
00038 namespace CEGUI
00039 {
00049 class CEGUIEXPORT Texture
00050 {
00051 public:
00056     enum PixelFormat
00057     {
00059         PF_RGB,
00061         PF_RGBA
00062     };
00063 
00064         /*************************************************************************
00065                 Abstract Interface
00066         *************************************************************************/
00074         virtual ushort  getWidth(void) const = 0;
00075 
00089     virtual ushort getOriginalWidth(void) const { return getWidth(); }
00090 
00099     virtual float getXScale(void) const { return 1.0f / static_cast<float>(getOriginalWidth()); } 
00100 
00108         virtual ushort  getHeight(void) const = 0;
00109 
00122     virtual ushort getOriginalHeight(void) const { return getHeight(); }
00123 
00132     virtual float getYScale(void) const { return 1.0f / static_cast<float>(getOriginalHeight()); }
00133 
00147         virtual void    loadFromFile(const String& filename, const String& resourceGroup) = 0;
00148 
00149 
00169         virtual void    loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat) = 0;
00170 
00171 
00179         Renderer*       getRenderer(void) const                 {return d_owner;}
00180 
00181 
00182 protected:
00183         /*************************************************************************
00184                 Construction and Destruction
00185         *************************************************************************/
00190         Texture(Renderer* owner) : d_owner(owner) {}
00191 
00196         virtual ~Texture(void) {}
00197 
00198 private:
00199         Renderer* d_owner;              //<! Renderer object that created and owns this texture
00200 };
00201 
00202 } // End of  CEGUI namespace section
00203 
00204 #endif  // end of guard _CEGUITexture_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4