MyGUI  3.2.1
MyGUI_ITexture.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_I_TEXTURE_H__
00008 #define __MYGUI_I_TEXTURE_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_IRenderTarget.h"
00012 #include "MyGUI_RenderFormat.h"
00013 #include <string>
00014 
00015 namespace MyGUI
00016 {
00017     class ITexture;
00018 
00019     class MYGUI_EXPORT ITextureInvalidateListener
00020     {
00021     public:
00022         virtual ~ITextureInvalidateListener() { }
00023         virtual void textureInvalidate(ITexture* _texture) = 0;
00024     };
00025 
00026     class MYGUI_EXPORT ITexture
00027     {
00028     public:
00029         virtual ~ITexture() { }
00030 
00031         virtual const std::string& getName() const = 0;
00032 
00033         virtual void createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format) = 0;
00034         virtual void loadFromFile(const std::string& _filename) = 0;
00035         virtual void saveToFile(const std::string& _filename) = 0;
00036 
00037         virtual void setInvalidateListener(ITextureInvalidateListener* _listener) { }
00038 
00039         virtual void destroy() = 0;
00040 
00041         virtual void* lock(TextureUsage _access) = 0;
00042         virtual void unlock() = 0;
00043         virtual bool isLocked() = 0;
00044 
00045         virtual int getWidth() = 0;
00046         virtual int getHeight() = 0;
00047 
00048         virtual PixelFormat getFormat() = 0;
00049         virtual TextureUsage getUsage() = 0;
00050         virtual size_t getNumElemBytes() = 0;
00051 
00052         virtual IRenderTarget* getRenderTarget()
00053         {
00054             return nullptr;
00055         }
00056     };
00057 
00058 } // namespace MyGUI
00059 
00060 #endif // __MYGUI_I_TEXTURE_H__