summaryrefslogtreecommitdiff
path: root/libkms++/utils/color.h
blob: 1db47e8a930be9ddb7d72ea25a33cd4a7ff2fc5d (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <cstdint>

namespace kms
{
struct YUV;

struct RGB
{
	RGB();
	RGB(uint8_t r, uint8_t g, uint8_t b);

	uint16_t rgb565() const;
	YUV yuv() const;

	union {
		struct
		{
			uint8_t b;
			uint8_t g;
			uint8_t r;
			uint8_t a;
		};

		uint32_t raw;
	};
};

struct YUV
{
	YUV();
	YUV(uint8_t y, uint8_t u, uint8_t v);
	YUV(const RGB& rgb);

	union {
		struct
		{
			uint8_t v;
			uint8_t u;
			uint8_t y;
			uint8_t a;
		};

		uint32_t raw;
	};
};
}