Table of Contents

Class SkiaUtils

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

Contains static methods and properties related to SkiaSharp drawing.

public static class SkiaUtils
Inheritance
SkiaUtils

Fields

CanvasDrawPointsNative

Gets a lazily initialized delegate for the SkiaSharp canvas draw points function.

InterpolationModePaints

Contains SKPaint object used when images are painted with the specific InterpolationMode.

Properties

NativeLibraryHandle

Gets the handle to the SkiaSharp native library.

Methods

ConvertToGrayscale(Image)

Converts the specified Image to a grayscale version.

CreateBitmapCanvas(SKBitmap, float)

Creates canvas on the specified bitmap.

CreateBitmapCanvas(SKSize, float, bool)

Creates canvas on the bitmap with the specified size and scaling factor.

CreateMeasureCanvas(float)

Creates measure canvas for the specified scaling factor.

CreateSkiaGraphicsOnCanvas(SKCanvas, float)

Creates SkiaGraphics on the specified canvas with the specified scaling factor. The canvas is additionally scaled by the factor.

DrawBezier(SKCanvas, Pen, PointD, PointD, PointD, PointD)

Draws a Bezier spline defined by four PointD structures.

DrawBeziers(SKCanvas, SKPaint, ReadOnlySpan<PointD>)

Draws a series of connected cubic Bezier curves on the specified canvas.

DrawDebugTextAtCorner(SKCanvas, string, RectD)

Draws a debug text label at the bottom-left corner of the specified bounds.

DrawHelloText(SKCanvas, string?, PointD?, Font?, Color?, Color?)

Draws the specified test message on the canvas at the given location, using default styling if no parameters are provided.

DrawText(SKCanvas, ReadOnlySpan<char>, PointD, Font, Color, Color)

Draws text with the specified parameters.

GetBounds(IEnumerable<RectI>)

Gets bounds of all the rectangles in the collection.

GetFillAndStrokePaint(Pen?, Brush?)

Gets SKPaint pair for the specified brush and pen.

GetFontFamilyName(GenericFontFamily)

Gets font family name for the specified GenericFontFamily value.

GetNativeLibrarySymbol<T>(string)

Retrieves a delegate of the specified type that represents a symbol with the given name from the SkiaSharp native library.

GetPathFromPoints(ReadOnlySpan<PointD>, FillMode)

Gets SKPath from array of points and fill mode.

GraphicsCircle(SKCanvas, Pen, Brush, PointD, float)

Draws a circle on the specified SKCanvas using the provided pen, brush, center point, and radius.

IsLibraryLoaderExists()

Checks whether the type LibraryLoader exists in the SkiaSharp namespace of the loaded SkiaSharp assembly.

RecreateBitmapCanvas(ref BitmapCanvasCached?, SizeD, float, bool)

Recreates a cached bitmap canvas with the specified size, scale factor, and transparency settings.

SaveImageToDownloads(SKImage)

Saves the specified image to the user's Downloads folder with a unique filename. Image is saved in PNG format.

SaveImageToPng(SKImage, string)

Saves an SKImage instance to a file in PNG format.

SaveSurfaceToFile(SKSurface, string, SKEncodedImageFormat, int)

Saves the contents of the specified SKSurface to a file in the specified image format.

SkCanvasDrawPointsNative(nint, SKPointMode, nint, nint, nint)

Draws a series of points on the specified canvas using the given mode, points, and paint.

ToSkia(FillMode)

Converts FillMode to SKPathFillType.

ToSkiaPoints(PointF[])

Converts an array of PointF to SKPoint.