FastLED 3.10.10
Loading...
Searching...
No Matches
fl::gfx::detail Namespace Reference

Detailed Description

============================================================================

LEGACY RASTERTARGET API (Deprecated - for backward compatibility)

============================================================================

CANVAS IMPLEMENTATIONS

Classes

struct  AbEdge
 Per-edge scanline state. More...
 
struct  DiscCtx
 Disc context: bundles per-circle constants into a struct passed by reference. More...
 
struct  needs_division
 
struct  needs_division< Coord, typename voider< fl::bool_constant<(Coord::FRAC_BITS< 16)> >::type >
 
struct  PolyEdge
 Per-edge scanline state for drawPolygon (even-odd fill, band model). More...
 
struct  RingCtx
 Ring context: bundles all per-circle constants into a struct passed by reference. More...
 
struct  StrokeCtx
 Stroke line context: bundles per-line constants into a struct passed by reference. More...
 
struct  voider
 

Functions

template<typename Coord>
Coord aaRatioDispatch (Coord num, Coord denom, Coord, fl::true_type) FL_NO_EXCEPT
 
template<typename Coord>
Coord aaRatioDispatch (Coord num, Coord, Coord inv_denom, fl::false_type) FL_NO_EXCEPT
 
void computeBandShift (fl::i32 band, fl::u8 &shift_out, fl::u16 &inv_out) FL_NO_EXCEPT
 Precompute right-shift and reciprocal multiplier for AA division.
 
template<typename PixelT, typename Coord, bool Overwrite>
void drawDiscCore (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r) FL_NO_EXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void drawLineCore (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1) FL_NO_EXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite, int MAXN>
void drawPolygonABufferCore (Canvas< PixelT > &canvas, const PixelT &color, fl::span< const PolyPoint< Coord > > pts) FL_NO_EXCEPT
 A-buffer 8x4 antialiased polygon fill (see file header).
 
template<typename PixelT, typename Coord, bool Overwrite, int MAXN, int CHUNK>
void drawPolygonCore (Canvas< PixelT > &canvas, const PixelT &color, fl::span< const PolyPoint< Coord > > pts) FL_NO_EXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void drawRingCore (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r, Coord thickness) FL_NO_EXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void drawStrokeLineCore (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1, Coord thickness, LineCap cap) FL_NO_EXCEPT
 
const fl::u8 distanceAA_LUT[256] FL_ALIGN_PROGMEM (256)
 256-byte antialiasing lookup table Maps normalized squared distance d²/r_max² (scaled 0..255) to brightness byte Entry i = round(255 * max(0, 1 - sqrt(i/255))) Provides smooth antialiasing fringe for circles and discs
 
fl::i32 floorDiv16I32 (fl::i32 v) FL_NO_EXCEPT
 Floor(v / 65536) for i32.
 
fl::i64 floorDiv16I64 (fl::i64 v) FL_NO_EXCEPT
 Same for i64 (line crossings can exceed i32 for steep short edges).
 
fl::i64 floorDivI64 (fl::i64 a, fl::i64 b) FL_NO_EXCEPT
 Floor-divide a by positive b (rounds toward -inf).
 
fl::i32 isqrt32_ceil (fl::i32 n)
 Integer square root using Newton iteration Computes ceil(sqrt(n)) for positive integers More accurate than digit-by-digit for the ceiling case.
 
fl::i32 isqrt32_floor (fl::i32 n)
 Integer square root using digit-by-digit algorithm Computes floor(sqrt(n)) for positive integers Uses only shifts, adds, and comparisons — no division.
 
fl::u8 polyABAlpha (fl::u32 mask) FL_NO_EXCEPT
 Alpha (0..255) for an 8x4 mask: 8 per subpixel, saturating at 255 (32 subpixels would otherwise wrap a u8).
 
fl::i32 polyABClampPx (float px) FL_NO_EXCEPT
 Float -> Q16.16, clamped to ±8191 px.
 
template<typename PixelT>
void polyABFillRun (PixelT *pixels, int py, int width, int x0, int x1, const PixelT &color, fl::u8 br, bool overwrite) FL_NO_EXCEPT
 Fill a run of [x0, x1) pixels of row py with color at alpha br.
 
fl::i64 polyABFloorDivI64 (fl::i64 a, fl::i64 b) FL_NO_EXCEPT
 Floor-divide a by positive b (rounds toward -inf).
 
fl::u8 polyABPop8 (fl::u8 v) FL_NO_EXCEPT
 Popcount of a byte.
 
const fl::u8 * polyABPop8Table () FL_NO_EXCEPT
 
fl::u8 polyABPopcount32 (fl::u32 v) FL_NO_EXCEPT
 
template<typename Coord>
fl::i32 polyABToQ16 (Coord val) FL_NO_EXCEPT
 Convert any Coord type to Q16.16, clamped to ±8191 px.
 
template<>
fl::i32 polyABToQ16< double > (double val) FL_NO_EXCEPT
 
template<>
fl::i32 polyABToQ16< fl::s16x16 > (fl::s16x16 val) FL_NO_EXCEPT
 
template<>
fl::i32 polyABToQ16< float > (float val) FL_NO_EXCEPT
 
template<>
fl::i32 polyABToQ16< int > (int val) FL_NO_EXCEPT
 
