Code

C#

Paths

IntermediateSKPath defines arbitrary shapes — triangles, Bézier curves, arcs, star polygons — drawn with a single DrawPath call. SKPath API

using SkiaSharp;

SKCanvas canvas = /* ... */;
using var paint = new SKPaint
    { IsAntialias = true, StrokeWidth = 3 };

// ── Triangle via LineTo ───────────────────────
using var triangle = new SKPath();
triangle.MoveTo(200, 20);
triangle.LineTo(360, 260);
triangle.LineTo(40,  260);
triangle.Close();                 // join back to MoveTo

paint.Style = SKPaintStyle.Stroke;
paint.Color = new SKColor(79, 70, 229);
canvas.DrawPath(triangle, paint);

// ── Cubic Bézier ─────────────────────────────
using var bezier = new SKPath();
bezier.MoveTo(20, 160);
bezier.CubicTo(100, 20, 300, 300, 380, 160);

paint.Color = new SKColor(225, 29, 72);
canvas.DrawPath(bezier, paint);

// ── Arc via AddArc ────────────────────────────
using var arc = new SKPath();
arc.AddArc(
    new SKRect(120, 80, 280, 200),
    0, 270);      // startAngle, sweepAngle in degrees

paint.Color = new SKColor(22, 163, 74);
canvas.DrawPath(arc, paint);

// ── Star polygon ──────────────────────────────
using var star = new SKPath();
for (int i = 0; i < 10; i++)
{
    float angle = i * MathF.PI / 5 - MathF.PI / 2;
    float r = i % 2 == 0 ? 50 : 22;
    float x = 320 + r * MathF.Cos(angle);
    float y = 200 + r * MathF.Sin(angle);
    if (i == 0) star.MoveTo(x, y);
    else        star.LineTo(x, y);
}
star.Close();

paint.Style = SKPaintStyle.Fill;
paint.Color = new SKColor(245, 158, 11);
canvas.DrawPath(star, paint);
Key APIs
  • path.MoveTo(x, y) — start a new contour
  • path.LineTo(x, y) — straight line segment
  • path.CubicTo(c1x, c1y, c2x, c2y, x, y) — cubic Bézier
  • path.QuadTo(cx, cy, x, y) — quadratic Bézier
  • path.ArcTo(oval, startAngle, sweepAngle, forceMove) — arc from rect
  • path.AddArc(rect, startAngle, sweepAngle) — full arc shortcut
  • path.Close() — close the contour back to the last MoveTo
  • canvas.DrawPath(path, paint) — render the path
Try in SkiaSharp Fiddle