FastLED 3.9.15
Loading...
Searching...
No Matches
primitives.h File Reference
+ Include dependency graph for primitives.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::gfx::detail::DiscCtx< PixelT >
 Disc context: bundles per-circle constants into a struct passed by reference. More...
 
struct  fl::gfx::detail::needs_division< Coord, typename >
 
struct  fl::gfx::detail::needs_division< Coord, typename voider< fl::bool_constant<(Coord::FRAC_BITS< 16)> >::type >
 
struct  fl::gfx::detail::RingCtx< PixelT >
 Ring context: bundles all per-circle constants into a struct passed by reference. More...
 
struct  fl::gfx::detail::StrokeCtx< PixelT >
 Stroke line context: bundles per-line constants into a struct passed by reference. More...
 
struct  fl::gfx::detail::voider<... >
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::gfx
 
namespace  fl::gfx::detail
 ============================================================================
 

Functions

template<typename Coord>
Coord fl::gfx::aaRatio (Coord num, Coord denom, Coord inv_denom)
 Compute num/denom using the best strategy for the Coord type:
 
template<typename Coord>
Coord fl::gfx::detail::aaRatioDispatch (Coord num, Coord denom, Coord, fl::true_type)
 
template<typename Coord>
Coord fl::gfx::detail::aaRatioDispatch (Coord num, Coord, Coord inv_denom, fl::false_type)
 
template<typename PixelT, bool Overwrite>
void fl::gfx::addPixelToBuffer (PixelT *pixels, int width, int height, int x, int y, const PixelT &color)
 Internal helper: add or set pixel to rectangular buffer with bounds checking Direct row-major indexing: pixels[y * width + x] Templated on Overwrite for compile-time dispatch (no per-pixel branch).
 
void fl::gfx::detail::computeBandShift (fl::i32 band, fl::u8 &shift_out, fl::u16 &inv_out)
 Precompute right-shift and reciprocal multiplier for AA division.
 
template<typename T>
fl::u8 fl::gfx::coordToU8 (T alpha)
 sqrt is provided by fl::sqrt overloads in math.h for:
 
template<>
fl::u8 fl::gfx::coordToU8< double > (double alpha)
 
template<>
fl::u8 fl::gfx::coordToU8< fl::s16x16 > (fl::s16x16 alpha)
 
template<>
fl::u8 fl::gfx::coordToU8< float > (float alpha)
 
template<>
fl::u8 fl::gfx::coordToU8< int > (int alpha)
 
template<typename PixelT, typename Coord>
void fl::gfx::drawDisc (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r, fl::DrawMode mode=fl::DrawMode::DRAW_MODE_BLEND) FL_NOEXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void fl::gfx::detail::drawDiscCore (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r)
 
template<typename PixelT, typename Coord>
void fl::gfx::drawLine (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1, fl::DrawMode mode)
 ============================================================================
 
template<typename PixelT, typename Coord, bool Overwrite>
void fl::gfx::detail::drawLineCore (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1)
 
template<typename PixelT, typename Coord>
void fl::gfx::drawRing (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r, Coord thickness, fl::DrawMode mode=fl::DrawMode::DRAW_MODE_BLEND) FL_NOEXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void fl::gfx::detail::drawRingCore (Canvas< PixelT > &canvas, const PixelT &color, Coord cx, Coord cy, Coord r, Coord thickness)
 
template<typename PixelT, typename Coord>
void fl::gfx::drawStrokeLine (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1, Coord thickness, LineCap cap, fl::DrawMode mode=fl::DrawMode::DRAW_MODE_BLEND) FL_NOEXCEPT
 
template<typename PixelT, typename Coord, bool Overwrite>
void fl::gfx::detail::drawStrokeLineCore (Canvas< PixelT > &canvas, const PixelT &color, Coord x0, Coord y0, Coord x1, Coord y1, Coord thickness, LineCap cap)
 
template<typename T>
fl::gfx::fromFrac (int p, int q)
 Convert rational p/q to Coord without float.
 
template<>
fl::s16x16 fl::gfx::fromFrac< fl::s16x16 > (int p, int q)
 
