This method of the DirectDrawSurface Class obtains the contents of the surface memory.
public void lock(Rect r, DDSurfaceDesc d, int flags, int hnd, byte[] memory);
r | A Rect object that identifies the region of surface that is being locked. |
d | A DDSurfaceDesc object that receives the relevant details about the surface. |
flags | One or more values of DDLOCK_ type. |
hnd | Handle of a system event that is triggered when the surface is ready to be locked. |
memory | Array variable that receives the contents of the surface memory. |
The contents of the surface memory remain valid until the corresponding the unlock method is called. Applications that change the contents must flush the changes back into system memory (use the unlock for this as well).
Your application cannot blit from a region of a surface that is locked.
Typically, lock returns immediately when a lock cannot be obtained because a blit is in progress. You can use the DDLOCK_WAIT flag if you want the method to continue trying to obtain a lock.