In development. It changes without notice.
Topic
Render Canvas
The canvas over the display, the smooth shapes it draws, and the choice of how an e-paper panel refreshes.
- See also
- Canvas, Theme & Layout, Display
Files | |
| file | src/ |
| Device implementation of the coverage-AA circle / annulus / line primitives. | |
| file | src/ |
| Coverage-based anti-aliased circle / disc / swept-annulus primitives. | |
| file | src/ |
| Per-screen render-mode policy and settle detector for the CoreInk e-paper. | |
| file | src/ |
| Pass-through kleidos:: | |
| file | src/ |
| Pass-through kleidos:: | |
Classes | |
| struct | kleidos:: |
| The ring a swept, gauge or sector annulus fill paints into. More about kleidos:: | |
| struct | kleidos:: |
| What the orchestrator should do with the current tick. More about kleidos:: | |
| class | kleidos:: |
| Stateful settle detector that maps a screen's mode + activity to a plan. More about kleidos:: | |
| class | kleidos:: |
| Concrete Canvas that delegates to the display:: HAL. More about kleidos:: | |
Enumerations | |
| enum class | kleidos:: |
| How a screen should be committed on the CoreInk e-paper. More about kleidos:: | |
| enum class | kleidos:: |
| What kind of surface a screen is, for the render-mode policy. More about kleidos:: | |
Functions | |
| bool | kleidos:: |
| Whether the active display backend supports AA blending. | |
| void | kleidos:: |
| Cut every primitive's scan to a rectangle: the canvas clip. | |
| void | kleidos:: |
| Release the rectangle ui:: | |
| void | kleidos:: |
| Draw an anti-aliased filled disc. | |
| void | kleidos:: |
| Draw an anti-aliased circle outline of a given stroke thickness. | |
| void | kleidos:: |
| Draw an anti-aliased thick line (round-capped) via coverage/SDF. | |
| void | kleidos:: |
| Draw an anti-aliased thick line (round-capped) with sub-pixel endpoints. | |
| void | kleidos:: |
| Fill an anti-aliased rounded rectangle. | |
| void | kleidos:: |
| Draw an anti-aliased rounded-rectangle outline of a given thickness. | |
| void | kleidos:: |
| Draw the Kleidos mark's body, its outline and its keyhole in one coverage pass. | |
| void | kleidos:: |
| Draw an anti-aliased annulus sector ("pie band") swept from 12 o'clock. | |
| void | kleidos:: |
| Paint a gauge ring — a dim full-ring track with a bright [0, sweepDeg] progress wedge — in a single antialiased band pass. | |
| void | kleidos:: |
| Paint a gauge ring whose lit arc starts anywhere: a dim full-ring track with a bright [startDeg, startDeg + sweepDeg] arc, in one antialiased band pass. | |
| void | kleidos:: |
Paint only the angular slice [fromDeg, toDeg] of an annulus band. | |
| constexpr EpaperRenderMode | kleidos:: |
The render mode surface is committed with. | |
| constexpr bool | kleidos:: |
Whether mode commits its first frame of a visit in 6-tone gray. | |
Variables | |
|
constexpr std::array< EpaperRenderMode, static_cast< size_t >(EpaperSurface:: | kleidos:: |
| How each surface is committed. Indexed by EpaperSurface. | |
| constexpr uint32_t | kleidos:: |
| Default idle window before a settled list repaints in gray. | |
Enumeration Type Documentation
EpaperRenderMode #
How a screen should be committed on the CoreInk e-paper.
EpaperSurface #
What kind of surface a screen is, for the render-mode policy.
A screen declares what it is; this module decides how it is committed. The rule lives in one table (ui::
Function Documentation
available() #
Whether the active display backend supports AA blending.
True on every color panel — both the read-modify-write back-end (readable shadow buffer) and the known-background back-end (no shadow buffer, e.g. the 320x240 classic boards). The per-pixel path is chosen internally from display::, so callers do not need to distinguish them.
- Return values
-
Value Meaning true Color panel (blending possible via either back-end). false E-paper / mono — use the crisp non-AA primitives.
entryFrameIsGray() #
Whether mode commits its first frame of a visit in 6-tone gray.
- Parameters
-
Name Direction Meaning mode in The mode a screen declared.
- Returns
- Whether entering the screen costs one gray frame.
epaperModeFor() #
The render mode surface is committed with.
- Parameters
-
Name Direction Meaning surface in The kind of surface on the glass.
- Returns
- Its mode;
OneBitQualityfor a value outside the table, which is the mode that is always safe to read.
fillAnnulusGaugeAA() #
Paint a gauge ring — a dim full-ring track with a bright [0, sweepDeg] progress wedge — in a single antialiased band pass.
Equivalent to a full-ring fillAnnulusSweepAA in trackColor followed by a sweepDeg one in fillColor, but computes the per-pixel distance and angle once (about half the work), so it is cheap enough to animate per frame.
- Parameters
-
Name Direction Meaning ring in The ring (center and radii); no-op when its outer radius is not past its inner one. sweepDeg in Progress wedge angle in degrees [0, 360]; 0 = track only. trackColor in RGB565 dim full-ring color. fillColor in RGB565 bright progress color, over the track. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
fillAnnulusSectorAA() #
Paint only the angular slice [fromDeg, toDeg] of an annulus band.
The incremental sibling of fillAnnulusSweepAA — instead of repainting the whole [0, sweepDeg] wedge, it fills just the newly revealed angular band [fromDeg, toDeg] (clockwise from 12 o'clock) over the existing track — so a monotonically growing gauge can advance by drawing only the thin new slice each frame instead of the cumulative wedge. Both the curved radial boundaries and the two angular edges are antialiased; the trailing edge at fromDeg uses the same feather as the previous slice's leading edge so the seam between consecutive slices stays smooth (a small overlap is harmless). The bounding box is tightened to the slice's angular span where possible. A no-op for an empty span (toDeg <= fromDeg).
- Parameters
-
Name Direction Meaning ring in The ring (center and radii); no-op when its outer radius is not past its inner one. fromDeg in Slice start angle (degrees), 0..360. toDeg in Slice end angle (degrees), 0..360; <= fromDeg fills nothing. color in RGB565 fill color, blended over the destination. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
fillAnnulusSpanAA() #
Paint a gauge ring whose lit arc starts anywhere: a dim full-ring track with a bright [startDeg, startDeg + sweepDeg] arc, in one antialiased band pass.
The general form of fillAnnulusGaugeAA (which is this span from 12 o'clock). The arc is measured clockwise from startDeg and may run on past 12 o'clock, which is what a turning segment does; its two radial edges get the same feather as the gauge's.
- Parameters
-
Name Direction Meaning ring in The ring (center and radii); no-op when its outer radius is not past its inner one. startDeg in Where the lit arc begins, degrees clockwise from 12 o'clock (wrapped to [0, 360)). sweepDeg in The lit arc's length in degrees [0, 360]; 0 = track only. trackColor in RGB565 dim full-ring color. fillColor in RGB565 bright arc color, over the track. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
fillAnnulusSweepAA() #
Draw an anti-aliased annulus sector ("pie band") swept from 12 o'clock.
Fills the area inside the annulus [rInner, rOuter] AND within the swept angle [0, sweepDeg], measured clockwise from straight up (top). Both the curved inner/outer boundaries and the radial leading edge are anti-aliased.
- Parameters
-
Name Direction Meaning ring in The ring (center and radii); no-op when its outer radius is not past its inner one. sweepDeg in Swept angle in degrees [0, 360]; 0 fills nothing. color in RGB565 fill color, blended over the destination. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
fillDiscAA() #
Draw an anti-aliased filled disc.
- Parameters
-
Name Direction Meaning cx in Center X (px). cy in Center Y (px). radius in Disc radius (px); no-op when <= 0. color in RGB565 fill color, blended over the destination at the edge. knownBg in RGB565 solid background to blend against on panels without a readable framebuffer; ignored on the read-modify-write path.
fillMarkBodyAA() #
Draw the Kleidos mark's body, its outline and its keyhole in one coverage pass.
Scans ui::knownBg. The body's ends are exact semicircles, the outline is one width all round, and every length is sub-pixel, centered on the mark's center pixel.
Color-TFT only. No-op unless available().
- Parameters
-
Name Direction Meaning shape in The mark's body and keyhole. inks in Their inks. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
fillRoundRectAA() #
Fill an anti-aliased rounded rectangle.
Straight edges are exact (full-coverage) fills; only the four corner quarter-discs are coverage-anti-aliased over the destination — the highest visible win for cards / buttons / the popup modal / text fields. Clamps the corner radius to half the shorter side.
Color-TFT only. No-op unless available(); callers fall back to the crisp display:: otherwise.
- Parameters
-
Name Direction Meaning rect in The rectangle (px); no-op when empty. radius in Corner radius (px); clamped, <= 0 falls back to a plain rect. color in RGB565 fill color, blended over the destination at corners. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
setScanClip() #
Cut every primitive's scan to a rectangle: the canvas clip.
The software clip already keeps every write inside it; this keeps the per-pixel coverage work inside it too, so a clipped draw costs what it can change, and each pixel inside comes out as an unclipped draw makes it. ui:: arms it and ui:: clears it.
- Parameters
-
Name Direction Meaning x in Left edge (px). y in Top edge (px). w in Width (px); a non-positive width scans nothing. h in Height (px); a non-positive height scans nothing.
strokeCircleAA() #
Draw an anti-aliased circle outline of a given stroke thickness.
- Parameters
-
Name Direction Meaning cx in Center X (px). cy in Center Y (px). radius in Mid-stroke radius (px); no-op when <= 0. thickness in Stroke width (px), >= 1; the band spans radius±thickness/ 2. color in RGB565 stroke color, blended over the destination. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
strokeLineAA() #
Draw an anti-aliased thick line (round-capped) via coverage/SDF.
Treats the stroke as every pixel within thickness / 2 of the segment [(x0,y0), (x1,y1)] and ramps coverage across the one-pixel edge band — the same analytic-coverage method as the disc / annulus primitives, so it unifies cleanly with the AA family. Round caps fall out of the point-to-segment distance for free. Integer / fixed-point throughout (no float in the per-pixel loop); blends over the live shadow framebuffer.
Color-TFT only. No-op unless available(); callers fall back to the crisp stacked-line primitive on e-paper / mono backends.
- Parameters
-
Name Direction Meaning x0 in Segment start X (px). y0 in Segment start Y (px). x1 in Segment end X (px). y1 in Segment end Y (px). thickness in Stroke width (px), >= 1. color in RGB565 stroke color, blended over the destination. knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).
strokeLineAAQ4() #
Draw an anti-aliased thick line (round-capped) with sub-pixel endpoints.
strokeLineAA with each endpoint in sixteenths of a pixel (a pixel's center on a whole multiple of 16), so a stroke that turns by a fraction of a pixel per frame moves by that fraction instead of jumping a whole pixel.
Color-TFT only. No-op unless available().
- Parameters
-
Name Direction Meaning x0q in Segment start X (1/16 px). y0q in Segment start Y (1/16 px). x1q in Segment end X (1/16 px). y1q in Segment end Y (1/16 px). thickness in Stroke width (px), >= 1. color in RGB565 stroke color, blended over the destination. knownBg in RGB565 solid background for the no-readback path.
strokeRoundRectAA() #
Draw an anti-aliased rounded-rectangle outline of a given thickness.
The whole contour band (all four straight edges and the four corner quarter-rings) is coverage-anti-aliased to equal weight — the stroke is the pixels whose distance to the rounded-rect contour is within thickness / 2, so every side renders at the same width with smooth corners (no off-by-one on the right / bottom edge, no jagged corner stubs). Mirrors fillRoundRectAA for outlined cards / fields / the focus box.
Color-TFT only. No-op unless available().
- Parameters
-
Name Direction Meaning rect in The rectangle the contour runs along (px); no-op when empty. radius in Corner radius (px); clamped, <= 0 falls back to a plain rect. color in RGB565 stroke color, blended over the destination. thickness in Stroke width (px), >= 1 (defaults to a 1 px contour). knownBg in RGB565 solid background for the no-readback path (ignored on the read-modify-write path).