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

◆ blurRows() [1/3]

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

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

Parameters
canvasthe canvas to blur in-place
blur_amountalpha8 blur amount

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

210 {
211 const int w = canvas.width;
212 const int h = canvas.height;
213 CRGB *pixels = canvas.pixels;
214 fl::u8 keep = 255 - blur_amount;
215 fl::u8 seep = blur_amount >> 1;
216 for (int row = 0; row < h; ++row) {
217 CRGB carryover = CRGB::Black;
218 CRGB *rowBase = pixels + row * w;
219 for (int col = 0; col < w; ++col) {
220 CRGB cur = rowBase[col];
221 CRGB part = cur;
222 part.nscale8(seep);
223 cur.nscale8(keep);
224 cur += carryover;
225 if (col)
226 rowBase[col - 1] += part;
227 rowBase[col] = cur;
228 carryover = part;
229 }
230 }
231}
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: