Pogosim
Loading...
Searching...
No Matches
colormaps.h
Go to the documentation of this file.
1#ifndef COLORMAPS_H
2#define COLORMAPS_H
3
4#include <stdint.h>
5
6#define SCALE_0_255_TO_0_25(x) ((uint8_t)(((x) * (25.0f / 255.0f)) + 0.5f))
7#define SCALE_0_25_TO_0_255(x) ((uint8_t)(x*10))
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
16typedef struct {
17 uint8_t r;
18 uint8_t g;
19 uint8_t b;
20} color_t;
21
22
81void hsv_to_rgb(float h, float s, float v, uint8_t *r, uint8_t *g, uint8_t *b);
82
83
97void qualitative_colormap(uint8_t const value, uint8_t *r, uint8_t *g, uint8_t *b);
98
119void rainbow_colormap(uint8_t const value, uint8_t *r, uint8_t *g, uint8_t *b);
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif // COLORMAPS_H
126
127// MODELINE "{{{1
128// vim:expandtab:softtabstop=4:shiftwidth=4:fileencoding=utf-8
129// vim:foldmethod=marker
void hsv_to_rgb(float h, float s, float v, uint8_t *r, uint8_t *g, uint8_t *b)
HSV → RGB conversion helper.
Definition colormaps.c:9
void qualitative_colormap(uint8_t const value, uint8_t *r, uint8_t *g, uint8_t *b)
Maps a given value to a qualitative colormap.
Definition colormaps.c:35
void rainbow_colormap(uint8_t const value, uint8_t *r, uint8_t *g, uint8_t *b)
Maps a given value to a rainbow colormap with smooth interpolation.
Definition colormaps.c:57
Structure representing a color with red, green, and blue components.
Definition colormaps.h:16
uint8_t g
Definition colormaps.h:18
uint8_t b
Definition colormaps.h:19
uint8_t r
Definition colormaps.h:17