Wiki Page Content


Use this function to copy a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.


int SDL_RenderCopyEx(SDL_Renderer*          renderer,
                     SDL_Texture*           texture,
                     const SDL_Rect*        srcrect,
                     const SDL_Rect*        dstrect,
                     const double           angle,
                     const SDL_Point*       center,
                     const SDL_RendererFlip flip)

Function Parameters


the rendering context


the source texture; see Remarks for details


the source SDL_Rect structure or NULL for the entire texture


the destination SDL_Rect structure or NULL for the entire rendering target


an angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction


a pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2)


a SDL_RendererFlip value stating which flipping actions should be performed on the texture

Return Value

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

Code Examples

You can add your code example here


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

CategoryAPI, CategoryRender

None: SDL_RenderCopyEx (last edited 2017-08-11 20:23:50 by Sam Lantinga)

Please include your contact information if you'd like to receive a reply.