void polyAdd128 (fl::u64 &hi, fl::u64 &lo, fl::u64 ahi, fl::u64 alo) FL_NO_EXCEPT
 128-bit add: (hi, lo) += (ahi, alo).
 
int polyClz32 (fl::u32 v) FL_NO_EXCEPT
 Count leading zeros of a non-zero 32-bit value (branch form: portable to MSVC where __builtin_clz is unavailable, and branch-free on x86).
 
int polyColClamped (fl::i64 v, int width) FL_NO_EXCEPT
 Pixel column floor(v / 65536) of a row-extent bound v = x +/- hw, clamped to [-1, width].
 
FL_NO_INLINE fl::i32 polyDivRoundT28 (fl::u64 mhi, fl::u64 mlo, fl::u64 dv) FL_NO_EXCEPT
 T = round_half_up(M / dv) clamped to kPolyOne, for M = (mhi, mlo) and 0 < dv < 2^63 (polyLineT28's quotient step).
 
fl::i32 polyLineT28 (fl::i32 B, fl::i32 D, fl::i64 u, fl::i32 ta, fl::i32 tb) FL_NO_EXCEPT
 Exact left-of-line coverage of one pixel for one polygon edge.
 
void polyMul128 (fl::u64 a, fl::u64 b, fl::u64 &hi, fl::u64 &lo) FL_NO_EXCEPT
 Multiply two unsigned values < 2^48, returning the 128-bit product as a (hi, lo) u64 pair.
 
void polySortBand (fl::u8 *idx, fl::i64 *keys, const PolyEdge *edges, int nc, fl::i32 mid) FL_NO_EXCEPT
 Sort a band's active edges (idx[0..nc)) by the committed implementation's midpoint key: the FLOORED Q16.16 crossing at the band midpoint, key_e = floor((2*dy_e*x_e + B_e*mid) / (2*dy_e)), mid = a + b with a stable insertion sort (equal keys keep edge-index order).
 
int polyTopBit128 (fl::u32 m3, fl::u32 m2, fl::u32 m1, fl::u32 m0) FL_NO_EXCEPT
 Index (0..127) of the highest set bit of a 128-bit value held in four 32-bit lanes (m3 most significant), or -1 when the value is zero.
 
template<typename PixelT, bool Overwrite>
void renderDiscRow (PixelT *buf, int w, int py, fl::i32 d2_row, const DiscCtx< PixelT > &f) FL_NO_EXCEPT
 Render one scanline of a disc using incremental d².
 
template<typename PixelT, bool Overwrite>
void renderRingRow (PixelT *buf, int w, int py, fl::i32 d2_row, const RingCtx< PixelT > &g) FL_NO_EXCEPT
 Render one scanline of a ring using incremental d² with phase-based scanning.
 
template<typename PixelT, bool Overwrite>
void renderStrokeRow (PixelT *buf, int w, int py, fl::i32 cross_start, fl::i32 dot_start, const StrokeCtx< PixelT > &sc) FL_NO_EXCEPT
 Render one scanline of a stroke line using phase-based scanning.
 
template<typename Coord>
fl::i32 toFixed8 (Coord val) FL_NO_EXCEPT
 Convert any Coord type to 8.8 fixed-point (fl::i32).
 
template<>
fl::i32 toFixed8< double > (double val) FL_NO_EXCEPT
 
template<>
fl::i32 toFixed8< fl::s16x16 > (fl::s16x16 val) FL_NO_EXCEPT
 
template<>
fl::i32 toFixed8< float > (float val) FL_NO_EXCEPT
 
template<>
fl::i32 toFixed8< int > (int val) FL_NO_EXCEPT
 
template<typename Coord>
fl::i32 toQ16 (Coord val) FL_NO_EXCEPT
 Convert any Coord type to Q16.16 raw i32 for integer inner loops.
 
template<>
fl::i32 toQ16< double > (double val) FL_NO_EXCEPT
 
template<>
fl::i32 toQ16< fl::s16x16 > (fl::s16x16 val) FL_NO_EXCEPT
 
template<>
fl::i32 toQ16< float > (float val) FL_NO_EXCEPT
 
template<>
fl::i32 toQ16< int > (int val) FL_NO_EXCEPT
 
template<typename Coord>
fl::i32 toQ16Clamped (Coord val) FL_NO_EXCEPT
 Convert any Coord type to Q16.16, clamped to ±8191 px (NaN -> 0).
 

Variables

const fl::u8 distanceAA_LUT [256]
 Distance antialiasing lookup table Maps normalized squared distance d²/r_max² (scaled 0..255) to brightness byte Entry i = round(255 * max(0, 1 - sqrt(i/255))) PROGMEM on embedded platforms, regular array on host.
 
static const fl::i32 kPolyOne = 1L << 28
 Full-pixel coverage in T units (see polyLineT28).
 
static const fl::i32 kPolyQ16Max = 8191L << 16
 Maximum |vertex coordinate| accepted by drawPolygon, in Q16.16 units.
 
static const fl::i32 polyABQ16Max = 8191L << 16
 Maximum |vertex coordinate| accepted, in Q16.16 units (8191 px keeps all values and edge deltas in i32 with headroom — same bound as the exact kernel).