blob: b8cd0f351b5d0b1f7e8f2f288bbaf1c30b4b824e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#pragma once
#include "nes/common/types.hh"
namespace nes
{
/// An RGB value.
class rgb
{
public:
rgb() = default;
explicit rgb(u8 const r, u8 const g, u8 const b)
: r{ r }
, g{ g }
, b{ b }
{
}
static auto from_hex(u32 const hex) -> rgb
{
auto res = rgb{};
res.r = (hex & 0x00FF0000) >> 16;
res.g = (hex & 0x0000FF00) >> 8;
res.b = (hex & 0x000000FF) >> 0;
return res;
}
u8 r{ 0 };
u8 g{ 0 };
u8 b{ 0 };
};
} // namespace nes
|