forked from FastLED/FastLED
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hsv2rgb.h
59 lines (45 loc) · 2.19 KB
/
hsv2rgb.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __INC_HSV2RGB_H
#define __INC_HSV2RGB_H
#include "pixeltypes.h"
// hsv2rgb_rainbow - convert a hue, saturation, and value to RGB
// using a visually balanced rainbow (vs a straight
// mathematical spectrum).
// This 'rainbow' yields better yellow and orange
// than a straight 'spectrum'.
//
// NOTE: here hue is 0-255, not just 0-191
void hsv2rgb_rainbow( const struct CHSV& hsv, struct CRGB& rgb);
void hsv2rgb_rainbow( const struct CHSV* phsv, struct CRGB * prgb, int numLeds);
#define HUE_MAX_RAINBOW 255
// hsv2rgb_spectrum - convert a hue, saturation, and value to RGB
// using a mathematically straight spectrum (vs
// a visually balanced rainbow).
// This 'spectrum' will have more green & blue
// than a 'rainbow', and less yellow and orange.
//
// NOTE: here hue is 0-255, not just 0-191
void hsv2rgb_spectrum( const struct CHSV& hsv, struct CRGB& rgb);
void hsv2rgb_spectrum( const struct CHSV* phsv, struct CRGB * prgb, int numLeds);
#define HUE_MAX_SPECTRUM 255
// hsv2rgb_raw - convert hue, saturation, and value to RGB.
// This 'spectrum' conversion will be more green & blue
// than a real 'rainbow', and the hue is specified just
// in the range 0-191. Together, these result in a
// slightly faster conversion speed, at the expense of
// color balance.
//
// NOTE: Hue is 0-191 only!
// Saturation & value are 0-255 each.
//
void hsv2rgb_raw(const struct CHSV& hsv, struct CRGB & rgb);
void hsv2rgb_raw(const struct CHSV* phsv, struct CRGB * prgb, int numLeds);
#define HUE_MAX 191
// fill_solid - fill a range of LEDs with a solid color
void fill_solid( struct CRGB * pFirstLED, int numToFill,
const struct CRGB& color);
// fill_rainbow - fill a range of LEDs with a rainbow of colors, at
// full saturation and full value (brightness)
void fill_rainbow( struct CRGB * pFirstLED, int numToFill,
uint8_t initialhue,
uint8_t deltahue = 5);
#endif