.\" This manpage content is licensed under Creative Commons
.\"  Attribution 4.0 International (CC BY 4.0)
.\"   https://creativecommons.org/licenses/by/4.0/
.\" This manpage was generated from SDL's wiki page for SDL_LockTexture:
.\"   https://wiki.libsdl.org/SDL_LockTexture
.\" Generated with SDL/build-scripts/wikiheaders.pl
.\"  revision release-3.2.10-0-g877399b2b
.\" Please report issues in this manpage's content at:
.\"   https://github.com/libsdl-org/sdlwiki/issues/new
.\" Please report issues in the generation of this manpage from the wiki at:
.\"   https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20SDL_LockTexture
.\" SDL can be found at https://libsdl.org/
.de URL
\$2 \(laURL: \$1 \(ra\$3
..
.if \n[.g] .mso www.tmac
.TH SDL_LockTexture 3 "SDL 3.2.10" "Simple Directmedia Layer" "SDL3 FUNCTIONS"
.SH NAME
SDL_LockTexture \- Lock a portion of the texture for
.B write-only
pixel access\[char46]
.SH HEADER FILE
Defined in SDL3/SDL_render\[char46]h

.SH SYNOPSIS
.nf
.B #include \(dqSDL3/SDL.h\(dq
.PP
.BI "bool SDL_LockTexture(SDL_Texture *texture,
.BI "                const SDL_Rect *rect,
.BI "                void **pixels, int *pitch);
.fi
.SH DESCRIPTION
As an optimization, the pixels made available for editing don't necessarily
contain the old texture data\[char46] This is a write-only operation, and if you
need to keep a copy of the texture data you should do that at the
application level\[char46]

You must use 
.BR SDL_UnlockTexture
() to unlock the pixels
and apply any changes\[char46]

.SH FUNCTION PARAMETERS
.TP
.I texture
the texture to lock for access, which was created with 
.BR
.BR SDL_TEXTUREACCESS_STREAMING
\[char46]
.TP
.I rect
an 
.BR SDL_Rect
 structure representing the area to lock for access; NULL to lock the entire texture\[char46]
.TP
.I pixels
this is filled in with a pointer to the locked pixels, appropriately offset by the locked area\[char46]
.TP
.I pitch
this is filled in with the pitch of the locked pixels; the pitch is the length of one row in bytes\[char46]
.SH RETURN VALUE
Returns true on success or false if the texture is not valid or was
not created with

.BR
.BR SDL_TEXTUREACCESS_STREAMING
; call

.BR SDL_GetError
() for more information\[char46]

.SH THREAD SAFETY
This function should only be called on the main thread\[char46]

.SH AVAILABILITY
This function is available since SDL 3\[char46]2\[char46]0\[char46]

.SH SEE ALSO
.BR \(bu (3),
.BR SDL_LockTextureToSurface (3),
.BR \(bu (3),
.BR SDL_UnlockTexture (3)