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.
Text Rendering
Beginner Draw and measure text using SKFont and SKPaint — fill, stroke, bold, italic, and baseline alignment. SKFont API
Hello, SkiaSharp!Bold ItalicStroked Text
Measured
using SkiaSharp;
SKCanvas canvas = /* ... */;
canvas.Clear(SKColors.White);
using var paint = new SKPaint { IsAntialias = true };
// ── Default typeface, 32 pt ───────────────────
using var font = new SKFont(SKTypeface.Default, 32);
paint.Color = SKColors.DarkSlateGray;
canvas.DrawText("Hello, SkiaSharp!", 20, 60, font, paint);
// ── Bold italic typeface ──────────────────────
using var boldFont = new SKFont(
SKTypeface.FromFamilyName(
"Arial", SKFontStyle.BoldItalic),
28);
paint.Color = new SKColor(79, 70, 229);
canvas.DrawText("Bold Italic", 20, 120, boldFont, paint);
// ── Stroked text ──────────────────────────────
paint.Style = SKPaintStyle.Stroke;
paint.StrokeWidth = 1.5f;
paint.Color = new SKColor(225, 29, 72);
canvas.DrawText("Stroked Text", 20, 180, font, paint);
// ── Measure text width ────────────────────────
paint.Style = SKPaintStyle.Fill;
paint.Color = SKColors.Black;
float textWidth = font.MeasureText("Measured");
// Draw an underline the exact width of the text
canvas.DrawRect(20, 205, textWidth, 3, paint);
canvas.DrawText("Measured", 20, 240, font, paint);Key APIs
new SKFont(SKTypeface, size)— create a font at a given point sizeSKTypeface.Default— system default typefaceSKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)— specific family & stylecanvas.DrawText(text, x, y, font, paint)— draw at baseline positionfont.MeasureText(text)— advance width of a stringfont.GetGlyphWidths(text, paint)— per-glyph widthspaint.Style = Stroke— outline-only text