Nearest-neighbor sample from a 2D CRGB grid.
Definition at line 43 of file sample.cpp.hpp.
43 {
44 int xi =
static_cast<int>(
x + 0.5f);
45 int yi =
static_cast<int>(
y + 0.5f);
46 xi =
max(0,
min(xi,
static_cast<int>(
xyMap.getWidth()) - 1));
47 yi =
max(0,
min(yi,
static_cast<int>(
xyMap.getHeight()) - 1));
48 return grid[
xyMap.mapToIndex(xi, yi)];
49}
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
References FL_NO_EXCEPT, max(), min(), x, xyMap, and y.
Referenced by sample().