Edit

SKCanvasView.OnPaintSurface(SKPaintSurfaceEventArgs) Method

Definition

Implement this to draw on the canvas.

protected virtual void OnPaintSurface(SkiaSharp.Views.Android.SKPaintSurfaceEventArgs e);

Parameters

e
SKPaintSurfaceEventArgs

The event arguments that contain the drawing surface and information.

Examples

protected override void OnPaintSurface(SKPaintSurfaceEventArgs e)
{
    // call the base method
    base.OnPaintSurface(e);

    var surface = e.Surface;
    var surfaceWidth = e.Info.Width;
    var surfaceHeight = e.Info.Height;

    var canvas = surface.Canvas;

    // draw on the canvas
    canvas.Flush();
}

Remarks

There are two ways to draw on this surface: by overriding the OnPaintSurface(SKPaintSurfaceEventArgs) method, or by attaching a handler to the PaintSurface event. If the method is overridden, then the base must be called.

Applies to