Texture.LockRectangle Method ()

Locks a rectangle on a texture resource.

Overload List

public GraphicsStream LockRectangle(int, LockFlags);
public GraphicsStream LockRectangle(int, LockFlags, out int);
public GraphicsStream LockRectangle(int, Rectangle, LockFlags);
public GraphicsStream LockRectangle(int, Rectangle, LockFlags, out int);
public Array LockRectangle(Type, int, LockFlags, out int, int[]);
public Array LockRectangle(Type, int, LockFlags, int[]);
public Array LockRectangle(Type, int, Rectangle, LockFlags, out int, int[]);
public Array LockRectangle(Type, int, Rectangle, LockFlags, int[]);

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