Method RecreateBitmapCanvas
RecreateBitmapCanvas(ref BitmapCanvasCached?, SizeD, float, bool)
Recreates a cached bitmap canvas with the specified size, scale factor, and transparency settings.
public static void RecreateBitmapCanvas(ref SkiaUtils.BitmapCanvasCached? cachedCanvas, SizeD size, float scaleFactor, bool isTransparent = true)
Parameters
cachedCanvasSkiaUtils.BitmapCanvasCachedA reference to the cached bitmap canvas. If the canvas is null or does not match the specified parameters, it will be replaced with a new instance.
sizeSizeDThe dimensions of the bitmap canvas, specified as a SizeD structure.
scaleFactorfloatThe scaling factor to apply to the bitmap canvas, specified as a float value.
isTransparentboolA value indicating whether the bitmap canvas should support transparency. The default value is true.
Remarks
This method ensures that the cached bitmap canvas matches the specified parameters. If the existing canvas does not match, it is disposed and replaced with a new instance. The method is designed to optimize resource usage by reusing the existing canvas when possible.