-
Notifications
You must be signed in to change notification settings - Fork 0
/
colours.h
44 lines (33 loc) · 816 Bytes
/
colours.h
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
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#ifndef H_COLOURS
#define H_COLOURS
enum colour_space {
CS_INVALID = 0,
CS_RGB = 0b1, // default to RGB
CS_HSV = 0b10,
CS_HSL = 0b100,
};
struct colour {
enum colour_space sp;
double h;
double s;
double v;
double l;
short r;
short g;
short b;
short a; // alpha
};
SDL_Colour get_sdlcolour(struct colour col, int alpha);
struct colour get_random_color(void);
// doesn't support hsl-hsv or converse, conversion
struct colour get_hsl(struct colour c);
struct colour get_hsv(struct colour c);
struct colour get_rgb(struct colour c);
struct colour *get_adjacent(struct colour base, int deg, int num);
void print_colour(struct colour c);
void test_print_wheel();
#endif