FastLED 3.9.15
Loading...
Searching...
No Matches
crgb.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include "fl/gfx/crgb.h"
8#include "chsv.h"
9#include "platforms/is_platform.h"
10
11// Whether to allow HD_COLOR_MIXING
12#ifndef FASTLED_HD_COLOR_MIXING
13#ifdef FL_IS_AVR
14// Saves some memory on these constrained devices.
15#define FASTLED_HD_COLOR_MIXING 0
16#else
17#define FASTLED_HD_COLOR_MIXING 1
18#endif // FL_IS_AVR
19#endif // FASTLED_HD_COLOR_MIXING
20
21
22// Backward compatibility: bring fl::CRGB into global namespace as CRGB
23// TODO: AI should scan the database and only use fl::CRGB exclusitively.
24// ::CRGB is a global space version from the frontier age of the embedded revolution.
25using CRGB = fl::CRGB;
26
27// Include hsv2rgb.h AFTER the CRGB and CHSV typedefs are established
28// This is necessary because hsv2rgb.h uses these types in function declarations
29#include "hsv2rgb.h"
30
31
32
40
41
42
47FASTLED_FORCE_INLINE void hsv2rgb_dispatch( const CHSV* phsv, CRGB * prgb, int numLeds)
48{
49#if defined(FASTLED_HSV_CONVERSION_SPECTRUM)
50 hsv2rgb_spectrum(phsv, prgb, numLeds);
51#elif defined(FASTLED_HSV_CONVERSION_FULL_SPECTRUM)
52 hsv2rgb_fullspectrum(phsv, prgb, numLeds);
53#elif defined(FASTLED_HSV_CONVERSION_RAINBOW)
54 hsv2rgb_rainbow(phsv, prgb, numLeds);
55#else
56 // Default to rainbow for backward compatibility
57 hsv2rgb_rainbow(phsv, prgb, numLeds);
58#endif
59}
60
62{
63#if defined(FASTLED_HSV_CONVERSION_SPECTRUM)
64 hsv2rgb_spectrum(hsv, rgb);
65#elif defined(FASTLED_HSV_CONVERSION_FULL_SPECTRUM)
66 hsv2rgb_fullspectrum(hsv, rgb);
67#elif defined(FASTLED_HSV_CONVERSION_RAINBOW)
68 hsv2rgb_rainbow(hsv, rgb);
69#else
70 hsv2rgb_rainbow(hsv, rgb);
71#endif
72}
73
74
75// HSV conversion implementations for fl::CRGB
76// These must be defined after CRGB and CHSV typedefs are established
77// and after hsv2rgb_dispatch is defined
78// Note: Implementation moved to src/fl/rgb8.cpp to comply with namespace rules
Defines the hue, saturation, and value (HSV) pixel struct.
FASTLED_FORCE_INLINE void hsv2rgb_dispatch(const CHSV *phsv, CRGB *prgb, int numLeds)
HSV conversion function selection based on compile-time defines This allows users to configure which ...
Definition crgb.h:47
Defines the 8-bit red, green, and blue (RGB) pixel type in the fl namespace.
CRGB hsv2rgb_spectrum(const CHSV &hsv)
Inline version of hsv2rgb_spectrum which returns a CRGB object.
fl::hsv8 CHSV
Definition chsv.h:11
fl::CRGB CRGB
Definition crgb.h:25
CRGB hsv2rgb_rainbow(const CHSV &hsv)
void hsv2rgb_fullspectrum(const CHSV &hsv, CRGB &rgb)
Converts an HSV value to RGB using the algorithm from here: https://en.wikipedia.org/wiki/HSL_and_HSV...
Functions to convert from the HSV colorspace to the RGB colorspace.
#define FASTLED_FORCE_INLINE
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38