Read pixels from the current rendering target.
Defined in <SDL3/SDL_render.h>
const SDL_Rect *rect); SDL_Surface * SDL_RenderReadPixels(SDL_Renderer *renderer,
SDL_Renderer * | renderer | the rendering context. |
const SDL_Rect * | rect | an SDL_Rect structure representing the area in pixels relative to the to current viewport, or NULL for the entire viewport. |
(SDL_Surface *) Returns a new SDL_Surface on success or NULL on failure; call SDL_GetError() for more information.
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().
This function should only be called on the main thread.
This function is available since SDL 3.1.3.