pub unsafe extern "C" fn SDL_RenderReadPixels(
renderer: *mut SDL_Renderer,
rect: *const SDL_Rect,
) -> *mut SDL_SurfaceExpand description
Read pixels from the current rendering target.
The returned surface contains pixels inside the desired area clipped to the current viewport, and should be freed with SDL_DestroySurface().
Note that this returns the actual pixels on the screen, so if you are using logical presentation you should use SDL_GetRenderLogicalPresentationRect() to get the area containing your content.
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().
Parameter: renderer the rendering context. Parameter: rect an SDL_Rect structure representing the area to read, which will be clipped to the current viewport, or NULL for the entire viewport. 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.
Available Since: This function is available since SDL 3.2.0.