summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorpacien2017-12-28 01:22:41 +0100
committerpacien2017-12-28 01:22:41 +0100
commit190449ee18bec69b2e385dccd9bd42ddc83dd418 (patch)
tree6038429dcdd01def5410183148e582256d461fcc /include
parentc970da3f5830fae5b4d98dcdcc8d34d678ec0434 (diff)
downloadmorpher-190449ee18bec69b2e385dccd9bd42ddc83dd418.tar.gz
Refactor and test color
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Diffstat (limited to 'include')
-rw-r--r--include/painter/color.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/painter/color.h b/include/painter/color.h
new file mode 100644
index 0000000..2aeee3e
--- /dev/null
+++ b/include/painter/color.h
@@ -0,0 +1,61 @@
1#ifndef UPEM_MORPHING_COLOR
2#define UPEM_MORPHING_COLOR
3
4/**
5 * File: color.h
6 *
7 * See also:
8 * A rainbow
9 */
10
11#include <MLV/MLV_color.h>
12#include <stdbool.h>
13#include "common/time.h"
14
15/**
16 * Type: ColorComponent
17 * Represents a single colour component of 32-bits RGBa tuple.
18 */
19typedef uint8_t ColorComponent;
20
21/**
22 * Type: ColorPixel
23 * Represents a single RGBa coloured pixel.
24 * Compatible with the libMLV representation.
25 */
26typedef union {
27 struct {
28 ColorComponent a, b, g, r;
29 } rgba;
30
31 MLV_Color mlv;
32} Color;
33
34/**
35 * Function: color_equals
36 * Compares the supplied colors.
37 *
38 * Parameters:
39 * c1 - the first color
40 * c2 - the second color
41 *
42 * Returns:
43 * T(c1 is the same color as c2)
44 */
45bool color_equals(Color c1, Color c2);
46
47/**
48 * Function: color_blend
49 * Blends two colors.
50 *
51 * Parameters:
52 * origin - the first color
53 * target - the second color
54 * distance - the distance from the first color
55 *
56 * Returns:
57 * The blended color
58 */
59Color color_blend(Color origin, Color target, TimeVector distance);
60
61#endif