From 190449ee18bec69b2e385dccd9bd42ddc83dd418 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 28 Dec 2017 01:22:41 +0100 Subject: Refactor and test color Signed-off-by: pacien --- include/painter/color.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 include/painter/color.h (limited to 'include/painter/color.h') 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 @@ +#ifndef UPEM_MORPHING_COLOR +#define UPEM_MORPHING_COLOR + +/** + * File: color.h + * + * See also: + * A rainbow + */ + +#include +#include +#include "common/time.h" + +/** + * Type: ColorComponent + * Represents a single colour component of 32-bits RGBa tuple. + */ +typedef uint8_t ColorComponent; + +/** + * Type: ColorPixel + * Represents a single RGBa coloured pixel. + * Compatible with the libMLV representation. + */ +typedef union { + struct { + ColorComponent a, b, g, r; + } rgba; + + MLV_Color mlv; +} Color; + +/** + * Function: color_equals + * Compares the supplied colors. + * + * Parameters: + * c1 - the first color + * c2 - the second color + * + * Returns: + * T(c1 is the same color as c2) + */ +bool color_equals(Color c1, Color c2); + +/** + * Function: color_blend + * Blends two colors. + * + * Parameters: + * origin - the first color + * target - the second color + * distance - the distance from the first color + * + * Returns: + * The blended color + */ +Color color_blend(Color origin, Color target, TimeVector distance); + +#endif -- cgit v1.2.3