Function SDL_RenderReadPixels
pub unsafe extern "C" fn SDL_RenderReadPixels(
renderer: *mut SDL_Renderer,
rect: *const SDL_Rect,
) -> *mut SDL_Surface
Available on crate feature
dep_sdl3
only.Expand description
Read pixels from the current rendering target.
The returned surface should be freed with SDL_DestroySurface()
WARNING: This is a very slow operation, and should not be used
frequently. If you’re using this on the main rendering target, it should be
called after rendering and before SDL_RenderPresent()
.
§Parameters
renderer
: the rendering context.rect
: anSDL_Rect
structure representing the area in pixels relative to the to current viewport, or NULL for the entire viewport.
§Return value
Returns a new SDL_Surface
on success or NULL on failure; call
SDL_GetError()
for more information.
§Thread safety
This function should only be called on the main thread.
§Availability
This function is available since SDL 3.2.0.