SVG-Pfad-Builder: <path d=„…“> programmatisch aufbauen. Unterstützt alle SVG-Pfadbefehle: MoveTo, LineTo, kubische und quadratische Bézier-Kurven, Bögen und ClosePath. Koordinaten können absolut (Großbuchstaben) oder relativ (Kleinbuchstaben) sein.
→ std.svg · std.svg.elements · std.svg.style
import std.svg.path;
// Pfad aufbauen
var p: SvgPath := SvgPathNew();
SvgPathMoveTo(p, 50.0, 100.0); // M 50,100
SvgPathLineTo(p, 200.0, 100.0); // L 200,100
SvgPathCubicTo(p, 250.0, 100.0, 250.0, 200.0, 200.0, 200.0); // C ...
SvgPathLineTo(p, 50.0, 200.0);
SvgPathClose(p); // Z
// Pfad ausgeben
SvgPathDraw(svg, p, "fill:lightcyan;stroke:teal;stroke-width:2");
SvgPathFree(p);
// Bogen (arc): (rx, ry, xRotation, largeArc, sweep, x, y)
var arc: SvgPath := SvgPathNew();
SvgPathMoveTo(arc, 100.0, 200.0);
SvgPathArcTo(arc, 80.0, 80.0, 0.0, false, true, 250.0, 200.0);
SvgPathDraw(svg, arc, "fill:none;stroke:red;stroke-width:2");
SvgPathFree(arc);
// Kurzform: fertigen d-String direkt ausgeben
SvgPath(svg, "M10,80 Q95,10 180,80 T350,80", "fill:none;stroke:blue;stroke-width:2");
| Signatur | Sichtbarkeit | Beschreibung |
|---|---|---|
SvgPathNew(): SvgPath | pub | Erzeugt neuen Pfad-Builder |
SvgPathMoveTo(p: SvgPath, x: f64, y: f64): void | pub | M: absolute Startposition |
SvgPathMoveToRel(p: SvgPath, dx: f64, dy: f64): void | pub | m: relative Startposition |
SvgPathLineTo(p: SvgPath, x: f64, y: f64): void | pub | L: absolute Linie |
SvgPathLineToRel(p: SvgPath, dx: f64, dy: f64): void | pub | l: relative Linie |
SvgPathHLineTo(p: SvgPath, x: f64): void | pub | H: horizontale Linie |
SvgPathVLineTo(p: SvgPath, y: f64): void | pub | V: vertikale Linie |
SvgPathCubicTo(p: SvgPath, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64): void | pub | C: kubische Bézier-Kurve |
SvgPathQuadTo(p: SvgPath, x1: f64, y1: f64, x: f64, y: f64): void | pub | Q: quadratische Bézier-Kurve |
SvgPathArcTo(p: SvgPath, rx: f64, ry: f64, xRot: f64, largeArc: bool, sweep: bool, x: f64, y: f64): void | pub | A: elliptischer Bogen |
SvgPathClose(p: SvgPath): void | pub | Z: Pfad schließen |
SvgPathDraw(svg: Svg, p: SvgPath, style: pchar): void | pub | Gibt Pfad als <path>-Element aus |
SvgPathToString(p: SvgPath): pchar | pub | Gibt d-Attribut-String zurück |
SvgPathFree(p: SvgPath): void | pub | Gibt Pfad-Ressourcen frei |
SvgPath(svg: Svg, d: pchar, style: pchar): void | pub | Gibt rohen d-String direkt als <path> aus |
Letzte Aktualisierung: 2026-05-23