SKGLSurfaceView.OnPaintSurface(SKPaintGLSurfaceEventArgs) Method

Definition

Implement this to draw on the canvas.

C#
protected virtual void OnPaintSurface (SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs e);

Parameters

e
SKPaintGLSurfaceEventArgs

The event arguments that contain the drawing surface and information.

Examples

C#
protected override void OnPaintSurface (SKPaintGLSurfaceEventArgs e)
{
    // call the base method
    base.OnPaintSurface (e);

    var surface = e.Surface;
    var surfaceWidth = e.BackendRenderTarget.Width;
    var surfaceHeight = e.BackendRenderTarget.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(SKPaintGLSurfaceEventArgs) method, or by attaching a handler to the PaintSurface event.

Važno

If this method is overridden, then the base must be called, otherwise the event will not be fired.

Bilješka

If a version of SkiaSharp prior to version v1.68.x is being used, then renderers are used instead of events. See SKGLSurfaceView.ISKRenderer and SetRenderer(SKGLSurfaceView+ISKRenderer).

Applies to

Proizvod Verzije
SkiaSharp Views 1.68.x, 2.80.x, 2.88.x