template<typename T>
fl::gfx::fromInt (int n)
 Convert an integer to Coord without float intermediate.
 
template<>
fl::s16x16 fl::gfx::fromInt< fl::s16x16 > (int n)
 
template<typename T>
fl::gfx::halfOf (T val)
 Divide Coord by 2 using shift (avoids expensive division on embedded).
 
template<>
double fl::gfx::halfOf< double > (double val)
 
template<>
fl::s16x16 fl::gfx::halfOf< fl::s16x16 > (fl::s16x16 val)
 
template<>
float fl::gfx::halfOf< float > (float val)
 
template<>
int fl::gfx::halfOf< int > (int val)
 
template<typename PixelT, bool Overwrite>
void fl::gfx::detail::renderDiscRow (PixelT *buf, int w, int py, fl::i32 d2_row, const DiscCtx< PixelT > &f)
 Render one scanline of a disc using incremental d².
 
template<typename PixelT, bool Overwrite>
void fl::gfx::detail::renderRingRow (PixelT *buf, int w, int py, fl::i32 d2_row, const RingCtx< PixelT > &g)
 Render one scanline of a ring using incremental d² with phase-based scanning.
 
template<typename PixelT, bool Overwrite>
void fl::gfx::detail::renderStrokeRow (PixelT *buf, int w, int py, fl::i32 cross_start, fl::i32 dot_start, const StrokeCtx< PixelT > &sc)
 Render one scanline of a stroke line using phase-based scanning.
 
template<typename Coord>
fl::i32 fl::gfx::detail::toFixed8 (Coord val)
 Convert any Coord type to 8.8 fixed-point (fl::i32).
 
template<>
fl::i32 fl::gfx::detail::toFixed8< double > (double val)
 
template<>
fl::i32 fl::gfx::detail::toFixed8< fl::s16x16 > (fl::s16x16 val)
 
template<>
fl::i32 fl::gfx::detail::toFixed8< float > (float val)
 
template<>
fl::i32 fl::gfx::detail::toFixed8< int > (int val)
 
template<typename T>
int fl::gfx::toInt (const T &val)
 Helper to convert any coordinate type to int Supports: s16x16 (via to_int()), float, int, and other arithmetic types.
 
template<>
int fl::gfx::toInt< double > (const double &val)
 
template<>
int fl::gfx::toInt< float > (const float &val)
 
template<>
int fl::gfx::toInt< int > (const int &val)
 
template<typename Coord>
fl::i32 fl::gfx::detail::toQ16 (Coord val)
 Convert any Coord type to Q16.16 raw i32 for integer inner loops.
 
template<>
fl::i32 fl::gfx::detail::toQ16< double > (double val)
 
template<>
fl::i32 fl::gfx::detail::toQ16< fl::s16x16 > (fl::s16x16 val)
 
template<>
fl::i32 fl::gfx::detail::toQ16< float > (float val)
 
template<>
fl::i32 fl::gfx::detail::toQ16< int > (int val)
 

Class Documentation

◆ fl::gfx::detail::DiscCtx

struct fl::gfx::detail::DiscCtx
Class Members
u16 band_inv
u8 band_shift
PixelT color
i32 rin2
i32 rout2
i32 xdelta0
int xmax
int xmin

◆ fl::gfx::detail::RingCtx

struct fl::gfx::detail::RingCtx
Class Members
PixelT color
i32 ii2
u16 inner_inv
u8 inner_shift
i32 io2
i32 oi2
i32 oo2
u16 outer_inv
u8 outer_shift
i32 xdelta0
int xmax
int xmin

◆ fl::gfx::detail::StrokeCtx

struct fl::gfx::detail::StrokeCtx
Class Members
u16 aa_inv
u8 aa_shift
LineCap cap
u16 cap_inv
u8 cap_shift
PixelT color
i32 dot_ext_q
i32 dx_q
i32 dy_q
i32 len2_q
i32 r_max2_8
i32 threshold_q
i32 x0_8
i32 x1_8
int xmax
int xmin
i32 y0_8
i32 y1_8

◆ fl::gfx::detail::voider

struct fl::gfx::detail::voider
Class Members
typedef void type