1211 {
1212 const int w = canvas.
width;
1213 const int h = canvas.
height;
1214 if (w <= 0 || h <= 0)
1215 return;
1216
1217
1221 return;
1222 }
1223
1224
1225 using P = blur_detail::pixel_ops<RGB_T>;
1227
1229
1230
1231 if (hRadius == 0 && vRadius == 0) {
1232 if (applyAlpha) {
1233 for (
int y = 0;
y < h; ++
y) {
1234 for (
int x = 0;
x < w; ++
x) {
1235 RGB_T &p = canvas.
at(
x,
y);
1237 p = ops.make(ops.ch(p.r), ops.ch(p.g), ops.ch(p.b), alpha);
1238 }
1239 }
1240 }
1241 return;
1242 }
1243
1246 RGB_T *pad = padbuf.
data();
1247
1248
1249 if (hRadius > 0) {
1252
1253 for (
int y = 0;
y < h; ++
y) {
1254 for (
int x = 0;
x < w; ++
x)
1255 pad[hRadius +
x] = canvas.
at(
x,
y);
1256
1257 constexpr int shift = 2 * hRadius;
1258 for (
int x = 0;
x < w; ++
x) {
1259 acc_t r, g, b;
1262 if (vRadius == 0 && applyAlpha)
1263 result =
P().make(
static_cast<acc_t
>(r >> shift),
1264 static_cast<acc_t>(g >> shift),
1265 static_cast<acc_t>(b >> shift), alpha);
1266 else
1267 result =
P().make(
static_cast<acc_t
>(r >> shift),
1268 static_cast<acc_t>(g >> shift),
1269 static_cast<acc_t>(b >> shift));
1271 }
1272 }
1273 }
1274
1275
1276 if (vRadius > 0) {
1279
1280 for (
int x = 0;
x < w; ++
x) {
1281 for (
int y = 0;
y < h; ++
y)
1282 pad[vRadius +
y] = canvas.
at(
x,
y);
1283
1284 constexpr int shift = 2 * vRadius;
1285 for (
int y = 0;
y < h; ++
y) {
1286 acc_t r, g, b;
1289 if (applyAlpha)
1290 result =
P().make(
static_cast<acc_t
>(r >> shift),
1291 static_cast<acc_t>(g >> shift),
1292 static_cast<acc_t>(b >> shift), alpha);
1293 else
1294 result =
P().make(
static_cast<acc_t
>(r >> shift),
1295 static_cast<acc_t>(g >> shift),
1296 static_cast<acc_t>(b >> shift));
1298 }
1299 }
1300 }
1301}
bool isRectangularGrid() const FL_NOEXCEPT
const T * data() const FL_NOEXCEPT
typename conditional< B, T, F >::type conditional_t
constexpr AlphaT alpha_identity()
static fl::span< RGB_T > get_padbuf(int minSize)
static int compute_pad_size(int w, int h)
FL_OPTIMIZE_FUNCTION void blurGaussianImpl(Canvas< RGB_T > &canvas, AlphaT alpha)
FASTLED_FORCE_INLINE fl::u8 P(fl::u8 x)
expected< T, E > result
Alias for expected (Rust-style naming)
#define FL_BUILTIN_MEMSET(dest, val, n)
Simple rectangular canvas for graphics operations Combines a pixel buffer with dimensions for cache-o...
RGB_T & at(int x, int y) FL_NOEXCEPT