MyGUI 3.4.1
MyGUI_RenderFormat.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_RENDER_FORMAT_H_
8#define MYGUI_RENDER_FORMAT_H_
9
10#include "MyGUI_Macros.h"
11
12namespace MyGUI
13{
14
16 {
17 public:
18 enum Enum
19 {
20 ColourARGB, // D3D style compact colour
21 ColourABGR, // GL style compact colour
22 MAX
23 };
24
25 VertexColourType(Enum _value = MAX) :
26 mValue(_value)
27 {
28 }
29
30 friend bool operator == (VertexColourType const& a, VertexColourType const& b)
31 {
32 return a.mValue == b.mValue;
33 }
34
35 friend bool operator != (VertexColourType const& a, VertexColourType const& b)
36 {
37 return a.mValue != b.mValue;
38 }
39
40 int getValue() const
41 {
42 return mValue;
43 }
44
45 private:
46 Enum mValue;
47 };
48
50 {
51 enum Enum
52 {
54 L8, // 1 byte pixel format, 1 byte luminance
55 L8A8, // 2 byte pixel format, 1 byte luminance, 1 byte alpha
56 R8G8B8, // 24-bit pixel format, 8 bits for red, green and blue.
57 R8G8B8A8 // 32-bit pixel format, 8 bits for red, green, blue and alpha.
58 };
59
60 PixelFormat(Enum _value = Unknow) :
61 mValue(_value)
62 {
63 }
64
65 friend bool operator == (PixelFormat const& a, PixelFormat const& b)
66 {
67 return a.mValue == b.mValue;
68 }
69
70 friend bool operator != (PixelFormat const& a, PixelFormat const& b)
71 {
72 return a.mValue != b.mValue;
73 }
74
75 int getValue() const
76 {
77 return mValue;
78 }
79
80 int getBytesPerPixel() const
81 {
82 switch (mValue)
83 {
84 case L8:
85 return 1;
86 case L8A8:
87 return 2;
88 case R8G8B8:
89 return 3;
90 case R8G8B8A8:
91 return 4;
92 case Unknow:
93 return 0;
94 }
95 return 0;
96 }
97
98 private:
99 Enum mValue;
100 };
101
103 {
104 enum Enum
105 {
107 Static = MYGUI_FLAG(0),
108 Dynamic = MYGUI_FLAG(1),
109 Stream = MYGUI_FLAG(2),
110 Read = MYGUI_FLAG(3),
111 Write = MYGUI_FLAG(4),
112 RenderTarget = MYGUI_FLAG(5)
113 };
114
115 TextureUsage(Enum _value = Default) :
116 mValue(_value)
117 {
118 }
119
120 friend bool operator == (TextureUsage const& a, TextureUsage const& b)
121 {
122 return a.mValue == b.mValue;
123 }
124
125 friend bool operator != (TextureUsage const& a, TextureUsage const& b)
126 {
127 return a.mValue != b.mValue;
128 }
129
130 TextureUsage& operator |= (TextureUsage const& _other)
131 {
132 mValue = Enum(int(mValue) | int(_other.mValue));
133 return *this;
134 }
135
136 friend TextureUsage operator | (Enum const& a, Enum const& b)
137 {
138 return TextureUsage(Enum(int(a) | int(b)));
139 }
140
141 friend TextureUsage operator | (TextureUsage const& a, TextureUsage const& b)
142 {
143 return TextureUsage(Enum(int(a.mValue) | int(b.mValue)));
144 }
145
146 bool isValue(Enum _value) const
147 {
148 return 0 != (mValue & _value);
149 }
150
151 int getValue() const
152 {
153 return mValue;
154 }
155
156 private:
157 Enum mValue;
158 };
159
160} // namespace MyGUI
161
162
163#endif // MYGUI_RENDER_FORMAT_H_
#define MYGUI_FLAG_NONE
Definition: MyGUI_Macros.h:23
#define MYGUI_FLAG(num)
Definition: MyGUI_Macros.h:24
#define MYGUI_EXPORT
bool operator==(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
bool operator!=(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
PixelFormat(Enum _value=Unknow)
int getBytesPerPixel() const
bool isValue(Enum _value) const
TextureUsage(Enum _value=Default)
VertexColourType(Enum _value=MAX)