FastLED 3.10.8
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 211 of file blur.cpp.hpp.

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