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

◆ blurColumns() [3/3]

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

Perform a blur1d() on every column 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 172 of file blur.cpp.hpp.

173 {
174 CRGB *pixels = leds.data();
175 fl::u8 keep = 255 - blur_amount;
176 fl::u8 seep = blur_amount >> 1;
177 if (xyMap.isRectangularGrid()) {
178 for (fl::u8 col = 0; col < width; ++col) {
179 CRGB carryover = CRGB::Black;
180 for (fl::u8 row = 0; row < height; ++row) {
181 CRGB cur = pixels[row * width + col];
182 CRGB part = cur;
183 part.nscale8(seep);
184 cur.nscale8(keep);
185 cur += carryover;
186 if (row)
187 pixels[(row - 1) * width + col] += part;
188 pixels[row * width + col] = cur;
189 carryover = part;
190 }
191 }
192 return;
193 }
194 for (fl::u8 col = 0; col < width; ++col) {
195 CRGB carryover = CRGB::Black;
196 for (fl::u8 i = 0; i < height; ++i) {
197 CRGB cur = leds[xyMap.mapToIndex(col, i)];
198 CRGB part = cur;
199 part.nscale8(seep);
200 cur.nscale8(keep);
201 cur += carryover;
202 if (i)
203 leds[xyMap.mapToIndex(col, i - 1)] += part;
204 leds[xyMap.mapToIndex(col, i)] = cur;
205 carryover = part;
206 }
207 }
208}
fl::XYMap xyMap
fl::CRGB leds[NUM_LEDS]
u16 mapToIndex(const u16 &x, const u16 &y) const FL_NOEXCEPT
unsigned char u8
Definition s16x16x4.h:132
fl::CRGB CRGB
Definition video.h:15
u8 u8 height
Definition blur.h:186
u8 u8 fract8 blur_amount
Definition blur.h:186
u8 width
Definition blur.h:186
CRGB & nscale8(u8 scaledown) FL_NOEXCEPT
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp.hpp:88
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

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

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

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