Table of Contents

Method SaveSurfaceToFile

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

SaveSurfaceToFile(SKSurface, string, SKEncodedImageFormat, int)

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

public static void SaveSurfaceToFile(SKSurface surface, string filePath, SKEncodedImageFormat format = SKEncodedImageFormat.Png, int quality = 100)

Parameters

surface SKSurface

The SKSurface containing the image to save.

filePath string

The path of the file where the image will be saved. The file will be overwritten if it already exists.

format SKEncodedImageFormat

The format in which to encode the image. The default is Png.

quality int

The quality of the encoded image, ranging from 0 (lowest) to 100 (highest). This parameter is ignored for formats that do not support quality settings. The default is 100.

Remarks

This method captures the current state of the surface and encodes it into the specified image format. The resulting image is then saved to the file at filePath.