acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
color_indexes.h
1
// Created by camilo on 2022-11-08 23:36 <3ThomasBorregaardSorensen!!
2
#pragma once
3
4
5
//#pragma pack(push, color_indexes, 1)
6
7
8
struct
color_indexes
9
{
10
11
union
12
{
13
14
::u8 m_ba[4];
15
16
// m_ba[0] red index
17
// m_ba[1] green index
18
// m_ba[2] blue index
19
// m_ba[3] opacity index
20
21
22
struct
23
{
24
25
::u8 m_u8IndexRed;
26
::u8 m_u8IndexGreen;
27
::u8 m_u8IndexBlue;
28
::u8 m_u8IndexOpacity;
29
30
};
31
32
::u32 m_u32;
33
34
};
35
36
37
constexpr
color_indexes();
38
39
constexpr
color_indexes(
const
color_indexes & indexes) =
default
;
40
//{
41
42
// m_u8IndexOpacity = indexes.m_u8IndexOpacity;
43
// m_u8IndexRed = indexes.m_u8IndexRed;
44
// m_u8IndexGreen = indexes.m_u8IndexGreen;
45
// m_u8IndexBlue = indexes.m_u8IndexBlue;
46
47
//}
48
49
50
constexpr
color_indexes(
51
::u8 u8IndexRed,
52
::u8 u8IndexGreen,
53
::u8 u8IndexBlue,
54
::u8 u8IndexOpacity) :
55
m_u8IndexRed(u8IndexRed),
56
m_u8IndexGreen(u8IndexGreen),
57
m_u8IndexBlue(u8IndexBlue),
58
m_u8IndexOpacity(u8IndexOpacity)
59
{
60
61
}
62
63
64
constexpr ::u8 red()
const
{
return
m_ba[0]; }
65
constexpr ::u8 green()
const
{
return
m_ba[1]; }
66
constexpr ::u8 blue()
const
{
return
m_ba[2]; }
67
constexpr ::u8 opacity()
const
{
return
m_ba[3]; }
68
69
70
constexpr ::u8 operator[](::u8 u)
const
{
return
m_ba[u]; }
71
72
73
};
74
75
76
//#pragma pack(pop, color_indexes)
77
78
79
constexpr
inline
color_indexes
bgra_indexes() {
return
{ 2, 1, 0, 3 }; }
80
constexpr
inline
color_indexes
rgba_indexes() {
return
{ 0, 1, 2, 3 }; }
81
constexpr
inline
color_indexes
rbga_indexes() {
return
{ 0, 2, 1, 3 }; }
82
83
84
#include "_configuration.h"
85
86
87
constexpr
color_indexes::color_indexes() :
88
color_indexes
(common_system_image_color_indexes())
89
{
90
91
}
92
93
94
color_indexes
Definition
color_indexes.h:9
graphics
image
color_indexes.h
Generated by
1.17.0