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.
Transforms
Intermediate Translate, rotate, scale, and skew the canvas matrix — always bracket changes with Save / Restore. SKCanvas API
using SkiaSharp;
SKCanvas canvas = /* ... */;
using var paint = new SKPaint
{ IsAntialias = true, Style = SKPaintStyle.Fill };
// ── Translate ─────────────────────────────────
canvas.Save();
canvas.Translate(80, 80); // move origin
paint.Color = new SKColor(79, 70, 229);
canvas.DrawRect(-40, -40, 80, 80, paint); // centred
canvas.Restore();
// ── Rotate 45° around centre of next rect ─────
canvas.Save();
canvas.Translate(240, 80);
canvas.RotateDegrees(45); // pivot = current origin
paint.Color = new SKColor(225, 29, 72);
canvas.DrawRect(-40, -40, 80, 80, paint);
canvas.Restore();
// ── Scale ─────────────────────────────────────
canvas.Save();
canvas.Translate(80, 230);
canvas.Scale(2f, 0.75f); // stretch x, squash y
paint.Color = new SKColor(22, 163, 74);
canvas.DrawCircle(0, 0, 30, paint);
canvas.Restore();
// ── Skew ──────────────────────────────────────
canvas.Save();
canvas.Translate(290, 215);
canvas.Skew(0.45f, 0); // horizontal shear
paint.Color = new SKColor(245, 158, 11);
canvas.DrawRect(-30, -30, 80, 60, paint);
canvas.Restore();
// Tip: canvas.SetMatrix(SKMatrix.Identity)
// resets the entire transform at once.Key APIs
canvas.Save()/canvas.Restore()— push/pop the transform stackcanvas.Translate(tx, ty)— move the coordinate origincanvas.RotateDegrees(deg)/RotateRadians(rad)— rotate around the origincanvas.Scale(sx, sy)— non-uniform scalingcanvas.Skew(kx, ky)— shear the coordinate systemcanvas.SetMatrix(SKMatrix)— replace the entire transformcanvas.TotalMatrix— read the current accumulated matrix