MyGUI  3.2.0
MyGUI_RenderFormat.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_RENDER_FORMAT_H__
00023 #define __MYGUI_RENDER_FORMAT_H__
00024 
00025 #include "MyGUI_Macros.h"
00026 
00027 namespace MyGUI
00028 {
00029 
00030     struct MYGUI_EXPORT VertexColourType
00031     {
00032     public:
00033         enum Enum
00034         {
00035             ColourARGB, // D3D style compact colour
00036             ColourABGR, // GL style compact colour
00037             MAX
00038         };
00039 
00040         VertexColourType(Enum _value = MAX) :
00041             value(_value)
00042         {
00043         }
00044 
00045         friend bool operator == (VertexColourType const& a, VertexColourType const& b)
00046         {
00047             return a.value == b.value;
00048         }
00049 
00050         friend bool operator != (VertexColourType const& a, VertexColourType const& b)
00051         {
00052             return a.value != b.value;
00053         }
00054 
00055     private:
00056         Enum value;
00057     };
00058 
00059     struct MYGUI_EXPORT PixelFormat
00060     {
00061         enum Enum
00062         {
00063             Unknow,
00064             L8, // 1 byte pixel format, 1 byte luminance
00065             L8A8, // 2 byte pixel format, 1 byte luminance, 1 byte alpha
00066             R8G8B8, // 24-bit pixel format, 8 bits for red, green and blue.
00067             R8G8B8A8 // 32-bit pixel format, 8 bits for red, green, blue and alpha.
00068         };
00069 
00070         PixelFormat(Enum _value = Unknow) :
00071             value(_value)
00072         {
00073         }
00074 
00075         friend bool operator == (PixelFormat const& a, PixelFormat const& b)
00076         {
00077             return a.value == b.value;
00078         }
00079 
00080         friend bool operator != (PixelFormat const& a, PixelFormat const& b)
00081         {
00082             return a.value != b.value;
00083         }
00084 
00085     private:
00086         Enum value;
00087     };
00088 
00089     struct MYGUI_EXPORT TextureUsage
00090     {
00091         enum Enum
00092         {
00093             Default = MYGUI_FLAG_NONE,
00094             Static = MYGUI_FLAG(0),
00095             Dynamic = MYGUI_FLAG(1),
00096             Stream = MYGUI_FLAG(2),
00097             Read = MYGUI_FLAG(3),
00098             Write = MYGUI_FLAG(4),
00099             RenderTarget = MYGUI_FLAG(5)
00100         };
00101 
00102         TextureUsage(Enum _value = Default) :
00103             value(_value)
00104         {
00105         }
00106 
00107         friend bool operator == (TextureUsage const& a, TextureUsage const& b)
00108         {
00109             return a.value == b.value;
00110         }
00111 
00112         friend bool operator != (TextureUsage const& a, TextureUsage const& b)
00113         {
00114             return a.value != b.value;
00115         }
00116 
00117         TextureUsage& operator |= (TextureUsage const& _other)
00118         {
00119             value = Enum(int(value) | int(_other.value));
00120             return *this;
00121         }
00122 
00123         friend TextureUsage operator | (Enum const& a, Enum const& b)
00124         {
00125             return TextureUsage(Enum(int(a) | int(b)));
00126         }
00127 
00128         friend TextureUsage operator | (TextureUsage const& a, TextureUsage const& b)
00129         {
00130             return TextureUsage(Enum(int(a.value) | int(b.value)));
00131         }
00132 
00133         bool isValue(Enum _value) const
00134         {
00135             return 0 != (value & _value);
00136         }
00137 
00138     private:
00139         Enum value;
00140     };
00141 
00142 } // namespace MyGUI
00143 
00144 
00145 #endif // __MYGUI_RENDER_FORMAT_H__