SKCanvasView.PaintSurface Event

Definition

Occurs when the the canvas needs to be redrawn.

public event EventHandler<SkiaSharp.Views.iOS.SKPaintSurfaceEventArgs> PaintSurface;

Event Type

Examples

myView.PaintSurface += (sender, 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.

Note

If a version of SkiaSharp prior to version v1.68.x is being used, then the DrawInSurface(SKSurface, SKImageInfo) method should be overridden instead of OnPaintSurface(SKPaintSurfaceEventArgs).

Applies to