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

◆ blurColumns() [1/3]

void fl::gfx::blurColumns ( Canvas< CRGB > & canvas,
alpha8 blur_amount )

Perform a blur1d() on every column of a rectangular matrix (Canvas version).

Parameters
canvasthe canvas to blur in-place
blur_amountalpha8 blur amount

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

234 {
235 const int w = canvas.width;
236 const int h = canvas.height;
237 CRGB *pixels = canvas.pixels;
238 fl::u8 keep = 255 - blur_amount;
239 fl::u8 seep = blur_amount >> 1;
240 for (int col = 0; col < w; ++col) {
241 CRGB carryover = CRGB::Black;
242 for (int row = 0; row < h; ++row) {
243 CRGB cur = pixels[row * w + col];
244 CRGB part = cur;
245 part.nscale8(seep);
246 cur.nscale8(keep);
247 cur += carryover;
248 if (row)
249 pixels[(row - 1) * w + col] += part;
250 pixels[row * w + col] = cur;
251 carryover = part;
252 }
253 }
254}
unsigned char u8
Definition s16x16x4.h:132
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
RGB_T * pixels
Definition canvas.h:72

References fl::CRGB::Black, fl::cur, fl::FL_NO_EXCEPT, and fl::CRGB::nscale8().

+ Here is the call graph for this function: