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.
Image Filters
Intermediate Apply Gaussian blur, drop shadow, and colour-matrix filters via SKImageFilter and SKColorFilter. SKImageFilter API
using SkiaSharp;
SKCanvas canvas = /* ... */;
using var paint = new SKPaint
{
IsAntialias = true,
Color = new SKColor(79, 70, 229),
Style = SKPaintStyle.Fill,
};
// ── Gaussian blur ─────────────────────────────
paint.ImageFilter =
SKImageFilter.CreateBlur(8, 8);
canvas.DrawRect(20, 20, 120, 80, paint);
paint.ImageFilter = null;
// ── Drop shadow ───────────────────────────────
paint.ImageFilter = SKImageFilter.CreateDropShadow(
4, 4, // dx, dy offset
6, 6, // blur x, y sigma
new SKColor(0, 0, 0, 150)); // shadow color
canvas.DrawRect(180, 20, 120, 80, paint);
paint.ImageFilter = null;
// ── Colour matrix — grayscale ─────────────────
var grayscale = new float[]
{
0.21f, 0.72f, 0.07f, 0, 0,
0.21f, 0.72f, 0.07f, 0, 0,
0.21f, 0.72f, 0.07f, 0, 0,
0, 0, 0, 1, 0,
};
paint.ColorFilter =
SKColorFilter.CreateColorMatrix(grayscale);
paint.Color = new SKColor(225, 29, 72);
canvas.DrawCircle(100, 210, 55, paint);
paint.ColorFilter = null;
// ── Dilate (morphology expand) ────────────────
paint.ImageFilter =
SKImageFilter.CreateDilate(4, 4);
paint.Color = new SKColor(22, 163, 74);
canvas.DrawCircle(280, 210, 40, paint);
paint.ImageFilter = null;Key APIs
SKImageFilter.CreateBlur(sigmaX, sigmaY)— Gaussian blurSKImageFilter.CreateDropShadow(dx, dy, sx, sy, color)— drop shadowSKImageFilter.CreateDilate(rx, ry)/CreateErode— morphologySKColorFilter.CreateColorMatrix(float[20])— 4×5 colour transformSKColorFilter.CreateHighContrast(...)— accessibility filter- Set
paint.ImageFilter = nullafter each draw to reset the filter