arsa  2.7
Classes | Typedefs | Enumerations | Functions
SDL_render.h File Reference
#include "SDL_stdinc.h"
#include "SDL_rect.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Classes

struct  SDL_RendererInfo
 Information on the capabilities of a render driver or context. More...
 

Typedefs

typedef struct SDL_RendererInfo SDL_RendererInfo
 Information on the capabilities of a render driver or context. More...
 
typedef struct SDL_Renderer SDL_Renderer
 
typedef struct SDL_Texture SDL_Texture
 

Enumerations

enum  SDL_RendererFlags { SDL_RENDERER_SOFTWARE = 0x00000001, SDL_RENDERER_ACCELERATED = 0x00000002, SDL_RENDERER_PRESENTVSYNC = 0x00000004, SDL_RENDERER_TARGETTEXTURE = 0x00000008 }
 Flags used when creating a rendering context. More...
 
enum  SDL_TextureAccess { SDL_TEXTUREACCESS_STATIC, SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_TARGET }
 The access pattern allowed for a texture. More...
 
enum  SDL_TextureModulate { SDL_TEXTUREMODULATE_NONE = 0x00000000, SDL_TEXTUREMODULATE_COLOR = 0x00000001, SDL_TEXTUREMODULATE_ALPHA = 0x00000002 }
 The texture channel modulation used in SDL_RenderCopy(). More...
 
enum  SDL_RendererFlip { SDL_FLIP_NONE = 0x00000000, SDL_FLIP_HORIZONTAL = 0x00000001, SDL_FLIP_VERTICAL = 0x00000002 }
 Flip constants for SDL_RenderCopyEx. More...
 

Functions

DECLSPEC int SDLCALL SDL_GetNumRenderDrivers (void)
 Get the number of 2D rendering drivers available for the current display. More...
 
DECLSPEC int SDLCALL SDL_GetRenderDriverInfo (int index, SDL_RendererInfo *info)
 Get information about a specific 2D rendering driver for the current display. More...
 
DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer (int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
 Create a window and default renderer. More...
 
DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer (SDL_Window *window, int index, Uint32 flags)
 Create a 2D rendering context for a window. More...
 
DECLSPEC SDL_Renderer *SDLCALL SDL_CreateSoftwareRenderer (SDL_Surface *surface)
 Create a 2D software rendering context for a surface. More...
 
DECLSPEC SDL_Renderer *SDLCALL SDL_GetRenderer (SDL_Window *window)
 Get the renderer associated with a window. More...
 
DECLSPEC int SDLCALL SDL_GetRendererInfo (SDL_Renderer *renderer, SDL_RendererInfo *info)
 Get information about a rendering context. More...
 
DECLSPEC int SDLCALL SDL_GetRendererOutputSize (SDL_Renderer *renderer, int *w, int *h)
 Get the output size in pixels of a rendering context. More...
 
DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture (SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
 Create a texture for a rendering context. More...
 
DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface (SDL_Renderer *renderer, SDL_Surface *surface)
 Create a texture from an existing surface. More...
 
DECLSPEC int SDLCALL SDL_QueryTexture (SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
 Query the attributes of a texture. More...
 
DECLSPEC int SDLCALL SDL_SetTextureColorMod (SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
 Set an additional color value used in render copy operations. More...
 
DECLSPEC int SDLCALL SDL_GetTextureColorMod (SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
 Get the additional color value used in render copy operations. More...
 
DECLSPEC int SDLCALL SDL_SetTextureAlphaMod (SDL_Texture *texture, Uint8 alpha)
 Set an additional alpha value used in render copy operations. More...
 
DECLSPEC int SDLCALL SDL_GetTextureAlphaMod (SDL_Texture *texture, Uint8 *alpha)
 Get the additional alpha value used in render copy operations. More...
 
DECLSPEC int SDLCALL SDL_SetTextureBlendMode (SDL_Texture *texture, SDL_BlendMode blendMode)
 Set the blend mode used for texture copy operations. More...
 
DECLSPEC int SDLCALL SDL_GetTextureBlendMode (SDL_Texture *texture, SDL_BlendMode *blendMode)
 Get the blend mode used for texture copy operations. More...
 
DECLSPEC int SDLCALL SDL_UpdateTexture (SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
 Update the given texture rectangle with new pixel data. More...
 
DECLSPEC int SDLCALL SDL_UpdateYUVTexture (SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
 Update a rectangle within a planar YV12 or IYUV texture with new pixel data. More...
 
DECLSPEC int SDLCALL SDL_LockTexture (SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
 Lock a portion of the texture for write-only pixel access. More...
 
DECLSPEC int SDLCALL SDL_LockTextureToSurface (SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
 Lock a portion of the texture for write-only pixel access. Expose it as a SDL surface. More...
 
DECLSPEC void SDLCALL SDL_UnlockTexture (SDL_Texture *texture)
 Unlock a texture, uploading the changes to video memory, if needed. If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed. More...
 
DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported (SDL_Renderer *renderer)
 Determines whether a window supports the use of render targets. More...
 
DECLSPEC int SDLCALL SDL_SetRenderTarget (SDL_Renderer *renderer, SDL_Texture *texture)
 Set a texture as the current rendering target. More...
 
DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget (SDL_Renderer *renderer)
 Get the current render target or NULL for the default render target. More...
 
DECLSPEC int SDLCALL SDL_RenderSetLogicalSize (SDL_Renderer *renderer, int w, int h)
 Set device independent resolution for rendering. More...
 
DECLSPEC void SDLCALL SDL_RenderGetLogicalSize (SDL_Renderer *renderer, int *w, int *h)
 Get device independent resolution for rendering. More...
 
DECLSPEC int SDLCALL SDL_RenderSetIntegerScale (SDL_Renderer *renderer, SDL_bool enable)
 Set whether to force integer scales for resolution-independent rendering. More...
 
DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale (SDL_Renderer *renderer)
 Get whether integer scales are forced for resolution-independent rendering. More...
 
DECLSPEC int SDLCALL SDL_RenderSetViewport (SDL_Renderer *renderer, const SDL_Rect *rect)
 Set the drawing area for rendering on the current target. More...
 
DECLSPEC void SDLCALL SDL_RenderGetViewport (SDL_Renderer *renderer, SDL_Rect *rect)
 Get the drawing area for the current target. More...
 
DECLSPEC int SDLCALL SDL_RenderSetClipRect (SDL_Renderer *renderer, const SDL_Rect *rect)
 Set the clip rectangle for the current target. More...
 
DECLSPEC void SDLCALL SDL_RenderGetClipRect (SDL_Renderer *renderer, SDL_Rect *rect)
 Get the clip rectangle for the current target. More...
 
DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled (SDL_Renderer *renderer)
 Get whether clipping is enabled on the given renderer. More...
 
DECLSPEC int SDLCALL SDL_RenderSetScale (SDL_Renderer *renderer, float scaleX, float scaleY)
 Set the drawing scale for rendering on the current target. More...
 
DECLSPEC void SDLCALL SDL_RenderGetScale (SDL_Renderer *renderer, float *scaleX, float *scaleY)
 Get the drawing scale for the current target. More...
 
DECLSPEC int SDLCALL SDL_SetRenderDrawColor (SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Set the color used for drawing operations (Rect, Line and Clear). More...
 
DECLSPEC int SDLCALL SDL_GetRenderDrawColor (SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Get the color used for drawing operations (Rect, Line and Clear). More...
 
DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode blendMode)
 Set the blend mode used for drawing operations (Fill and Line). More...
 
DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode *blendMode)
 Get the blend mode used for drawing operations. More...
 
DECLSPEC int SDLCALL SDL_RenderClear (SDL_Renderer *renderer)
 Clear the current rendering target with the drawing color. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawPoint (SDL_Renderer *renderer, int x, int y)
 Draw a point on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawPoints (SDL_Renderer *renderer, const SDL_Point *points, int count)
 Draw multiple points on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawLine (SDL_Renderer *renderer, int x1, int y1, int x2, int y2)
 Draw a line on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawLines (SDL_Renderer *renderer, const SDL_Point *points, int count)
 Draw a series of connected lines on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawRect (SDL_Renderer *renderer, const SDL_Rect *rect)
 Draw a rectangle on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawRects (SDL_Renderer *renderer, const SDL_Rect *rects, int count)
 Draw some number of rectangles on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderFillRect (SDL_Renderer *renderer, const SDL_Rect *rect)
 Fill a rectangle on the current rendering target with the drawing color. More...
 
DECLSPEC int SDLCALL SDL_RenderFillRects (SDL_Renderer *renderer, const SDL_Rect *rects, int count)
 Fill some number of rectangles on the current rendering target with the drawing color. More...
 
DECLSPEC int SDLCALL SDL_RenderCopy (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
 Copy a portion of the texture to the current rendering target. More...
 
DECLSPEC int SDLCALL 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)
 Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawPointF (SDL_Renderer *renderer, float x, float y)
 Draw a point on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawPointsF (SDL_Renderer *renderer, const SDL_FPoint *points, int count)
 Draw multiple points on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawLineF (SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
 Draw a line on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawLinesF (SDL_Renderer *renderer, const SDL_FPoint *points, int count)
 Draw a series of connected lines on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawRectF (SDL_Renderer *renderer, const SDL_FRect *rect)
 Draw a rectangle on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderDrawRectsF (SDL_Renderer *renderer, const SDL_FRect *rects, int count)
 Draw some number of rectangles on the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderFillRectF (SDL_Renderer *renderer, const SDL_FRect *rect)
 Fill a rectangle on the current rendering target with the drawing color. More...
 
DECLSPEC int SDLCALL SDL_RenderFillRectsF (SDL_Renderer *renderer, const SDL_FRect *rects, int count)
 Fill some number of rectangles on the current rendering target with the drawing color. More...
 
DECLSPEC int SDLCALL SDL_RenderCopyF (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
 Copy a portion of the texture to the current rendering target. More...
 
DECLSPEC int SDLCALL SDL_RenderCopyExF (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
 Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center. More...
 
DECLSPEC int SDLCALL SDL_RenderReadPixels (SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
 Read pixels from the current rendering target. More...
 
DECLSPEC void SDLCALL SDL_RenderPresent (SDL_Renderer *renderer)
 Update the screen with rendering performed. More...
 
DECLSPEC void SDLCALL SDL_DestroyTexture (SDL_Texture *texture)
 Destroy the specified texture. More...
 
DECLSPEC void SDLCALL SDL_DestroyRenderer (SDL_Renderer *renderer)
 Destroy the rendering context for a window and free associated textures. More...
 
DECLSPEC int SDLCALL SDL_RenderFlush (SDL_Renderer *renderer)
 Force the rendering context to flush any pending commands to the underlying rendering API. More...
 
DECLSPEC int SDLCALL SDL_GL_BindTexture (SDL_Texture *texture, float *texw, float *texh)
 Bind the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions. More...
 
DECLSPEC int SDLCALL SDL_GL_UnbindTexture (SDL_Texture *texture)
 Unbind a texture from the current OpenGL/ES/ES2 context. More...
 
DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer (SDL_Renderer *renderer)
 Get the CAMetalLayer associated with the given Metal renderer. More...
 
DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder (SDL_Renderer *renderer)
 Get the Metal command encoder for the current frame. More...
 

Detailed Description

Header file for SDL 2D rendering functions.

This API supports the following features:

The primitives may be drawn in opaque, blended, or additive modes.

The texture images may be drawn in opaque, blended, or additive modes. They can have an additional color tint or alpha modulation applied to them, and may also be stretched with linear interpolation.

This API is designed to accelerate simple 2D operations. You may want more functionality such as polygons and particle effects and in that case you should use SDL's OpenGL/Direct3D support or one of the many good 3D engines.

These functions must be called from the main thread. See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995

Definition in file SDL_render.h.

Typedef Documentation

◆ SDL_Renderer

typedef struct SDL_Renderer SDL_Renderer

Definition at line 122 of file SDL_render.h.

◆ SDL_RendererInfo

Information on the capabilities of a render driver or context.

◆ SDL_Texture

typedef struct SDL_Texture SDL_Texture

Definition at line 128 of file SDL_render.h.

Enumeration Type Documentation

◆ SDL_RendererFlags

Flags used when creating a rendering context.

Enumerator
SDL_RENDERER_SOFTWARE 

The renderer is a software fallback

SDL_RENDERER_ACCELERATED 

The renderer uses hardware acceleration

SDL_RENDERER_PRESENTVSYNC 

Present is synchronized with the refresh rate

SDL_RENDERER_TARGETTEXTURE 

The renderer supports rendering to texture

Definition at line 64 of file SDL_render.h.

65 {
66  SDL_RENDERER_SOFTWARE = 0x00000001,
67  SDL_RENDERER_ACCELERATED = 0x00000002,
69  SDL_RENDERER_PRESENTVSYNC = 0x00000004,
71  SDL_RENDERER_TARGETTEXTURE = 0x00000008
SDL_RendererFlags
Flags used when creating a rendering context.
Definition: SDL_render.h:64

◆ SDL_RendererFlip

Flip constants for SDL_RenderCopyEx.

Enumerator
SDL_FLIP_NONE 

Do not flip

SDL_FLIP_HORIZONTAL 

flip horizontally

SDL_FLIP_VERTICAL 

flip vertically

Definition at line 111 of file SDL_render.h.

112 {
113  SDL_FLIP_NONE = 0x00000000,
114  SDL_FLIP_HORIZONTAL = 0x00000001,
115  SDL_FLIP_VERTICAL = 0x00000002
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
Definition: SDL_render.h:111

◆ SDL_TextureAccess

The access pattern allowed for a texture.

Enumerator
SDL_TEXTUREACCESS_STATIC 

Changes rarely, not lockable

SDL_TEXTUREACCESS_STREAMING 

Changes frequently, lockable

SDL_TEXTUREACCESS_TARGET 

Texture can be used as a render target

Definition at line 91 of file SDL_render.h.

◆ SDL_TextureModulate

The texture channel modulation used in SDL_RenderCopy().

Enumerator
SDL_TEXTUREMODULATE_NONE 

No modulation

SDL_TEXTUREMODULATE_COLOR 

srcC = srcC * color

SDL_TEXTUREMODULATE_ALPHA 

srcA = srcA * alpha

Definition at line 101 of file SDL_render.h.

102 {
103  SDL_TEXTUREMODULATE_NONE = 0x00000000,
104  SDL_TEXTUREMODULATE_COLOR = 0x00000001,
105  SDL_TEXTUREMODULATE_ALPHA = 0x00000002
SDL_TextureModulate
The texture channel modulation used in SDL_RenderCopy().
Definition: SDL_render.h:101

Function Documentation

◆ SDL_CreateRenderer()

DECLSPEC SDL_Renderer* SDLCALL SDL_CreateRenderer ( SDL_Window window,
int  index,
Uint32  flags 
)

Create a 2D rendering context for a window.

Parameters
windowThe window where rendering is displayed.
indexThe index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
flagsSDL_RendererFlags.
Returns
A valid rendering context or NULL if there was an error.
See also
SDL_CreateSoftwareRenderer()
SDL_GetRendererInfo()
SDL_DestroyRenderer()

◆ SDL_CreateSoftwareRenderer()

DECLSPEC SDL_Renderer* SDLCALL SDL_CreateSoftwareRenderer ( SDL_Surface surface)

Create a 2D software rendering context for a surface.

Parameters
surfaceThe surface where rendering is done.
Returns
A valid rendering context or NULL if there was an error.
See also
SDL_CreateRenderer()
SDL_DestroyRenderer()

◆ SDL_CreateTexture()

DECLSPEC SDL_Texture* SDLCALL SDL_CreateTexture ( SDL_Renderer renderer,
Uint32  format,
int  access,
int  w,
int  h 
)

Create a texture for a rendering context.

Parameters
rendererThe renderer.
formatThe format of the texture.
accessOne of the enumerated values in SDL_TextureAccess.
wThe width of the texture in pixels.
hThe height of the texture in pixels.
Returns
The created texture is returned, or NULL if no rendering context was active, the format was unsupported, or the width or height were out of range.
Note
The contents of the texture are not defined at creation.
See also
SDL_QueryTexture()
SDL_UpdateTexture()
SDL_DestroyTexture()

◆ SDL_CreateTextureFromSurface()

DECLSPEC SDL_Texture* SDLCALL SDL_CreateTextureFromSurface ( SDL_Renderer renderer,
SDL_Surface surface 
)

Create a texture from an existing surface.

Parameters
rendererThe renderer.
surfaceThe surface containing pixel data used to fill the texture.
Returns
The created texture is returned, or NULL on error.
Note
The surface is not modified or freed by this function.
See also
SDL_QueryTexture()
SDL_DestroyTexture()

◆ SDL_CreateWindowAndRenderer()

DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer ( int  width,
int  height,
Uint32  window_flags,
SDL_Window **  window,
SDL_Renderer **  renderer 
)

Create a window and default renderer.

Parameters
widthThe width of the window
heightThe height of the window
window_flagsThe flags used to create the window
windowA pointer filled with the window, or NULL on error
rendererA pointer filled with the renderer, or NULL on error
Returns
0 on success, or -1 on error

◆ SDL_DestroyRenderer()

DECLSPEC void SDLCALL SDL_DestroyRenderer ( SDL_Renderer renderer)

Destroy the rendering context for a window and free associated textures.

See also
SDL_CreateRenderer()

◆ SDL_DestroyTexture()

DECLSPEC void SDLCALL SDL_DestroyTexture ( SDL_Texture texture)

Destroy the specified texture.

See also
SDL_CreateTexture()
SDL_CreateTextureFromSurface()

◆ SDL_GetNumRenderDrivers()

DECLSPEC int SDLCALL SDL_GetNumRenderDrivers ( void  )

Get the number of 2D rendering drivers available for the current display.

A render driver is a set of code that handles rendering and texture management on a particular display. Normally there is only one, but some drivers may have several available with different capabilities.

See also
SDL_GetRenderDriverInfo()
SDL_CreateRenderer()

◆ SDL_GetRenderDrawBlendMode()

DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode ( SDL_Renderer renderer,
SDL_BlendMode blendMode 
)

Get the blend mode used for drawing operations.

Parameters
rendererThe renderer from which blend mode should be queried.
blendModeA pointer filled in with the current blend mode.
Returns
0 on success, or -1 on error
See also
SDL_SetRenderDrawBlendMode()

◆ SDL_GetRenderDrawColor()

DECLSPEC int SDLCALL SDL_GetRenderDrawColor ( SDL_Renderer renderer,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)

Get the color used for drawing operations (Rect, Line and Clear).

Parameters
rendererThe renderer from which drawing color should be queried.
rA pointer to the red value used to draw on the rendering target.
gA pointer to the green value used to draw on the rendering target.
bA pointer to the blue value used to draw on the rendering target.
aA pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).
Returns
0 on success, or -1 on error

◆ SDL_GetRenderDriverInfo()

DECLSPEC int SDLCALL SDL_GetRenderDriverInfo ( int  index,
SDL_RendererInfo info 
)

Get information about a specific 2D rendering driver for the current display.

Parameters
indexThe index of the driver to query information about.
infoA pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
Returns
0 on success, -1 if the index was out of range.
See also
SDL_CreateRenderer()

◆ SDL_GetRenderer()

DECLSPEC SDL_Renderer* SDLCALL SDL_GetRenderer ( SDL_Window window)

Get the renderer associated with a window.

◆ SDL_GetRendererInfo()

DECLSPEC int SDLCALL SDL_GetRendererInfo ( SDL_Renderer renderer,
SDL_RendererInfo info 
)

Get information about a rendering context.

◆ SDL_GetRendererOutputSize()

DECLSPEC int SDLCALL SDL_GetRendererOutputSize ( SDL_Renderer renderer,
int *  w,
int *  h 
)

Get the output size in pixels of a rendering context.

◆ SDL_GetRenderTarget()

DECLSPEC SDL_Texture* SDLCALL SDL_GetRenderTarget ( SDL_Renderer renderer)

Get the current render target or NULL for the default render target.

Returns
The current render target
See also
SDL_SetRenderTarget()

◆ SDL_GetTextureAlphaMod()

DECLSPEC int SDLCALL SDL_GetTextureAlphaMod ( SDL_Texture texture,
Uint8 alpha 
)

Get the additional alpha value used in render copy operations.

Parameters
textureThe texture to query.
alphaA pointer filled in with the current alpha value.
Returns
0 on success, or -1 if the texture is not valid.
See also
SDL_SetTextureAlphaMod()

◆ SDL_GetTextureBlendMode()

DECLSPEC int SDLCALL SDL_GetTextureBlendMode ( SDL_Texture texture,
SDL_BlendMode blendMode 
)

Get the blend mode used for texture copy operations.

Parameters
textureThe texture to query.
blendModeA pointer filled in with the current blend mode.
Returns
0 on success, or -1 if the texture is not valid.
See also
SDL_SetTextureBlendMode()

◆ SDL_GetTextureColorMod()

DECLSPEC int SDLCALL SDL_GetTextureColorMod ( SDL_Texture texture,
Uint8 r,
Uint8 g,
Uint8 b 
)

Get the additional color value used in render copy operations.

Parameters
textureThe texture to query.
rA pointer filled in with the current red color value.
gA pointer filled in with the current green color value.
bA pointer filled in with the current blue color value.
Returns
0 on success, or -1 if the texture is not valid.
See also
SDL_SetTextureColorMod()

◆ SDL_GL_BindTexture()

DECLSPEC int SDLCALL SDL_GL_BindTexture ( SDL_Texture texture,
float *  texw,
float *  texh 
)

Bind the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions.

Parameters
textureThe SDL texture to bind
texwA pointer to a float that will be filled with the texture width
texhA pointer to a float that will be filled with the texture height
Returns
0 on success, or -1 if the operation is not supported

◆ SDL_GL_UnbindTexture()

DECLSPEC int SDLCALL SDL_GL_UnbindTexture ( SDL_Texture texture)

Unbind a texture from the current OpenGL/ES/ES2 context.

Parameters
textureThe SDL texture to unbind
Returns
0 on success, or -1 if the operation is not supported

◆ SDL_LockTexture()

DECLSPEC int SDLCALL SDL_LockTexture ( SDL_Texture texture,
const SDL_Rect rect,
void **  pixels,
int *  pitch 
)

Lock a portion of the texture for write-only pixel access.

Parameters
textureThe texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
rectA pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
pixelsThis is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
pitchThis is filled in with the pitch of the locked pixels.
Returns
0 on success, or -1 if the texture is not valid or was not created with SDL_TEXTUREACCESS_STREAMING.
See also
SDL_UnlockTexture()

◆ SDL_LockTextureToSurface()

DECLSPEC int SDLCALL SDL_LockTextureToSurface ( SDL_Texture texture,
const SDL_Rect rect,
SDL_Surface **  surface 
)

Lock a portion of the texture for write-only pixel access. Expose it as a SDL surface.

Parameters
textureThe texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
rectA pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
surfaceThis is filled in with a SDL surface representing the locked area Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
Returns
0 on success, or -1 if the texture is not valid or was not created with SDL_TEXTUREACCESS_STREAMING.
See also
SDL_UnlockTexture()

◆ SDL_QueryTexture()

DECLSPEC int SDLCALL SDL_QueryTexture ( SDL_Texture texture,
Uint32 format,
int *  access,
int *  w,
int *  h 
)

Query the attributes of a texture.

Parameters
textureA texture to be queried.
formatA pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format.
accessA pointer filled in with the actual access to the texture.
wA pointer filled in with the width of the texture in pixels.
hA pointer filled in with the height of the texture in pixels.
Returns
0 on success, or -1 if the texture is not valid.

◆ SDL_RenderClear()

DECLSPEC int SDLCALL SDL_RenderClear ( SDL_Renderer renderer)

Clear the current rendering target with the drawing color.

This function clears the entire rendering target, ignoring the viewport and the clip rectangle.

Returns
0 on success, or -1 on error

◆ SDL_RenderCopy()

DECLSPEC int SDLCALL SDL_RenderCopy ( SDL_Renderer renderer,
SDL_Texture texture,
const SDL_Rect srcrect,
const SDL_Rect dstrect 
)

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

Parameters
rendererThe renderer which should copy parts of a texture.
textureThe source texture.
srcrectA pointer to the source rectangle, or NULL for the entire texture.
dstrectA pointer to the destination rectangle, or NULL for the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderCopyEx()

DECLSPEC int SDLCALL 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 
)

Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center.

Parameters
rendererThe renderer which should copy parts of a texture.
textureThe source texture.
srcrectA pointer to the source rectangle, or NULL for the entire texture.
dstrectA pointer to the destination rectangle, or NULL for the entire rendering target.
angleAn angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
centerA 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).
flipAn SDL_RendererFlip value stating which flipping actions should be performed on the texture
Returns
0 on success, or -1 on error

◆ SDL_RenderCopyExF()

DECLSPEC int SDLCALL SDL_RenderCopyExF ( SDL_Renderer renderer,
SDL_Texture texture,
const SDL_Rect srcrect,
const SDL_FRect dstrect,
const double  angle,
const SDL_FPoint center,
const SDL_RendererFlip  flip 
)

Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center.

Parameters
rendererThe renderer which should copy parts of a texture.
textureThe source texture.
srcrectA pointer to the source rectangle, or NULL for the entire texture.
dstrectA pointer to the destination rectangle, or NULL for the entire rendering target.
angleAn angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
centerA 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).
flipAn SDL_RendererFlip value stating which flipping actions should be performed on the texture
Returns
0 on success, or -1 on error

◆ SDL_RenderCopyF()

DECLSPEC int SDLCALL SDL_RenderCopyF ( SDL_Renderer renderer,
SDL_Texture texture,
const SDL_Rect srcrect,
const SDL_FRect dstrect 
)

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

Parameters
rendererThe renderer which should copy parts of a texture.
textureThe source texture.
srcrectA pointer to the source rectangle, or NULL for the entire texture.
dstrectA pointer to the destination rectangle, or NULL for the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawLine()

DECLSPEC int SDLCALL SDL_RenderDrawLine ( SDL_Renderer renderer,
int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a line on the current rendering target.

Parameters
rendererThe renderer which should draw a line.
x1The x coordinate of the start point.
y1The y coordinate of the start point.
x2The x coordinate of the end point.
y2The y coordinate of the end point.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawLineF()

DECLSPEC int SDLCALL SDL_RenderDrawLineF ( SDL_Renderer renderer,
float  x1,
float  y1,
float  x2,
float  y2 
)

Draw a line on the current rendering target.

Parameters
rendererThe renderer which should draw a line.
x1The x coordinate of the start point.
y1The y coordinate of the start point.
x2The x coordinate of the end point.
y2The y coordinate of the end point.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawLines()

DECLSPEC int SDLCALL SDL_RenderDrawLines ( SDL_Renderer renderer,
const SDL_Point points,
int  count 
)

Draw a series of connected lines on the current rendering target.

Parameters
rendererThe renderer which should draw multiple lines.
pointsThe points along the lines
countThe number of points, drawing count-1 lines
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawLinesF()

DECLSPEC int SDLCALL SDL_RenderDrawLinesF ( SDL_Renderer renderer,
const SDL_FPoint points,
int  count 
)

Draw a series of connected lines on the current rendering target.

Parameters
rendererThe renderer which should draw multiple lines.
pointsThe points along the lines
countThe number of points, drawing count-1 lines
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawPoint()

DECLSPEC int SDLCALL SDL_RenderDrawPoint ( SDL_Renderer renderer,
int  x,
int  y 
)

Draw a point on the current rendering target.

Parameters
rendererThe renderer which should draw a point.
xThe x coordinate of the point.
yThe y coordinate of the point.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawPointF()

DECLSPEC int SDLCALL SDL_RenderDrawPointF ( SDL_Renderer renderer,
float  x,
float  y 
)

Draw a point on the current rendering target.

Parameters
rendererThe renderer which should draw a point.
xThe x coordinate of the point.
yThe y coordinate of the point.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawPoints()

DECLSPEC int SDLCALL SDL_RenderDrawPoints ( SDL_Renderer renderer,
const SDL_Point points,
int  count 
)

Draw multiple points on the current rendering target.

Parameters
rendererThe renderer which should draw multiple points.
pointsThe points to draw
countThe number of points to draw
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawPointsF()

DECLSPEC int SDLCALL SDL_RenderDrawPointsF ( SDL_Renderer renderer,
const SDL_FPoint points,
int  count 
)

Draw multiple points on the current rendering target.

Parameters
rendererThe renderer which should draw multiple points.
pointsThe points to draw
countThe number of points to draw
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawRect()

DECLSPEC int SDLCALL SDL_RenderDrawRect ( SDL_Renderer renderer,
const SDL_Rect rect 
)

Draw a rectangle on the current rendering target.

Parameters
rendererThe renderer which should draw a rectangle.
rectA pointer to the destination rectangle, or NULL to outline the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawRectF()

DECLSPEC int SDLCALL SDL_RenderDrawRectF ( SDL_Renderer renderer,
const SDL_FRect rect 
)

Draw a rectangle on the current rendering target.

Parameters
rendererThe renderer which should draw a rectangle.
rectA pointer to the destination rectangle, or NULL to outline the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawRects()

DECLSPEC int SDLCALL SDL_RenderDrawRects ( SDL_Renderer renderer,
const SDL_Rect rects,
int  count 
)

Draw some number of rectangles on the current rendering target.

Parameters
rendererThe renderer which should draw multiple rectangles.
rectsA pointer to an array of destination rectangles.
countThe number of rectangles.
Returns
0 on success, or -1 on error

◆ SDL_RenderDrawRectsF()

DECLSPEC int SDLCALL SDL_RenderDrawRectsF ( SDL_Renderer renderer,
const SDL_FRect rects,
int  count 
)

Draw some number of rectangles on the current rendering target.

Parameters
rendererThe renderer which should draw multiple rectangles.
rectsA pointer to an array of destination rectangles.
countThe number of rectangles.
Returns
0 on success, or -1 on error

◆ SDL_RenderFillRect()

DECLSPEC int SDLCALL SDL_RenderFillRect ( SDL_Renderer renderer,
const SDL_Rect rect 
)

Fill a rectangle on the current rendering target with the drawing color.

Parameters
rendererThe renderer which should fill a rectangle.
rectA pointer to the destination rectangle, or NULL for the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderFillRectF()

DECLSPEC int SDLCALL SDL_RenderFillRectF ( SDL_Renderer renderer,
const SDL_FRect rect 
)

Fill a rectangle on the current rendering target with the drawing color.

Parameters
rendererThe renderer which should fill a rectangle.
rectA pointer to the destination rectangle, or NULL for the entire rendering target.
Returns
0 on success, or -1 on error

◆ SDL_RenderFillRects()

DECLSPEC int SDLCALL SDL_RenderFillRects ( SDL_Renderer renderer,
const SDL_Rect rects,
int  count 
)

Fill some number of rectangles on the current rendering target with the drawing color.

Parameters
rendererThe renderer which should fill multiple rectangles.
rectsA pointer to an array of destination rectangles.
countThe number of rectangles.
Returns
0 on success, or -1 on error

◆ SDL_RenderFillRectsF()

DECLSPEC int SDLCALL SDL_RenderFillRectsF ( SDL_Renderer renderer,
const SDL_FRect rects,
int  count 
)

Fill some number of rectangles on the current rendering target with the drawing color.

Parameters
rendererThe renderer which should fill multiple rectangles.
rectsA pointer to an array of destination rectangles.
countThe number of rectangles.
Returns
0 on success, or -1 on error

◆ SDL_RenderFlush()

DECLSPEC int SDLCALL SDL_RenderFlush ( SDL_Renderer renderer)

Force the rendering context to flush any pending commands to the underlying rendering API.

You do not need to (and in fact, shouldn't) call this function unless you are planning to call into OpenGL/Direct3D/Metal/whatever directly in addition to using an SDL_Renderer.

This is for a very-specific case: if you are using SDL's render API, you asked for a specific renderer backend (OpenGL, Direct3D, etc), you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of this applies, you should call SDL_RenderFlush() between calls to SDL's render API and the low-level API you're using in cooperation.

In all other cases, you can ignore this function. This is only here to get maximum performance out of a specific situation. In all other cases, SDL will do the right thing, perhaps at a performance loss.

This function is first available in SDL 2.0.10, and is not needed in 2.0.9 and earlier, as earlier versions did not queue rendering commands at all, instead flushing them to the OS immediately.

◆ SDL_RenderGetClipRect()

DECLSPEC void SDLCALL SDL_RenderGetClipRect ( SDL_Renderer renderer,
SDL_Rect rect 
)

Get the clip rectangle for the current target.

Parameters
rendererThe renderer from which clip rectangle should be queried.
rectA pointer filled in with the current clip rectangle, or an empty rectangle if clipping is disabled.
See also
SDL_RenderSetClipRect()

◆ SDL_RenderGetIntegerScale()

DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale ( SDL_Renderer renderer)

Get whether integer scales are forced for resolution-independent rendering.

Parameters
rendererThe renderer from which integer scaling should be queried.
See also
SDL_RenderSetIntegerScale()

◆ SDL_RenderGetLogicalSize()

DECLSPEC void SDLCALL SDL_RenderGetLogicalSize ( SDL_Renderer renderer,
int *  w,
int *  h 
)

Get device independent resolution for rendering.

Parameters
rendererThe renderer from which resolution should be queried.
wA pointer filled with the width of the logical resolution
hA pointer filled with the height of the logical resolution
See also
SDL_RenderSetLogicalSize()

◆ SDL_RenderGetMetalCommandEncoder()

DECLSPEC void* SDLCALL SDL_RenderGetMetalCommandEncoder ( SDL_Renderer renderer)

Get the Metal command encoder for the current frame.

Parameters
rendererThe renderer to query
Returns
id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
See also
SDL_RenderGetMetalLayer()

◆ SDL_RenderGetMetalLayer()

DECLSPEC void* SDLCALL SDL_RenderGetMetalLayer ( SDL_Renderer renderer)

Get the CAMetalLayer associated with the given Metal renderer.

Parameters
rendererThe renderer to query
Returns
CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
See also
SDL_RenderGetMetalCommandEncoder()

◆ SDL_RenderGetScale()

DECLSPEC void SDLCALL SDL_RenderGetScale ( SDL_Renderer renderer,
float *  scaleX,
float *  scaleY 
)

Get the drawing scale for the current target.

Parameters
rendererThe renderer from which drawing scale should be queried.
scaleXA pointer filled in with the horizontal scaling factor
scaleYA pointer filled in with the vertical scaling factor
See also
SDL_RenderSetScale()

◆ SDL_RenderGetViewport()

DECLSPEC void SDLCALL SDL_RenderGetViewport ( SDL_Renderer renderer,
SDL_Rect rect 
)

Get the drawing area for the current target.

See also
SDL_RenderSetViewport()

◆ SDL_RenderIsClipEnabled()

DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled ( SDL_Renderer renderer)

Get whether clipping is enabled on the given renderer.

Parameters
rendererThe renderer from which clip state should be queried.
See also
SDL_RenderGetClipRect()

◆ SDL_RenderPresent()

DECLSPEC void SDLCALL SDL_RenderPresent ( SDL_Renderer renderer)

Update the screen with rendering performed.

◆ SDL_RenderReadPixels()

DECLSPEC int SDLCALL SDL_RenderReadPixels ( SDL_Renderer renderer,
const SDL_Rect rect,
Uint32  format,
void pixels,
int  pitch 
)

Read pixels from the current rendering target.

Parameters
rendererThe renderer from which pixels should be read.
rectA pointer to the rectangle to read, or NULL for the entire render target.
formatThe desired format of the pixel data, or 0 to use the format of the rendering target
pixelsA pointer to be filled in with the pixel data
pitchThe pitch of the pixels parameter.
Returns
0 on success, or -1 if pixel reading is not supported.
Warning
This is a very slow operation, and should not be used frequently.

◆ SDL_RenderSetClipRect()

DECLSPEC int SDLCALL SDL_RenderSetClipRect ( SDL_Renderer renderer,
const SDL_Rect rect 
)

Set the clip rectangle for the current target.

Parameters
rendererThe renderer for which clip rectangle should be set.
rectA pointer to the rectangle to set as the clip rectangle, or NULL to disable clipping.
Returns
0 on success, or -1 on error
See also
SDL_RenderGetClipRect()

◆ SDL_RenderSetIntegerScale()

DECLSPEC int SDLCALL SDL_RenderSetIntegerScale ( SDL_Renderer renderer,
SDL_bool  enable 
)

Set whether to force integer scales for resolution-independent rendering.

Parameters
rendererThe renderer for which integer scaling should be set.
enableEnable or disable integer scaling

This function restricts the logical viewport to integer values - that is, when a resolution is between two multiples of a logical size, the viewport size is rounded down to the lower multiple.

See also
SDL_RenderSetLogicalSize()

◆ SDL_RenderSetLogicalSize()

DECLSPEC int SDLCALL SDL_RenderSetLogicalSize ( SDL_Renderer renderer,
int  w,
int  h 
)

Set device independent resolution for rendering.

Parameters
rendererThe renderer for which resolution should be set.
wThe width of the logical resolution
hThe height of the logical resolution

This function uses the viewport and scaling functionality to allow a fixed logical resolution for rendering, regardless of the actual output resolution. If the actual output resolution doesn't have the same aspect ratio the output rendering will be centered within the output display.

If the output display is a window, mouse events in the window will be filtered and scaled so they seem to arrive within the logical resolution.

Note
If this function results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints.
See also
SDL_RenderGetLogicalSize()
SDL_RenderSetScale()
SDL_RenderSetViewport()

◆ SDL_RenderSetScale()

DECLSPEC int SDLCALL SDL_RenderSetScale ( SDL_Renderer renderer,
float  scaleX,
float  scaleY 
)

Set the drawing scale for rendering on the current target.

Parameters
rendererThe renderer for which the drawing scale should be set.
scaleXThe horizontal scaling factor
scaleYThe vertical scaling factor

The drawing coordinates are scaled by the x/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.

Note
If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.
See also
SDL_RenderGetScale()
SDL_RenderSetLogicalSize()

◆ SDL_RenderSetViewport()

DECLSPEC int SDLCALL SDL_RenderSetViewport ( SDL_Renderer renderer,
const SDL_Rect rect 
)

Set the drawing area for rendering on the current target.

Parameters
rendererThe renderer for which the drawing area should be set.
rectThe rectangle representing the drawing area, or NULL to set the viewport to the entire target.

The x,y of the viewport rect represents the origin for rendering.

Returns
0 on success, or -1 on error
Note
If the window associated with the renderer is resized, the viewport is automatically reset.
See also
SDL_RenderGetViewport()
SDL_RenderSetLogicalSize()

◆ SDL_RenderTargetSupported()

DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported ( SDL_Renderer renderer)

Determines whether a window supports the use of render targets.

Parameters
rendererThe renderer that will be checked
Returns
SDL_TRUE if supported, SDL_FALSE if not.

◆ SDL_SetRenderDrawBlendMode()

DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode ( SDL_Renderer renderer,
SDL_BlendMode  blendMode 
)

Set the blend mode used for drawing operations (Fill and Line).

Parameters
rendererThe renderer for which blend mode should be set.
blendModeSDL_BlendMode to use for blending.
Returns
0 on success, or -1 on error
Note
If the blend mode is not supported, the closest supported mode is chosen.
See also
SDL_GetRenderDrawBlendMode()

◆ SDL_SetRenderDrawColor()

DECLSPEC int SDLCALL SDL_SetRenderDrawColor ( SDL_Renderer renderer,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Set the color used for drawing operations (Rect, Line and Clear).

Parameters
rendererThe renderer for which drawing color should be set.
rThe red value used to draw on the rendering target.
gThe green value used to draw on the rendering target.
bThe blue value used to draw on the rendering target.
aThe alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).
Returns
0 on success, or -1 on error

◆ SDL_SetRenderTarget()

DECLSPEC int SDLCALL SDL_SetRenderTarget ( SDL_Renderer renderer,
SDL_Texture texture 
)

Set a texture as the current rendering target.

Parameters
rendererThe renderer.
textureThe targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
Returns
0 on success, or -1 on error
See also
SDL_GetRenderTarget()

◆ SDL_SetTextureAlphaMod()

DECLSPEC int SDLCALL SDL_SetTextureAlphaMod ( SDL_Texture texture,
Uint8  alpha 
)

Set an additional alpha value used in render copy operations.

Parameters
textureThe texture to update.
alphaThe alpha value multiplied into copy operations.
Returns
0 on success, or -1 if the texture is not valid or alpha modulation is not supported.
See also
SDL_GetTextureAlphaMod()

◆ SDL_SetTextureBlendMode()

DECLSPEC int SDLCALL SDL_SetTextureBlendMode ( SDL_Texture texture,
SDL_BlendMode  blendMode 
)

Set the blend mode used for texture copy operations.

Parameters
textureThe texture to update.
blendModeSDL_BlendMode to use for texture blending.
Returns
0 on success, or -1 if the texture is not valid or the blend mode is not supported.
Note
If the blend mode is not supported, the closest supported mode is chosen.
See also
SDL_GetTextureBlendMode()

◆ SDL_SetTextureColorMod()

DECLSPEC int SDLCALL SDL_SetTextureColorMod ( SDL_Texture texture,
Uint8  r,
Uint8  g,
Uint8  b 
)

Set an additional color value used in render copy operations.

Parameters
textureThe texture to update.
rThe red color value multiplied into copy operations.
gThe green color value multiplied into copy operations.
bThe blue color value multiplied into copy operations.
Returns
0 on success, or -1 if the texture is not valid or color modulation is not supported.
See also
SDL_GetTextureColorMod()

◆ SDL_UnlockTexture()

DECLSPEC void SDLCALL SDL_UnlockTexture ( SDL_Texture texture)

Unlock a texture, uploading the changes to video memory, if needed. If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.

See also
SDL_LockTexture()
SDL_LockTextureToSurface()

◆ SDL_UpdateTexture()

DECLSPEC int SDLCALL SDL_UpdateTexture ( SDL_Texture texture,
const SDL_Rect rect,
const void pixels,
int  pitch 
)

Update the given texture rectangle with new pixel data.

Parameters
textureThe texture to update
rectA pointer to the rectangle of pixels to update, or NULL to update the entire texture.
pixelsThe raw pixel data in the format of the texture.
pitchThe number of bytes in a row of pixel data, including padding between lines.

The pixel data must be in the format of the texture. The pixel format can be queried with SDL_QueryTexture.

Returns
0 on success, or -1 if the texture is not valid.
Note
This is a fairly slow function.

◆ SDL_UpdateYUVTexture()

DECLSPEC int SDLCALL SDL_UpdateYUVTexture ( SDL_Texture texture,
const SDL_Rect rect,
const Uint8 Yplane,
int  Ypitch,
const Uint8 Uplane,
int  Upitch,
const Uint8 Vplane,
int  Vpitch 
)

Update a rectangle within a planar YV12 or IYUV texture with new pixel data.

Parameters
textureThe texture to update
rectA pointer to the rectangle of pixels to update, or NULL to update the entire texture.
YplaneThe raw pixel data for the Y plane.
YpitchThe number of bytes between rows of pixel data for the Y plane.
UplaneThe raw pixel data for the U plane.
UpitchThe number of bytes between rows of pixel data for the U plane.
VplaneThe raw pixel data for the V plane.
VpitchThe number of bytes between rows of pixel data for the V plane.
Returns
0 on success, or -1 if the texture is not valid.
Note
You can use SDL_UpdateTexture() as long as your pixel data is a contiguous block of Y and U/V planes in the proper order, but this function is available if your pixel data is not contiguous.