SDL Wiki
(This is the legacy documentation for stable SDL2, the current stable version; SDL3 is the current development version.)


Copy a portion of the texture to the current rendering target.

Header File

Defined in SDL_render.h


int SDL_RenderCopy(SDL_Renderer * renderer,
               SDL_Texture * texture,
               const SDL_Rect * srcrect,
               const SDL_Rect * dstrect);

Function Parameters

SDL_Renderer * renderer the rendering context.
SDL_Texture * texture the source texture.
const SDL_Rect * srcrect the source SDL_Rect structure or NULL for the entire texture.
const SDL_Rect * dstrect the destination SDL_Rect structure or NULL for the entire rendering target; the texture will be stretched to fill the given rectangle.

Return Value

(int) Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.


The texture is blended with the destination based on its blend mode set with SDL_SetTextureBlendMode().

The texture color is affected based on its color modulation set by SDL_SetTextureColorMod().

The texture alpha is affected based on its alpha modulation set by SDL_SetTextureAlphaMod().


This function is available since SDL 2.0.0.

See Also

CategoryAPI, CategoryAPIFunction, CategoryRender

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.