PathBuilder:move_to
methodPathBuilder:move_to(x: number, y: number) -> PathBuilderStart a new subpath at (x, y). Returns self for chaining.
handle7 methods
A chainable path builder returned by canvas:path. Record segments with move_to / line_to / quad_to / cubic_to / close, then commit with fill or stroke.
DrawCanvas:pathThe examples on this page start from:
local color = datumhue.color
local canvas = datumhue.draw.new({ width = 320, height = 240 })
canvas:mount({ width = 320, height = 240 })
local path = canvas:path()PathBuilder:move_to(x: number, y: number) -> PathBuilderStart a new subpath at (x, y). Returns self for chaining.
PathBuilder:line_to(x: number, y: number) -> PathBuilderAdd a straight segment to (x, y). Returns self for chaining.
PathBuilder:quad_to(cx: number, cy: number, x: number, y: number) -> PathBuilderAdd a quadratic bezier through control point (cx, cy) to (x, y). Returns self.
PathBuilder:cubic_to(c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number) -> PathBuilderAdd a cubic bezier through control points (c1x, c1y) / (c2x, c2y) to (x, y). Returns self.
PathBuilder:close() -> PathBuilderClose the current subpath back to its start. Returns self.
PathBuilder:fill(options?: draw.PathFillOptions) -> DrawPrimitive?Fill the recorded path as a new primitive, and empty the builder for another path. Returns the new DrawPrimitive, or nil if the canvas is invalid.
path:move_to(-80, -60)
:line_to(80, -60)
:quad_to(0, 140, -80, -60)
:close()
path:fill({ color = color("#a7c080") })options draw.PathFillOptions options 3 keys
| Key | Type | Default | Description |
|---|---|---|---|
| color | Color | datumhue.color(1, 1, 1) | Fill / stroke color. |
| z | number | the path auto-stacks in creation order | Depth layer within the canvas. |
| material | Shader | the standard flat material | Shader material to apply. 2D surfaces take a Shader; Material handles are 3D-only. |
Extended by: draw.PathStrokeOptions
PathBuilder:stroke(options?: draw.PathStrokeOptions) -> DrawPrimitive?Stroke the recorded path as a new primitive, and empty the builder for another path. Returns the new DrawPrimitive, or nil if the canvas is invalid.
path:move_to(-120, 0):cubic_to(-60, 100, 60, -100, 120, 0)
path:stroke({ width = 4, color = color("#7fbbb3") })options draw.PathStrokeOptions options 4 keys, 3 inherited
| Key | Type | Default | Description |
|---|---|---|---|
| width | number | 2 | Stroke width in canvas units. |
| From draw.PathFillOptions | |||
| color | Color | datumhue.color(1, 1, 1) | Fill / stroke color. |
| z | number | the path auto-stacks in creation order | Depth layer within the canvas. |
| material | Shader | the standard flat material | Shader material to apply. 2D surfaces take a Shader; Material handles are 3D-only. |