Scroll to navigation

SDL_RenderReadPixels(3) SDL3 FUNCTIONS SDL_RenderReadPixels(3)

NAME

SDL_RenderReadPixels - Read pixels from the current rendering target.

SYNOPSIS

#include "SDL3/SDL.h"
SDL_Surface * SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect);

DESCRIPTION

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 ().

FUNCTION PARAMETERS

the rendering context
an SDL_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.

AVAILABILITY

This function is available since SDL 3.0.0.

SDL 3.1.0 SDL