Synchronous clipped cell drawing inside a retained widget's paint hook. The context and optional brush are borrowed through the enclosing frame. Commands use widget-local coordinates; the frame sink applies surface translation and ancestor clipping. No I/O, allocation, model access or invalidation. Discard the frame's commands on error.
More...
#include <canvas.hpp>
|
| | Canvas (PaintContext &context, CellRect clip, const GraphemeText *brush=nullptr) noexcept |
| | Borrow a sink and optional one-cell glyph for this frame.
|
| std::expected< void, TreeError > | point (CellPoint position, CellStyle style={}) |
| | Draw a cell if it is inside the clip.
|
| std::expected< void, TreeError > | line (CellPoint first, CellPoint last, CellStyle style={}) |
| | Rasterize an inclusive DDA line, rounding ties away from zero, then clip. Only the clip's dominant-axis coordinates are visited, even for INT32_MIN/MAX endpoints.
|
Synchronous clipped cell drawing inside a retained widget's paint hook. The context and optional brush are borrowed through the enclosing frame. Commands use widget-local coordinates; the frame sink applies surface translation and ancestor clipping. No I/O, allocation, model access or invalidation. Discard the frame's commands on error.
◆ Canvas()
Borrow a sink and optional one-cell glyph for this frame.
- Parameters
-
| context | UI-owned command sink, alive through all drawing calls. |
| clip | Half-open local cell clip, intersected with every emitted command. |
| brush | Optional one-cell, one-grapheme brush alive and unchanged through frame rendering; null draws styled spaces, useful with a background color. Invalid brushes fail on drawing. |
◆ line()
Rasterize an inclusive DDA line, rounding ties away from zero, then clip. Only the clip's dominant-axis coordinates are visited, even for INT32_MIN/MAX endpoints.
- Parameters
-
| first | Starting cell coordinate; negative and offscreen values are allowed. |
| last | Ending cell coordinate, included when visible. |
| style | Owning paint value shared by all rasterized cells. |
- Returns
- Success, invalid brush, or the first sink error; earlier commands may already be submitted.
◆ point()
Draw a cell if it is inside the clip.
- Parameters
-
| position | Widget-local cell coordinate. |
| style | Owning cell paint value. |
- Returns
- Success for a clipped-out point, INVALID_ARGUMENT for an invalid brush, or the sink error.
The documentation for this class was generated from the following file: