FastLED 3.10.8
Loading...
Searching...
No Matches

◆ blurRows() [3/3]

void fl::gfx::blurRows ( fl::span< CRGB > leds,
u8 width,
u8 height,
fract8 blur_amount,
const XYMap & xymap )

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

See also
blur1d()
Parameters
ledsspan of LEDs to blur
widththe width of the matrix
heightthe height of the matrix
blur_amountthe amount of blur to apply

Definition at line 134 of file blur.cpp.hpp.

135 {
136 CRGB *pixels = leds.data();
137 fl::u8 keep = 255 - blur_amount;
138 fl::u8 seep = blur_amount >> 1;
139 if (xyMap.isRectangularGrid()) {
140 for (fl::u8 row = 0; row < height; ++row) {
141 CRGB carryover = CRGB::Black;
142 CRGB *rowBase = pixels + row * width;
143 for (fl::u8 col = 0; col < width; ++col) {
144 CRGB cur = rowBase[col];
145 CRGB part = cur;
146 part.nscale8(seep);
147 cur.nscale8(keep);
148 cur += carryover;
149 if (col)
150 rowBase[col - 1] += part;
151 rowBase[col] = cur;
152 carryover = part;
153 }
154 }
155 return;
156 }
157 for (fl::u8 row = 0; row < height; ++row) {
158 CRGB carryover = CRGB::Black;
159 for (fl::u8 i = 0; i < width; ++i) {
160 CRGB cur = leds[xyMap.mapToIndex(i, row)];
161 CRGB part = cur;
162 part.nscale8(seep);
163 cur.nscale8(keep);
164 cur += carryover;
165 if (i)
166 leds[xyMap.mapToIndex(i - 1, row)] += part;
167 leds[xyMap.mapToIndex(i, row)] = cur;
168 carryover = part;
169 }
170 }
171}
CRGB leds[1]
fl::XYMap xyMap
u16 mapToIndex(const u16 &x, const u16 &y) const FL_NO_EXCEPT
unsigned char u8
Definition s16x16x4.h:132
fl::CRGB CRGB
Definition video.h:18
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
CRGB & nscale8(u8 scaledown) FL_NO_EXCEPT
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp.hpp:87
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

References fl::CRGB::Black, fl::cur, fl::FL_NO_EXCEPT, fl::height, leds, fl::CRGB::nscale8(), fl::width, and xyMap.

Referenced by blur2d(), blur2d(), fl::blurRows(), fl::blurRows(), fl::blurRows(), and blurRows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: