Kore
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <stdint.h>
6
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
18KINC_FUNC void kinc_color_components(uint32_t color, float *red, float *green, float *blue, float *alpha);
19
20#define KINC_COLOR_BLACK 0xff000000
21#define KINC_COLOR_WHITE 0xffffffff
22#define KINC_COLOR_RED 0xffff0000
23#define KINC_COLOR_BLUE 0xff0000ff
24#define KINC_COLOR_GREEN 0xff00ff00
25#define KINC_COLOR_MAGENTA 0xffff00ff
26#define KINC_COLOR_YELLOW 0xffffff00
27#define KINC_COLOR_CYAN 0xff00ffff
28
29#ifdef KINC_IMPLEMENTATION_ROOT
30#define KINC_IMPLEMENTATION
31#endif
32
33#ifdef KINC_IMPLEMENTATION
34
35void kinc_color_components(uint32_t color, float *red, float *green, float *blue, float *alpha) {
36 *alpha = ((color & 0xff000000) >> 24) / 255.0f;
37 *red = ((color & 0x00ff0000) >> 16) / 255.0f;
38 *green = ((color & 0x0000ff00) >> 8) / 255.0f;
39 *blue = (color & 0x000000ff) / 255.0f;
40}
41
42#endif
43
44#ifdef __cplusplus
45}
46#endif
KINC_FUNC void kinc_color_components(uint32_t color, float *red, float *green, float *blue, float *alpha)
Splits up an 32 bit ARGB color value into its components.
Provides basic functionality that's used all over the place. There's usually no need to manually incl...