Surface.LockHardwareCanvas Method

Definition

Gets a Canvas for drawing into this surface.

[Android.Runtime.Register("lockHardwareCanvas", "()Landroid/graphics/Canvas;", "GetLockHardwareCanvasHandler", ApiSince=23)]
public virtual Android.Graphics.Canvas? LockHardwareCanvas ();
[<Android.Runtime.Register("lockHardwareCanvas", "()Landroid/graphics/Canvas;", "GetLockHardwareCanvasHandler", ApiSince=23)>]
abstract member LockHardwareCanvas : unit -> Android.Graphics.Canvas
override this.LockHardwareCanvas : unit -> Android.Graphics.Canvas

Returns

A canvas for drawing into the surface.

Attributes

Remarks

Gets a Canvas for drawing into this surface.

After drawing into the provided Canvas, the caller must invoke #unlockCanvasAndPost to post the new contents to the surface.

Unlike #lockCanvas(Rect) this will return a hardware-accelerated canvas. See the unsupported drawing operations for a list of what is and isn't supported in a hardware-accelerated canvas. It is also required to fully cover the surface every time #lockHardwareCanvas() is called as the buffer is not preserved between frames. Partial updates are not supported.

Java documentation for android.view.Surface.lockHardwareCanvas().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to