FastLED 3.10.8
Loading...
Searching...
No Matches
blur.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/gfx/canvas.h"
4#include "fl/stl/int.h"
5#include "fl/stl/span.h"
8#include "fl/stl/noexcept.h"
9
10namespace fl {
11namespace gfx {
12
16
30void blur1d(fl::span<CRGB> leds, fract8 blur_amount) FL_NO_EXCEPT;
31
33inline void blur1d(CRGB *leds, u16 numLeds, fract8 blur_amount) FL_NO_EXCEPT {
34 blur1d(fl::span<CRGB>(leds, numLeds), blur_amount);
35}
36
52void blur2d(fl::span<CRGB> leds, u8 width, u8 height, fract8 blur_amount,
53 const XYMap &xymap) FL_NO_EXCEPT;
54
56inline void blur2d(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
57 const XYMap &xymap) FL_NO_EXCEPT {
59 blur_amount, xymap);
60}
61
65void blur2d(CRGB *leds, u8 width, u8 height, fract8 blur_amount) FL_NO_EXCEPT
66 FASTLED_DEPRECATED("Use blur2d(..., const XYMap& xymap) instead");
67
75 const XYMap &xymap) FL_NO_EXCEPT;
76
78inline void blurRows(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
79 const XYMap &xymap) FL_NO_EXCEPT {
81 blur_amount, xymap);
82}
83
87 const XYMap &xymap) FL_NO_EXCEPT;
88
90inline void blurColumns(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
91 const XYMap &xymap) FL_NO_EXCEPT {
93 blur_amount, xymap);
94}
95
100void blur2d(Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT;
101
105void blurRows(Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT;
106
110void blurColumns(Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT;
111
113
120template <int hRadius, int vRadius, typename RGB_T>
121void blurGaussian(Canvas<RGB_T> &canvas, alpha8 dimFactor) FL_NO_EXCEPT;
122
125template <int hRadius, int vRadius, typename RGB_T>
126void blurGaussian(Canvas<RGB_T> &canvas, alpha16 dimFactor) FL_NO_EXCEPT;
127
129template <int hRadius, int vRadius, typename RGB_T>
132}
133
140template <int hRadius, int vRadius, typename RGB_T>
141void blurGaussian(CanvasMapped<RGB_T> &canvas, alpha8 dimFactor) FL_NO_EXCEPT;
142
144template <int hRadius, int vRadius, typename RGB_T>
145void blurGaussian(CanvasMapped<RGB_T> &canvas, alpha16 dimFactor) FL_NO_EXCEPT;
146
147} // namespace gfx
148
149// Span-based bindings — forward fl::blur* to fl::gfx::blur*
150inline void blur1d(fl::span<CRGB> leds, fract8 blur_amount) FL_NO_EXCEPT {
151 gfx::blur1d(leds, blur_amount);
152}
154 fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT {
155 gfx::blur2d(leds, width, height, blur_amount, xymap);
156}
158 fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT {
159 gfx::blurRows(leds, width, height, blur_amount, xymap);
160}
162 fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT {
163 gfx::blurColumns(leds, width, height, blur_amount, xymap);
164}
165
166// Canvas-based bindings — forward fl::blur* to fl::gfx::blur*
167inline void blur2d(gfx::Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT {
168 gfx::blur2d(canvas, blur_amount);
169}
170inline void blurRows(gfx::Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT {
171 gfx::blurRows(canvas, blur_amount);
172}
173inline void blurColumns(gfx::Canvas<CRGB> &canvas, alpha8 blur_amount) FL_NO_EXCEPT {
174 gfx::blurColumns(canvas, blur_amount);
175}
176
177// Legacy raw-pointer bindings — forward fl::blur* to fl::gfx::blur*
178inline void blur1d(CRGB *leds, u16 numLeds, fract8 blur_amount) FL_NO_EXCEPT {
179 gfx::blur1d(leds, numLeds, blur_amount);
180}
181inline void blur2d(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
182 const XYMap &xymap) FL_NO_EXCEPT {
183 gfx::blur2d(leds, width, height, blur_amount, xymap);
184}
185FASTLED_DEPRECATED("Use blur2d(..., const XYMap& xymap) instead")
186inline void blur2d(CRGB *leds, u8 width, u8 height, fract8 blur_amount) FL_NO_EXCEPT {
188 FL_DISABLE_WARNING(deprecated-declarations)
189 gfx::blur2d(leds, width, height, blur_amount);
191}
192inline void blurRows(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
193 const XYMap &xymap) FL_NO_EXCEPT {
194 gfx::blurRows(leds, width, height, blur_amount, xymap);
195}
196inline void blurColumns(CRGB *leds, u8 width, u8 height, fract8 blur_amount,
197 const XYMap &xymap) FL_NO_EXCEPT {
198 gfx::blurColumns(leds, width, height, blur_amount, xymap);
199}
200
201} // namespace fl
CRGB leds[1]
XYMap xymap
Canvas types for gfx primitives (implementation)
Generic canvas for any pixel type (e.g.
Definition gfx.h:53
void blur1d(fl::span< CRGB > leds, fract8 blur_amount) FL_NO_EXCEPT
One-dimensional blur filter (span version).
Definition blur.cpp.hpp:70
void blur2d(fl::span< CRGB > leds, fl::u8 width, fl::u8 height, fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT
Two-dimensional blur filter (span version).
Definition blur.cpp.hpp:88
void blurColumns(fl::span< CRGB > leds, fl::u8 width, fl::u8 height, fract8 blur_amount, const XYMap &xyMap) FL_NO_EXCEPT
Perform a blur1d() on every column of a rectangular matrix (span version).
Definition blur.cpp.hpp:173
void blurRows(fl::span< CRGB > leds, fl::u8 width, fl::u8 height, fract8 blur_amount, const XYMap &xyMap) FL_NO_EXCEPT
Perform a blur1d() on every row of a rectangular matrix (span version).
Definition blur.cpp.hpp:134
u8 fract8
Fixed-Point Fractional Types.
Definition s16x16x4.h:161
void blurGaussian(Canvas< RGB_T > &canvas, alpha8 dimFactor) FL_NO_EXCEPT
Compile-time Gaussian blur with independent H/V radii.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
void blurRows(fl::span< CRGB > leds, u8 width, u8 height, fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT
Definition blur.h:157
void blur2d(fl::span< CRGB > leds, u8 width, u8 height, fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT
Definition blur.h:153
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
void blur1d(fl::span< CRGB > leds, fract8 blur_amount) FL_NO_EXCEPT
Definition blur.h:150
void blurColumns(fl::span< CRGB > leds, u8 width, u8 height, fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT
Definition blur.h:161
Base definition for an LED controller.
#define FL_DISABLE_WARNING(warning)
#define FL_DISABLE_WARNING_PUSH
#define FL_DISABLE_WARNING_POP
#define FASTLED_DEPRECATED(msg)
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38
Unsigned 16-bit alpha / brightness — UNORM16.
Definition alpha.h:87
Unsigned 8-bit alpha / brightness — UNORM8.
Definition alpha.h:42
Simple rectangular canvas for graphics operations Combines a pixel buffer with dimensions for cache-o...
Definition canvas.h:66