Code
C#
Basic Shapes
DrawRect, DrawCircle, DrawOval, DrawLine — the core SkiaSharp drawing primitives.
Paint & Colors
SKPaint styles, stroke width, anti-alias, alpha, and dash effects.
Paths
SKPath — LineTo, CubicTo, ArcTo, star polygons, and filled shapes.
Text Rendering
DrawText with SKFont — bold/italic typefaces, stroke text, and MeasureText.
Gradients
Linear, radial, and sweep gradient shaders via SKShader.
Image Filters
Gaussian blur, drop shadow, and colour-matrix filters with SKImageFilter.
Transforms
Translate, RotateDegrees, Scale, Skew — and the Save/Restore stack.
Fiddle
Write and run SkiaSharp C# code live in the official interactive fiddle.
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 contourpath.LineTo(x, y)— straight line segmentpath.CubicTo(c1x, c1y, c2x, c2y, x, y)— cubic Bézierpath.QuadTo(cx, cy, x, y)— quadratic Bézierpath.ArcTo(oval, startAngle, sweepAngle, forceMove)— arc from rectpath.AddArc(rect, startAngle, sweepAngle)— full arc shortcutpath.Close()— close the contour back to the lastMoveTocanvas.DrawPath(path, paint)— render the path