Method DrawText
DrawText(SKCanvas, ReadOnlySpan<char>, SKPoint, SKFont, SKPaint, SKPaint?)
Draws the specified text on the canvas at the given location using the specified font and paint settings.
public static void DrawText(SKCanvas canvas, ReadOnlySpan<char> s, SKPoint location, SKFont font, SKPaint foreColor, SKPaint? backColor = null)
Parameters
canvasSKCanvasThe SKCanvas on which the text will be drawn. Cannot be null.
sReadOnlySpan<char>The text to draw, represented as a ReadOnlySpan<T>. If the span is empty, no text will be drawn.
locationSKPointThe SKPoint specifying the top-left corner where the text will be drawn.
fontSKFontforeColorSKPaintThe SKPaint used to define the foreground color and style of the text. Cannot be null.
backColorSKPaintAn optional SKPaint used to define the background color and style. If provided, a rectangle will be drawn behind the text. If null, no background will be drawn.
Remarks
The method measures the text using the specified font and adjusts the drawing position to account for font metrics. If a background color is provided, a rectangle is drawn behind the text to match its dimensions.