SDL_!LockSurface?
NAME SYNOPSIS DESCRIPTION RETURN VALUE SEE ALSO
SDL_!LockSurface?- Lock a surface for directly access.
#include
int SDL_!LockSurface?(__SDL_Surface
SDL_!LockSurface? sets up a surface for directly accessing the pixels. Between calls to SDL_!LockSurface? and SDL_!UnlockSurface?, you can write to and read from surface-, using the pixel format stored in surface-. Once you are done accessing the surface, you should use SDL_!UnlockSurface? to release it.
Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time.
It should be noted, that since SDL 1.1.8 surface locks are recursive. This means that you can lock a surface multiple times, but each lock must have a match unlock.
.
. SDL_!LockSurface?( surface ); . /* Surface is locked / / Direct pixel access on surface here / . SDL_!LockSurface?( surface ); . / More direct pixel access on surface / . SDL_!UnlockSurface?( surface ); / Surface is still locked / / Note: Is versions
SDL_!LockSurface? returns 0, or -1 if the surface couldn't be locked.
SDL_!UnlockSurface?
One page links to SDL_LockSurface(3):