FastLED 3.9.15
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 233 of file blur.cpp.hpp.

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

References fl::CRGB::Black, fl::blur_amount, fl::cur, fl::gfx::Canvas< RGB_T >::height, fl::CRGB::nscale8(), fl::gfx::Canvas< RGB_T >::pixels, and fl::gfx::Canvas< RGB_T >::width.

+ Here is the call graph for this function: