Method RecreateBitmapCanvas
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
measureCanvasSKCanvasA 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.
measureCanvasScalefloat?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.scaleFactorfloatThe scale factor to apply to the new canvas. This determines the resolution of the bitmap backing the canvas.
sizeSKSizeThe dimensions of the canvas, specified as an SKSize.
isTransparentboolA 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.