Table of Contents

Method DrawOnLinuxCairoSurface

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

DrawOnLinuxCairoSurface(Control, Action<SKCanvas>)

Renders content on a Linux Cairo surface for the specified control using the provided drawing action. This method is intended to be used in the paint event of a control to perform custom SkiaSharp rendering.

public static bool DrawOnLinuxCairoSurface(Control control, Action<SKCanvas> action)

Parameters

control Control

The control whose surface will be used for rendering. Must be a created over a valid GTK3 native control.

action Action<SKCanvas>

An action that performs drawing operations on the SKCanvas associated with the surface.

Returns

bool

true if the operation was successful and the content was rendered; otherwise, false. Returns false if the application is not running on Linux or if the control's surface is invalid.

Remarks

This method is intended for use in Linux environments where GTK 3 and Cairo are available. It uses the control's native graphics context to create a Cairo surface and an SkiaSharp canvas for rendering. The provided action is invoked to perform the actual drawing on the SKCanvas.

Ensure that the control is properly initialized and has a valid GTK surface before calling this method.