Table of Contents

Method RecreateBitmapCanvas

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

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

cachedCanvas SkiaUtils.BitmapCanvasCached

A 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.

size SizeD

The dimensions of the bitmap canvas, specified as a SizeD structure.

scaleFactor float

The scaling factor to apply to the bitmap canvas, specified as a float value.

isTransparent bool

A 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.