Microsoft DirectX 9.0 SDK Update (October 2004)

Surface.LockRectangle Method

Language:

Note: This documentation is preliminary and is subject to change.

Locks a rectangle on a surface.

Definition

Visual Basic .NET Public Function LockRectangle( _
    ByVal typeLock As Type, _
    ByVal rect As Rectangle, _
    ByVal flags As LockFlags, _
    ByRef pitch As Integer, _
    ByVal ranks() As Integer _
) As Array
C# public Array LockRectangle(
    Type typeLock,
    Rectangle rect,
    LockFlags flags,
    out int pitch,
    int[] ranks
);
Managed C++ public: Array* LockRectangle(
    Type *typeLock,
    Rectangle rect,
    LockFlags flags,
    int *pitch,
    int ranks __gc[]
);
JScript .NET public function LockRectangle(
    typeLock : Type,
    rect : Rectangle,
    flags : LockFlags,
    pitch : int,
    ranks : int[]
) : Array;

Parameters

typeLock System.Type. A Type Leave Site object that specifies the type of array to create.
rect System.Drawing.Rectangle. A Rectangle Leave Site object that represents the rectangle to lock.
flags Microsoft.DirectX.Direct3D.LockFlags. A LockFlags object that specifies the type of lock to apply.
pitch System.Int32. Integer that represents the returned pitch value of the locked region.
ranks System.Int32[]. Array of one to three Int32 Leave Site values that indicate the dimensions of the returned array. The maximum number of ranks allowed is three.

Return Value

System.Array . An Array Leave Site that describes the locked region.

Remarks

If LockFlags.DoNotWait is specified and the driver cannot lock the surface immediately, Surface.LockRectangle throws WasStillDrawingException so that an application can use the CPU cycles while waiting for the driver to lock the surface.

The only lockable format for a depth-stencil surface is Format.D16Lockable.

For performance reasons, dirty regions are recorded only for level zero of a texture. Dirty regions are automatically recorded when Surface.LockRectangle is called without LockFlags.NoDirtyUpdate or LockFlags.ReadOnly. For more information, see Device.UpdateTexture.

A multisample back buffer cannot be locked.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.

See Also


© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center