FastLED 3.10.8
Loading...
Searching...
No Matches
crgb_extra.cpp.hpp
Go to the documentation of this file.
1// ok no header
9
10#define FASTLED_INTERNAL
11#include "crgb.h"
12#include "hsv2rgb.h"
13#include "fl/gfx/hsv16.h"
14#include "fl/stl/noexcept.h"
15
16// Implementations are in fl namespace since CRGB is defined there
17namespace fl {
18
19// ============================================================================
20// HSV8 Methods
21// ============================================================================
22
25 CHSV hsv_color(rhs.h, rhs.s, rhs.v);
26 CRGB rgb_result;
27 hsv2rgb_rainbow(hsv_color, rgb_result);
28 r = rgb_result.r;
29 g = rgb_result.g;
30 b = rgb_result.b;
31}
32
35 CHSV hsv_color(rhs.h, rhs.s, rhs.v);
36 CRGB rgb_result;
37 hsv2rgb_rainbow(hsv_color, rgb_result);
38 r = rgb_result.r;
39 g = rgb_result.g;
40 b = rgb_result.b;
41 return *this;
42}
43
44// ============================================================================
45// SetHSV Methods
46// ============================================================================
47
50 CHSV hsv_color(hue, sat, val);
51 hsv2rgb_rainbow(hsv_color, *this);
52 return *this;
53}
54
57 CHSV hsv_color(hue, 255, 255);
58 hsv2rgb_rainbow(hsv_color, *this);
59 return *this;
60}
61
62// ============================================================================
63// HSV16 Methods
64// ============================================================================
65
66CRGB CRGB::colorBoost(EaseType saturation_function, EaseType luminance_function) const FL_NO_EXCEPT {
67 HSV16 hsv(*this);
68 return hsv.colorBoost(saturation_function, luminance_function);
69}
70
71void CRGB::colorBoost(const CRGB* src, CRGB* dst, size_t count, EaseType saturation_function, EaseType luminance_function) FL_NO_EXCEPT {
72 for (size_t i = 0; i < count; i++) {
73 dst[i] = src[i].colorBoost(saturation_function, luminance_function);
74 }
75}
76
78 return HSV16(*this);
79}
80
81// Constructor implementation for HSV16 -> CRGB automatic conversion
83 *this = rhs.ToRGB();
84}
85
86} // namespace fl
uint8_t hue
Definition advanced.h:94
Defines the 8-bit red, green, and blue (RGB) pixel type in the fl namespace.
fl::hsv8 CHSV
Definition chsv.h:11
CRGB hsv2rgb_rainbow(const CHSV &hsv) FL_NO_EXCEPT
Functions to convert from the HSV colorspace to the RGB colorspace.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
InputGamut g
Definition rgbw.h:125
EaseType
Definition ease.h:27
Base definition for an LED controller.
Definition crgb.hpp:179
CRGB & setHue(u8 hue) FL_NO_EXCEPT
Allow assignment from just a hue.
FASTLED_FORCE_INLINE CRGB & operator=(const CRGB &rhs) FL_NO_EXCEPT=default
Allow assignment from one RGB struct to another.
HSV16 toHSV16() const FL_NO_EXCEPT
FASTLED_FORCE_INLINE CRGB() FL_NO_EXCEPT
Default constructor.
Definition crgb.h:111
CRGB & setHSV(u8 hue, u8 sat, u8 val) FL_NO_EXCEPT
Allow assignment from hue, saturation, and value.
CRGB colorBoost(EaseType saturation_function=EaseType::EASE_NONE, EaseType luminance_function=EaseType::EASE_NONE) const FL_NO_EXCEPT
CRGB colorBoost(EaseType saturation_function=EaseType::EASE_IN_QUAD, EaseType luminance_function=EaseType::EASE_NONE) const FL_NO_EXCEPT
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition hsv.h:16