共用方式為


Surface.LockCanvas(Rect) Method

Definition

Gets a Canvas for drawing into this surface.

[Android.Runtime.Register("lockCanvas", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", "GetLockCanvas_Landroid_graphics_Rect_Handler")]
public virtual Android.Graphics.Canvas? LockCanvas (Android.Graphics.Rect? inOutDirty);
[<Android.Runtime.Register("lockCanvas", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", "GetLockCanvas_Landroid_graphics_Rect_Handler")>]
abstract member LockCanvas : Android.Graphics.Rect -> Android.Graphics.Canvas
override this.LockCanvas : Android.Graphics.Rect -> Android.Graphics.Canvas

Parameters

inOutDirty
Rect

A rectangle that represents the dirty region that the caller wants to redraw. This function may choose to expand the dirty rectangle if for example the surface has been resized or if the previous contents of the surface were not available. The caller must redraw the entire dirty region as represented by the contents of the inOutDirty rectangle upon return from this function. The caller may also pass null instead, in the case where the entire surface should be redrawn.

Returns

A canvas for drawing into the surface.

Attributes

Exceptions

If the inOutDirty rectangle is not valid.

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.

Java documentation for android.view.Surface.lockCanvas(android.graphics.Rect).

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