SDL_LockSurface(3) | SDL API Reference | SDL_LockSurface(3) |
NAME
SDL_LockSurface - Lock a surface for directly access.SYNOPSIS
#include "SDL.h"DESCRIPTION
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->pixels, using the pixel format stored in surface->format. Once you are done accessing the surface, you should use SDL_UnlockSurface to release it..
.
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 < 1.1.8, the surface would have been */
/* no longer locked at this stage */
.
SDL_UnlockSurface( surface );
/* Surface is now unlocked */
.
.
RETURN VALUE
SDL_LockSurface returns 0, or -1 if the surface couldn't be locked.SEE ALSO
SDL_UnlockSurfaceTue 11 Sep 2001, 23:01 | SDL |