std1.0.0-beta-7 SafeC docs

std :: gui::gui_path

Struct std::GuiPath

#include <std/gui/gui_path.h> source

struct GuiPath {
    struct Vec<struct GuiPathSeg> segs;
    float curX;
    float curY;
    float startX;
    float startY;
    int hasCurrent;
}

Fields

§struct Vec<struct GuiPathSeg> segssource
§float curXsource
§float curYsource

current point

§float startXsource
§float startYsource

start of the current subpath

§int hasCurrentsource

Methods

§static struct GuiPath new()source · definition
§void move_to(float x, float y)source · definition
§void line_to(float x, float y)source · definition
§void quad_to(float cx, float cy, float x, float y)source · definition
§void cubic_to(float c1x, float c1y, float c2x, float c2y, float x, float y)source · definition
§void close()source · definition

Closes the current subpath (a straight line back to its start).

§void arc(float cx, float cy, float r, float a0, float a1, int ccw)source · definition

Circular arc around (cx,cy) from angle a0 to a1, clockwise on screen unless 'ccw'; joined to the current point with a line (HTML canvas' arc()). Approximated with cubics (error < 0.01% of the radius).

§void arc_to(float x1, float y1, float x2, float y2, float r)source · definition

A rounded corner from the current point toward (x1,y1), then toward (x2,y2), with radius r (HTML canvas' arcTo()).

§void ellipse_arc( float cx, float cy, float rx, float ry, float rotation, float a0, float a1, int ccw, )source · definition

An elliptic arc (rotated by 'rotation') — HTML canvas' ellipse().

§void svg_arc_to( float rx, float ry, float xAxisRotation, int largeArc, int sweep, float x, float y, )source · definition

SVG's elliptical arc command from the current point to (x,y).

§void rect(float x, float y, float w, float h)source · definition

Closed shapes, each its own subpath, clockwise on screen.

§void rounded_rect(float x, float y, float w, float h, float r)source · definition
§void rounded_rect4( float x, float y, float w, float h, float tl, float tr, float br, float bl, )source · definition

Per-corner radii: top-left, top-right, bottom-right, bottom-left.

§void ellipse(float cx, float cy, float rx, float ry)source · definition
§void circle(float cx, float cy, float r)source · definition
§void polygon([]const float pts)source · definition

A closed polygon through n points (xy pairs: pts[0..2n)).

§int add_svg(const &char d)source · definition

Parses SVG path data ("M10 10 h 20 q 5 5 0 10 z ..." — every command of SVG 1.1, absolute and relative) and appends it. Returns 1, or 0 at the first malformed command (what came before it stays).

§void append(const &GuiPath other, struct GuiMatrix m)source · definition

Appends 'other' transformed by 'm'.

§void transform(struct GuiMatrix m)source · definition

Transforms every point of this path in place.

§struct GuiRect bounds() constsource · definition

Bounding box of the points (control points included: may be a bit larger than the curve).

§int is_empty() constsource · definition
§unsigned long length() constsource · definition

number of segments

§void clear()source · definition
§void drop()source · definition
§void free() consumesource · definition

= drop()