9#define saccum87 int16_t
26 const struct CRGB &color);
30 const struct CHSV &color);
39void fill_rainbow(
struct CRGB *targetArray,
int numToFill, uint8_t initialhue,
40 uint8_t deltahue = 5);
43void fill_rainbow(
struct CHSV *targetArray,
int numToFill, uint8_t initialhue,
44 uint8_t deltahue = 5);
55 uint8_t initialhue,
bool reversed =
false);
59 uint8_t initialhue,
bool reversed =
false);
78 uint16_t endpos,
CHSV endcolor,
81 if (endpos < startpos) {
84 endcolor = startcolor;
94 if (endcolor.value == 0 || endcolor.saturation == 0) {
95 endcolor.hue = startcolor.hue;
102 if (startcolor.value == 0 || startcolor.saturation == 0) {
103 startcolor.hue = endcolor.hue;
110 satdistance87 = (endcolor.sat - startcolor.sat) << 7;
111 valdistance87 = (endcolor.val - startcolor.val) << 7;
113 uint8_t huedelta8 = endcolor.hue - startcolor.hue;
117 if (huedelta8 > 127) {
124 if (huedelta8 < 128) {
130 huedistance87 = huedelta8 << 7;
133 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
134 huedistance87 = -huedistance87;
137 uint16_t pixeldistance = endpos - startpos;
138 int16_t divisor = pixeldistance ? pixeldistance : 1;
140#if FASTLED_USE_32_BIT_GRADIENT_FILL
142 int32_t huedelta823 = (huedistance87 * 65536) / divisor;
143 int32_t satdelta823 = (satdistance87 * 65536) / divisor;
144 int32_t valdelta823 = (valdistance87 * 65536) / divisor;
149 uint32_t hue824 =
static_cast<uint32_t
>(startcolor.hue) << 24;
150 uint32_t sat824 =
static_cast<uint32_t
>(startcolor.sat) << 24;
151 uint32_t val824 =
static_cast<uint32_t
>(startcolor.val) << 24;
152 for (uint16_t i = startpos; i <= endpos; ++i) {
153 targetArray[i] =
CHSV(hue824 >> 24, sat824 >> 24, val824 >> 24);
154 hue824 += huedelta823;
155 sat824 += satdelta823;
156 val824 += valdelta823;
160 saccum87 huedelta87 = huedistance87 / divisor;
161 saccum87 satdelta87 = satdistance87 / divisor;
162 saccum87 valdelta87 = valdistance87 / divisor;
168 accum88 hue88 = startcolor.hue << 8;
169 accum88 sat88 = startcolor.sat << 8;
170 accum88 val88 = startcolor.val << 8;
171 for (uint16_t i = startpos; i <= endpos; ++i) {
172 targetArray[i] =
CHSV(hue88 >> 8, sat88 >> 8, val88 >> 8);
191 uint16_t last = numLeds - 1;
207 uint16_t half = (numLeds / 2);
208 uint16_t last = numLeds - 1;
210 fill_gradient(targetArray, half, c2, last, c3, directionCode);
226 uint16_t onethird = (numLeds / 3);
227 uint16_t twothirds = ((numLeds * 2) / 3);
228 uint16_t last = numLeds - 1;
229 fill_gradient(targetArray, 0, c1, onethird, c2, directionCode);
230 fill_gradient(targetArray, onethird, c2, twothirds, c3, directionCode);
231 fill_gradient(targetArray, twothirds, c3, last, c4, directionCode);
235#define fill_gradient_HSV fill_gradient
247 uint16_t endpos,
CRGB endcolor);
Defines the red, green, and blue (RGB) pixel struct.
#define saccum87
ANSI: signed short _Accum.
void fill_gradient(T *targetArray, uint16_t startpos, CHSV startcolor, uint16_t endpos, CHSV endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill a range of LEDs with a smooth HSV gradient between two HSV colors.
void fill_rainbow_circular(struct CRGB *targetArray, int numToFill, uint8_t initialhue, bool reversed)
Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the...
void fill_rainbow(struct CRGB *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue)
Fill a range of LEDs with a rainbow of colors.
void fill_gradient_RGB(CRGB *leds, uint16_t startpos, CRGB startcolor, uint16_t endpos, CRGB endcolor)
Fill a range of LEDs with a smooth RGB gradient between two RGB colors.
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
uint16_t accum88
ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.
TGradientDirectionCode
Hue direction for calculating fill gradients.
@ SHORTEST_HUES
Hue goes whichever way is shortest.
@ LONGEST_HUES
Hue goes whichever way is longest.
@ FORWARD_HUES
Hue always goes clockwise around the color wheel.
@ BACKWARD_HUES
Hue always goes counter-clockwise around the color wheel.
Implements a simple red square effect for 2D LED grids.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)