MyGUI_RenderFormat.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_RENDER_FORMAT_H_
#define MYGUI_RENDER_FORMAT_H_
#include "MyGUI_Macros.h"
namespace MyGUI
{
struct MYGUI_EXPORT VertexColourType
{
public:
enum Enum
{
ColourARGB, // D3D style compact colour
ColourABGR, // GL style compact colour
MAX
};
VertexColourType(Enum _value = MAX) :
mValue(_value)
{
}
friend bool operator==(VertexColourType const& a, VertexColourType const& b)
{
return a.mValue == b.mValue;
}
friend bool operator!=(VertexColourType const& a, VertexColourType const& b)
{
return a.mValue != b.mValue;
}
int getValue() const
{
return mValue;
}
private:
Enum mValue;
};
struct MYGUI_EXPORT PixelFormat
{
enum Enum
{
Unknow,
L8, // 1 byte pixel format, 1 byte luminance
L8A8, // 2 byte pixel format, 1 byte luminance, 1 byte alpha
R8G8B8, // 24-bit pixel format, 8 bits for red, green and blue.
R8G8B8A8 // 32-bit pixel format, 8 bits for red, green, blue and alpha.
};
PixelFormat(Enum _value = Unknow) :
mValue(_value)
{
}
friend bool operator==(PixelFormat const& a, PixelFormat const& b)
{
return a.mValue == b.mValue;
}
friend bool operator!=(PixelFormat const& a, PixelFormat const& b)
{
return a.mValue != b.mValue;
}
int getValue() const
{
return mValue;
}
int getBytesPerPixel() const
{
switch (mValue)
{
case L8: return 1;
case L8A8: return 2;
case R8G8B8: return 3;
case R8G8B8A8: return 4;
case Unknow: return 0;
}
return 0;
}
private:
Enum mValue;
};
struct MYGUI_EXPORT TextureUsage
{
enum Enum
{
Default = MYGUI_FLAG_NONE,
Static = MYGUI_FLAG(0),
Dynamic = MYGUI_FLAG(1),
Stream = MYGUI_FLAG(2),
Read = MYGUI_FLAG(3),
Write = MYGUI_FLAG(4),
RenderTarget = MYGUI_FLAG(5)
};
TextureUsage(Enum _value = Default) :
mValue(_value)
{
}
friend bool operator==(TextureUsage const& a, TextureUsage const& b)
{
return a.mValue == b.mValue;
}
friend bool operator!=(TextureUsage const& a, TextureUsage const& b)
{
return a.mValue != b.mValue;
}
TextureUsage& operator|=(TextureUsage const& _other)
{
mValue = (mValue | _other.mValue).mValue;
return *this;
}
friend TextureUsage operator|(Enum const& a, Enum const& b)
{
return {Enum((unsigned int)a | (unsigned int)b)};
}
friend TextureUsage operator|(TextureUsage const& a, TextureUsage const& b)
{
return a.mValue | b.mValue;
}
bool isValue(Enum _value) const
{
return 0 != (mValue & _value);
}
int getValue() const
{
return mValue;
}
private:
Enum mValue;
};
} // namespace MyGUI
#endif // MYGUI_RENDER_FORMAT_H_
MyGUI_Macros.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::MYGUI_FLAG
constexpr unsigned int MYGUI_FLAG(uint8_t num)
Definition MyGUI_Macros.h:24
MyGUI::MYGUI_FLAG_NONE
constexpr unsigned int MYGUI_FLAG_NONE
Definition MyGUI_Macros.h:23
MyGUI::PixelFormat::PixelFormat
PixelFormat(Enum _value=Unknow)
Definition MyGUI_RenderFormat.h:60
MyGUI::PixelFormat::operator!=
friend bool operator!=(PixelFormat const &a, PixelFormat const &b)
Definition MyGUI_RenderFormat.h:70
MyGUI::PixelFormat::operator==
friend bool operator==(PixelFormat const &a, PixelFormat const &b)
Definition MyGUI_RenderFormat.h:65
MyGUI::PixelFormat::getBytesPerPixel
int getBytesPerPixel() const
Definition MyGUI_RenderFormat.h:80
MyGUI::PixelFormat::Enum
Enum
Definition MyGUI_RenderFormat.h:52
MyGUI::PixelFormat::Unknow
@ Unknow
Definition MyGUI_RenderFormat.h:53
MyGUI::PixelFormat::L8A8
@ L8A8
Definition MyGUI_RenderFormat.h:55
MyGUI::PixelFormat::R8G8B8A8
@ R8G8B8A8
Definition MyGUI_RenderFormat.h:57
MyGUI::PixelFormat::L8
@ L8
Definition MyGUI_RenderFormat.h:54
MyGUI::PixelFormat::R8G8B8
@ R8G8B8
Definition MyGUI_RenderFormat.h:56
MyGUI::PixelFormat::getValue
int getValue() const
Definition MyGUI_RenderFormat.h:75
MyGUI::TextureUsage::operator|
friend TextureUsage operator|(TextureUsage const &a, TextureUsage const &b)
Definition MyGUI_RenderFormat.h:136
MyGUI::TextureUsage::Enum
Enum
Definition MyGUI_RenderFormat.h:100
MyGUI::TextureUsage::RenderTarget
@ RenderTarget
Definition MyGUI_RenderFormat.h:107
MyGUI::TextureUsage::Default
@ Default
Definition MyGUI_RenderFormat.h:101
MyGUI::TextureUsage::Static
@ Static
Definition MyGUI_RenderFormat.h:102
MyGUI::TextureUsage::Write
@ Write
Definition MyGUI_RenderFormat.h:106
MyGUI::TextureUsage::Read
@ Read
Definition MyGUI_RenderFormat.h:105
MyGUI::TextureUsage::Dynamic
@ Dynamic
Definition MyGUI_RenderFormat.h:103
MyGUI::TextureUsage::Stream
@ Stream
Definition MyGUI_RenderFormat.h:104
MyGUI::TextureUsage::getValue
int getValue() const
Definition MyGUI_RenderFormat.h:146
MyGUI::TextureUsage::operator|
friend TextureUsage operator|(Enum const &a, Enum const &b)
Definition MyGUI_RenderFormat.h:131
MyGUI::TextureUsage::isValue
bool isValue(Enum _value) const
Definition MyGUI_RenderFormat.h:141
MyGUI::TextureUsage::operator==
friend bool operator==(TextureUsage const &a, TextureUsage const &b)
Definition MyGUI_RenderFormat.h:115
MyGUI::TextureUsage::operator!=
friend bool operator!=(TextureUsage const &a, TextureUsage const &b)
Definition MyGUI_RenderFormat.h:120
MyGUI::TextureUsage::operator|=
TextureUsage & operator|=(TextureUsage const &_other)
Definition MyGUI_RenderFormat.h:125
MyGUI::TextureUsage::TextureUsage
TextureUsage(Enum _value=Default)
Definition MyGUI_RenderFormat.h:110
MyGUI::VertexColourType::Enum
Enum
Definition MyGUI_RenderFormat.h:19
MyGUI::VertexColourType::MAX
@ MAX
Definition MyGUI_RenderFormat.h:22
MyGUI::VertexColourType::ColourABGR
@ ColourABGR
Definition MyGUI_RenderFormat.h:21
MyGUI::VertexColourType::ColourARGB
@ ColourARGB
Definition MyGUI_RenderFormat.h:20
MyGUI::VertexColourType::operator!=
friend bool operator!=(VertexColourType const &a, VertexColourType const &b)
Definition MyGUI_RenderFormat.h:35
MyGUI::VertexColourType::getValue
int getValue() const
Definition MyGUI_RenderFormat.h:40
MyGUI::VertexColourType::VertexColourType
VertexColourType(Enum _value=MAX)
Definition MyGUI_RenderFormat.h:25
MyGUI::VertexColourType::operator==
friend bool operator==(VertexColourType const &a, VertexColourType const &b)
Definition MyGUI_RenderFormat.h:30