sdlRenderReadPixels function
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().
\param renderer the rendering context. \param rect an SDL_Rect structure representing the area in pixels relative to the to 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.
\threadsafety This function should only be called on the main thread.
\since This function is available since SDL 3.1.3.
extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
Implementation
Pointer<SdlSurface> sdlRenderReadPixels(
Pointer<SdlRenderer> renderer, Pointer<SdlRect> rect) {
final sdlRenderReadPixelsLookupFunction = libSdl3.lookupFunction<
Pointer<SdlSurface> Function(
Pointer<SdlRenderer> renderer, Pointer<SdlRect> rect),
Pointer<SdlSurface> Function(Pointer<SdlRenderer> renderer,
Pointer<SdlRect> rect)>('SDL_RenderReadPixels');
return sdlRenderReadPixelsLookupFunction(renderer, rect);
}