Texture.LockRectangle(Type,Int32,Rectangle,LockFlags,Int32[]) Method (Microsoft.DirectX.Direct3D)

Locks a rectangle on a texture resource.

Definition

Visual Basic Public Function LockRectangle( _
    ByVal typeLock As TypeLeave Site, _
    ByVal level As Integer, _
    ByVal rect As RectangleLeave Site, _
    ByVal flags As LockFlags, _
    ByVal ranks() As Integer _
) As ArrayLeave Site
C# public ArrayLeave Site LockRectangle(
    TypeLeave Site typeLock,
    int level,
    RectangleLeave Site rect,
    LockFlags flags,
    int[] ranks
);
C++ public:
ArrayLeave SiteLockRectangle(
    TypeLeave SitetypeLock,
    int level,
    RectangleLeave Site rect,
    LockFlags flags,
    array<int>^ ranks
);
JScript public function LockRectangle(
    typeLock : TypeLeave Site,
    level : int,
    rect : RectangleLeave Site,
    flags : LockFlags,
    ranks : int[]
) : ArrayLeave Site;

Parameters

typeLock System.Type
A TypeLeave Site object that indicates the type of data to return. This can be a value type or any type that contains only value types.
level System.Int32
A level of the texture resource to lock.
rect System.Drawing.Rectangle
A RectangleLeave Site to lock. To expand the dirty region to cover the entire texture, omit this parameter.
flags Microsoft.DirectX.Direct3D.LockFlags
Zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are Discard, NoDirtyUpdate, NoSystemLock, and ReadOnly. For a description of the flags, see LockFlags.
ranks System.Int32[]
Array of one to three Int32Leave Site values that indicate the dimensions of the returning ArrayLeave Site.

Return Value

System.Array
An ArrayLeave Site object that describes the locked region.

Remarks

Textures created with Pool.Default are not lockable. Textures created in video memory are lockable when created with Usage.Dynamic. For more information about usages, see Usage.

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

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

Video memory textures cannot be locked, but must be modified by calling Device.UpdateSurface or Device.UpdateTexture. There are exceptions for some proprietary driver pixel formats that Microsoft DirectX 9.0 does not recognize. These can be locked.

See Also