Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / PLOTTING AND CALENDARS
Canvas
A clipped coordinate-space rasterizer.
It changes logical cells and performs no terminal I/O. Empty cells remain untouched. Shapes in one layer combine their dots; later strokes own cell style.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
_ = Canvas(xBounds: CanvasBounds(min: -1, max: 1), yBounds: CanvasBounds(min: -1, max: 1)) { context in
context.line(from: CanvasPoint(x: -1, y: 0), to: CanvasPoint(x: 1, y: 0))
}Members on this page
Feature guides and release status
Canvas
struct CanvasConforms to: Widget.
A clipped coordinate-space rasterizer.
It changes logical cells and performs no terminal I/O. Empty cells remain untouched. Shapes in one layer combine their dots; later strokes own cell style.
Source · Canvas.swift:69xBounds
var xBounds: CanvasBoundsA public field of this type. Its value type and mutability are shown in the declaration.
Source · Canvas.swift:70yBounds
var yBounds: CanvasBoundsA public field of this type. Its value type and mutability are shown in the declaration.
Source · Canvas.swift:71marker
var marker: CanvasMarkerA public field of this type. Its value type and mutability are shown in the declaration.
Source · Canvas.swift:72style
var style: StyleVisual attributes used when painting this value.
Source · Canvas.swift:73paint
var paint: (inout CanvasContext) -> VoidA public field of this type. Its value type and mutability are shown in the declaration.
Source · Canvas.swift:74init(xBounds:yBounds:marker:style:paint:)
init(xBounds: CanvasBounds, yBounds: CanvasBounds, marker: CanvasMarker = .braille, style: Style = Style(), paint: @escaping (inout CanvasContext) -> Void)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (5)
xBounds- Argument type and any default are shown in the declaration; see the behavior notes above.
yBounds- Argument type and any default are shown in the declaration; see the behavior notes above.
marker- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
paint- Argument type and any default are shown in the declaration; see the behavior notes above.
render(in:buffer:)
func render(in area: Rect, buffer: inout Buffer)Paints this widget into the assigned terminal-cell rectangle. Application code owns state, input routing, and terminal lifetime.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.