FastLED 3.10.10
Loading...
Searching...
No Matches

◆ drawPolygon() [4/4]

template<typename PixelT, typename Coord, int MAXN = FL_GFX_POLYGON_DEFAULT_MAXN, int CHUNK = FL_GFX_POLYGON_DEFAULT_CHUNK, PolyFill Fill = PolyFill::Exact>
void fl::gfx::drawPolygon ( Canvas< PixelT > & canvas,
const PixelT & color,
fl::span< const PolyPoint< Coord > > pts,
fl::DrawMode mode )
inline

Fill selects the polygon backend (PolyFill::Exact by default; PolyFill::ABuffer for the faster 8x4 A-buffer kernel, which ignores CHUNK).

MAXN caps the vertex count and CHUNK the per-row accumulator width in px (must be a power of two).

The defaults (FL_GFX_POLYGON_DEFAULT_MAXN / _CHUNK in fl/gfx/canvas.h) are 8 / 16 on FL_PLATFORM_HAS_SMALL_STACK targets (AVR, ESP8266, ...) and 32 / 64 elsewhere, because the 32 / 64 frame does not fit in an AVR Uno's 2 KB of SRAM (measured figures at the macro definition). Smaller tiers shrink the stack – the rendered pixels are identical for polygons with at most MAXN vertices.

Fill selects the backend: PolyFill::Exact (default, exact per-pixel area) or PolyFill::ABuffer (8x4 A-buffer sampling; CHUNK is ignored).

Definition at line 1599 of file primitives.h.

1601 {
1602 if (Fill == PolyFill::ABuffer) {
1605 else
1607 } else if (mode == fl::DrawMode::DRAW_MODE_OVERWRITE)
1609 else
1611}
fl::CanvasRGB canvas(fl::span< CRGB >(leds, NUM_LEDS), WIDTH, HEIGHT)
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).
void drawPolygonCore(Canvas< PixelT > &canvas, const PixelT &color, fl::span< const PolyPoint< Coord > > pts) FL_NO_EXCEPT
@ DRAW_MODE_OVERWRITE
Definition draw_mode.h:5

References ABuffer, canvas, fl::DRAW_MODE_OVERWRITE, fl::gfx::detail::drawPolygonABufferCore(), fl::gfx::detail::drawPolygonCore(), and fl::FL_NO_EXCEPT.

Referenced by fl::gfx::Canvas< RGB_T >::drawPolygon(), fl::gfx::Canvas< RGB_T >::drawPolygon(), and drawPolygon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: