Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / PLOTTING AND CALENDARS
CanvasContext
Drawing commands for a Canvas.
Coordinates are independent of terminal cell dimensions.
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.
Members on this page
Feature guides and release status
CanvasContext
struct CanvasContextDrawing commands for a Canvas.
Coordinates are independent of terminal cell dimensions.
Source · Canvas.swift:98point(at:style:)
mutating func point(at point: CanvasPoint, style: Style? = nil)Adds a dot if the finite coordinate lies inside the canvas.
Parameters (2)
at- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
points(_:style:)
mutating func points(_ points: [CanvasPoint], style: Style? = nil)Plots the supplied finite coordinates into the current layer, clipping to the visible raster.
Parameters (2)
points- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
line(from:to:style:)
mutating func line(from start: CanvasPoint, to end: CanvasPoint, style: Style? = nil)Clips crossing segments before rasterization, even when both endpoints are outside the bounds.
Parameters (3)
from- Argument type and any default are shown in the declaration; see the behavior notes above.
to- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
rectangle(origin:width:height:style:filled:)
mutating func rectangle(origin: CanvasPoint, width: Double, height: Double, style: Style? = nil, filled: Bool = false)Draws an outline or filled rectangle.
Negative sizes are accepted; zero sizes produce a line or point.
Parameters (5)
origin- Argument type and any default are shown in the declaration; see the behavior notes above.
width- Available columns in terminal cells.
height- Available rows in terminal cells.
style- Text/cell appearance.
filled- Argument type and any default are shown in the declaration; see the behavior notes above.
circle(center:radius:style:)
mutating func circle(center: CanvasPoint, radius: Double, style: Style? = nil)Draws a circle outline, sampling in proportion to the visible raster size.
Parameters (3)
center- Argument type and any default are shown in the declaration; see the behavior notes above.
radius- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
print(_:at:style:)
mutating func print(_ text: String, at point: CanvasPoint, style: Style? = nil)Flushes the current raster layer, then writes Unicode text anchored at its top-left cell.
Whole graphemes crossing the canvas or enclosing buffer clip are omitted.
Parameters (3)
text- Source text.
at- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
newLayer()
mutating func newLayer()Commits accumulated dots.
The next layer may replace glyphs and styles in the same cells.
Source · Canvas.swift:256draw(_:)
mutating func draw<S>(_ shape: S) where S : CanvasShapeDraws a custom shape into the current layer.
Parameters (1)
shape- Argument type and any default are shown in the declaration; see the behavior notes above.