Android.Views.ISurfaceHolder.LockCanvas Method
Start editing the pixels in the surface.

Syntax

[Android.Runtime.Register("lockCanvas", "()Landroid/graphics/Canvas;", "GetLockCanvasHandler:Android.Views.ISurfaceHolderInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Graphics.Canvas LockCanvas ()

Returns

Documentation for this section has not yet been entered.

Remarks

Start editing the pixels in the surface. The returned Canvas can be used to draw into the surface's bitmap. A null is returned if the surface has not been created or otherwise cannot be edited. You will usually need to implement ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder) to find out when the Surface is available for use.

The content of the Surface is never preserved between unlockCanvas() and lockCanvas(), for this reason, every pixel within the Surface area must be written. The only exception to this rule is when a dirty rectangle is specified, in which case, non-dirty pixels will be preserved.

If you call this repeatedly when the Surface is not ready (before ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder) or after ISurfaceHolderCallback.SurfaceDestroyed(ISurfaceHolder)), your calls will be throttled to a slow rate in order to avoid consuming CPU.

If null is not returned, this function internally holds a lock until the corresponding ISurfaceHolder.UnlockCanvasAndPost(Android.Graphics.Canvas) call, preventing Android.Views.SurfaceView from creating, destroying, or modifying the surface while it is being drawn. This can be more convenient than accessing the Surface directly, as you do not need to do special synchronization with a drawing thread in ISurfaceHolderCallback.SurfaceDestroyed(ISurfaceHolder).

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1