Module: graphics.path
Source: ./graphics/path.reef
Overview
graphics/path.reef - Vector path construction Part of reef-stdlib graphics module
Types
PathCommand (enum)
Variants:
MoveTo(float, float)LineTo(float, float)QuadTo(float, float, float, float)CubicTo(float, float, float, float, float, float)ArcTo(float, float, float, bool, bool, float, float)Close
Path
Fields:
| Name | Type |
|---|---|
commands |
[PathCommand] |
bounds |
core.Rect |
closed |
bool |
PathBuilder
Fields:
| Name | Type |
|---|---|
commands |
[PathCommand] |
current_x |
float |
current_y |
float |
start_x |
float |
start_y |
float |
min_x |
float |
min_y |
float |
max_x |
float |
max_y |
float |
has_points |
bool |
Functions
fn path_bounds(p: Path): core.Rect
fn path_empty(p: Path): bool
fn path_commands(p: Path): [PathCommand]
fn new_path(): PathBuilder
fn build(pb: PathBuilder): Path
Procedures
proc update_bounds(pb: PathBuilder, x: float, y: float)
Internal: update bounds with a point
proc move_to(pb: PathBuilder, x: float, y: float)
Move to absolute position (starts a new subpath)
proc line_to(pb: PathBuilder, x: float, y: float)
Draw line to absolute position
proc quad_to(pb: PathBuilder, cx: float, cy: float, x: float, y: float)
Draw quadratic Bezier curve to (x, y) with control point (cx, cy)
proc cubic_to(pb: PathBuilder, c1x: float, c1y: float, c2x: float, c2y: float, x: float, y: float)
Draw cubic Bezier curve to (x, y) with control points (c1x, c1y) and (c2x, c2y)
proc arc_to(pb: PathBuilder, rx: float, ry: float, rotation: float, large_arc: bool, sweep: bool, x: float, y: float)
Draw elliptical arc to (x, y) rx, ry: ellipse radii rotation: x-axis rotation in radians large_arc: if true, use the larger arc sweep: if true, draw clockwise
proc close_path(pb: PathBuilder)
Close current subpath (draw line back to start)
proc rel_move_to(pb: PathBuilder, dx: float, dy: float)
Move by relative offset
proc rel_line_to(pb: PathBuilder, dx: float, dy: float)
Draw line by relative offset
proc rel_quad_to(pb: PathBuilder, dcx: float, dcy: float, dx: float, dy: float)
Draw quadratic curve with relative offsets
proc rel_cubic_to(pb: PathBuilder, dc1x: float, dc1y: float, dc2x: float, dc2y: float, dx: float, dy: float)
Draw cubic curve with relative offsets
proc add_rect(pb: PathBuilder, r: core.Rect)
Add a rectangle to the path
proc add_rounded_rect(pb: PathBuilder, r: core.Rect, radius: float)
Add a rounded rectangle with uniform corner radius
proc add_rounded_rect_varying(pb: PathBuilder, r: core.Rect, tl: float, tr: float, br: float, bl: float)
Add a rounded rectangle with varying corner radii tl = top-left, tr = top-right, br = bottom-right, bl = bottom-left
proc add_circle(pb: PathBuilder, cx: float, cy: float, radius: float)
Add a circle to the path
proc add_ellipse(pb: PathBuilder, cx: float, cy: float, rx: float, ry: float)
Add an ellipse to the path
proc add_arc(pb: PathBuilder, cx: float, cy: float, radius: float, start_angle: float, end_angle: float)
Add a circular arc to the path
proc add_polygon(pb: PathBuilder, points: [core.Point])
Add a polygon from array of points
proc add_line(pb: PathBuilder, x1: float, y1: float, x2: float, y2: float)
Add a simple line (convenience)
Generated by reefc doc