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