Table of Contents

Method RecreateBitmapCanvas

Namespace
Alternet.Skia
Assembly
Alternet.UI.Common.dll

RecreateBitmapCanvas(ref SKCanvas?, ref float?, float, SKSize, bool)

Recreates a bitmap-backed SKCanvas with the specified scale factor and size.

public static void RecreateBitmapCanvas(ref SKCanvas? measureCanvas, ref float? measureCanvasScale, float scaleFactor, SKSize size, bool isTransparent = true)

Parameters

measureCanvas SKCanvas

A reference to the SKCanvas to be recreated. If the canvas is null or the scale factor has changed, it will be replaced with a new instance.

measureCanvasScale float?

A reference to the scale factor associated with the measureCanvas. This value will be updated to match the new scale factor if the canvas is recreated.

scaleFactor float

The scale factor to apply to the new canvas. This determines the resolution of the bitmap backing the canvas.

size SKSize

The dimensions of the canvas, specified as an SKSize.

isTransparent bool

A boolean value indicating whether the canvas should have a transparent background. The default value is true.

Remarks

This method ensures that the measureCanvas is properly recreated when necessary, such as when the canvas is null or the scale factor has changed. If the canvas does not need to be recreated, the method leaves the existing canvas unchanged.