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.
Basic Shapes
Beginner Draw rectangles, circles, ovals, lines, and rounded rects on an SKCanvas. SkiaSharp Docs
using SkiaSharp;
using var surface = SKSurface.Create(
new SKImageInfo(400, 300));
SKCanvas canvas = surface.Canvas;
canvas.Clear(SKColors.White);
using var paint = new SKPaint
{ IsAntialias = true };
// Filled rectangle — indigo
paint.Style = SKPaintStyle.Fill;
paint.Color = new SKColor(79, 70, 229);
canvas.DrawRect(20, 20, 120, 80, paint);
// Stroked rectangle — red
paint.Style = SKPaintStyle.Stroke;
paint.StrokeWidth = 3;
paint.Color = new SKColor(225, 29, 72);
canvas.DrawRect(160, 20, 120, 80, paint);
// Line — green
paint.StrokeWidth = 4;
paint.Color = new SKColor(22, 163, 74);
canvas.DrawLine(20, 145, 290, 145, paint);
// Filled circle — amber
paint.Style = SKPaintStyle.Fill;
paint.Color = new SKColor(245, 158, 11);
canvas.DrawCircle(80, 225, 50, paint);
// Stroked oval — sky blue
paint.Style = SKPaintStyle.Stroke;
paint.StrokeWidth = 3;
paint.Color = new SKColor(14, 165, 233);
canvas.DrawOval(220, 225, 70, 40, paint);
// Rounded rectangle — pink
paint.Style = SKPaintStyle.Fill;
paint.Color = new SKColor(219, 39, 119);
canvas.DrawRoundRect(320, 20, 60, 50, 12, 12, paint);Key APIs
canvas.Clear(SKColors.White)— fill the backgroundcanvas.DrawRect(x, y, w, h, paint)— axis-aligned rectanglecanvas.DrawCircle(cx, cy, radius, paint)— perfect circlecanvas.DrawOval(cx, cy, rx, ry, paint)— ellipsecanvas.DrawLine(x0, y0, x1, y1, paint)— straight linecanvas.DrawRoundRect(x, y, w, h, rx, ry, paint)— rounded cornerspaint.Style—Fill,Stroke, orStrokeAndFillpaint.IsAntialias = true— smooth edges