acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
color32.h
1//
2// Created by camilo on 28/01/2021. 03:28 CamiloSasukeThomasBorregaardSorensen
3//
4#pragma once
5
6
7//COLOR32_T_ENDIANESS (*(const_char_pointer )&(const ::i32){0xAABBGGRR})
8
9
10
12{
13
14 //static inline const ::i32 m_iRedIndex = ENDIAN_ARRAY[0];
15 //static inline const ::i32 m_iGreenIndex = ENDIAN_ARRAY[1];
16 //static inline const ::i32 m_iBlueIndex = ENDIAN_ARRAY[2];
17 //static inline const ::i32 m_iOpacityIndex = ENDIAN_ARRAY[3];
18
19 union
20 {
21
22 ::u32 m_u32;
23
24 struct
25 {
26
27 ::u8 m_u8Red;
28 ::u8 m_u8Green;
29 ::u8 m_u8Blue;
30 ::u8 m_u8Opacity;
31
32 };
33
34 ::u8 m_ua[4];
35
36 };
37
38
39 constexpr ::u8 u8_red() const { return m_u8Red; }
40 constexpr ::u8 u8_green() const { return m_u8Green; }
41 constexpr ::u8 u8_blue() const { return m_u8Blue; }
42 constexpr ::u8 u8_opacity() const { return m_u8Opacity; }
43
44
45 constexpr ::u8 & u8_red() { return m_u8Red; }
46 constexpr ::u8 & u8_green() { return m_u8Green; }
47 constexpr ::u8 & u8_blue() { return m_u8Blue; }
48 constexpr ::u8 & u8_opacity() { return m_u8Opacity; }
49
50
51 constexpr ::f32 f32_red() const { return m_u8Red / 255.f; }
52 constexpr ::f32 f32_green() const { return m_u8Green / 255.f; }
53 constexpr ::f32 f32_blue() const { return m_u8Blue / 255.f; }
54 constexpr ::f32 f32_opacity() const { return m_u8Opacity / 255.f; }
55
56
57};
58
59
60
61//#pragma pack( push , color32, 1 )
62
63
65{
66public:
67
68
69 union
70 {
71
72 ::u32 m_u32;
73
74 struct
75 {
76
77 ::u8 m_u8Red;
78 ::u8 m_u8Green;
79 ::u8 m_u8Blue;
80 ::u8 m_u8Opacity;
81
82 };
83
84 };
85
86
87 inline bool operator == (const COLOR32 & color) const { return m_u32 == color.m_u32; }
88
89
90};
91
92
93//#pragma pack( pop , color32 )
94
95
96#ifndef CLASS_DECL_ACME
97
98#define CLASS_DECL_ACME
99
100#endif
101
102
103CLASS_DECL_ACME color32_t make_colorref(::i32 a, ::i32 r, ::i32 g, ::i32 b);
104
105CLASS_DECL_ACME color32_t argb_swap_red_blue(color32_t color32);
106
107
108typedef struct tagWINRGBQUAD {
109 ::u8 rgbBlue;
110 ::u8 rgbGreen;
111 ::u8 rgbRed;
112 ::u8 rgbReserved;
113} WINRGBQUAD, * LPWINRGBQUAD;
114
115
116
117typedef WINRGBQUAD * LPWINRGBQUAD;
118
119
120
121
Definition color32.h:65
Definition color32.h:12
Definition color32.h:108