Commit | Line | Data |
---|---|---|
14b7602a JH |
1 | /* Copyright 2017 Jason Williams |
2 | * | |
3 | * This program is free software: you can redistribute it and/or modify | |
4 | * it under the terms of the GNU General Public License as published by | |
5 | * the Free Software Foundation, either version 2 of the License, or | |
6 | * (at your option) any later version. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License | |
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | */ | |
16 | ||
17 | ||
18 | #ifndef COLOR_H | |
19 | #define COLOR_H | |
20 | ||
21 | #include <stdint.h> | |
22 | #include <stdbool.h> | |
23 | ||
24 | ||
25 | #if defined(__GNUC__) | |
26 | #define PACKED __attribute__ ((__packed__)) | |
27 | #else | |
28 | #define PACKED | |
29 | #endif | |
30 | ||
31 | #if defined(_MSC_VER) | |
32 | #pragma pack( push, 1 ) | |
33 | #endif | |
34 | ||
35 | typedef struct PACKED | |
36 | { | |
37 | uint8_t r; | |
38 | uint8_t g; | |
39 | uint8_t b; | |
40 | } RGB; | |
41 | ||
42 | typedef struct PACKED | |
43 | { | |
44 | uint8_t h; | |
45 | uint8_t s; | |
46 | uint8_t v; | |
47 | } HSV; | |
48 | ||
49 | #if defined(_MSC_VER) | |
50 | #pragma pack( pop ) | |
51 | #endif | |
52 | ||
53 | RGB hsv_to_rgb( HSV hsv ); | |
54 | ||
55 | #endif // COLOR_H |