FastLED 3.9.15
Loading...
Searching...
No Matches

◆ blurRows()

void fl::blurRows ( CRGB * leds,
fl::u8 width,
fl::u8 height,
fract8 blur_amount,
const XYMap & xyMap )

Perform a blur1d() on every row of a rectangular matrix.

See also
blur1d()
Parameters
ledsa pointer to the LED array to blur
widththe width of the matrix
heightthe height of the matrix
blur_amountthe amount of blur to apply

Definition at line 84 of file blur.cpp.

85 {
86
87 /* for( fl::u8 row = 0; row < height; row++) {
88 CRGB* rowbase = leds + (row * width);
89 blur1d( rowbase, width, blur_amount);
90 }
91 */
92 // blur rows same as columns, for irregular matrix
93 fl::u8 keep = 255 - blur_amount;
94 fl::u8 seep = blur_amount >> 1;
95 for (fl::u8 row = 0; row < height; row++) {
96 CRGB carryover = CRGB::Black;
97 for (fl::u8 i = 0; i < width; i++) {
98 CRGB cur = leds[xyMap.mapToIndex(i, row)];
99 CRGB part = cur;
100 part.nscale8(seep);
101 cur.nscale8(keep);
102 cur += carryover;
103 if (i)
104 leds[xyMap.mapToIndex(i - 1, row)] += part;
105 leds[xyMap.mapToIndex(i, row)] = cur;
106 carryover = part;
107 }
108 }
109}
CRGB leds[NUM_LEDS]
fl::XYMap xyMap
Definition ColorBoost.h:61
unsigned char u8
Definition int.h:17
CRGB & nscale8(fl::u8 scaledown)
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:567
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86