zenilib: zenilib/jni/external/sdl/SDL/SDL_render.h File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_Renderer | SDL_Renderer
typedef struct SDL_RendererInfo | SDL_RendererInfo
| Information on the capabilities of a render driver or context. More...
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_RendererFlip { SDL_FLIP_NONE = 0x00000000, SDL_FLIP_HORIZONTAL = 0x00000001, SDL_FLIP_VERTICAL = 0x00000002 }
| Flip constants for SDL_RenderCopyEx. 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...

## Functions

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_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_CreateWindowAndRenderer (int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
| Create a window and default renderer. More...
DECLSPEC void SDLCALL | SDL_DestroyRenderer (SDL_Renderer *renderer)
| Destroy the rendering context for a window and free associated textures. More...
DECLSPEC void SDLCALL | SDL_DestroyTexture (SDL_Texture *texture)
| Destroy the specified texture. More...
DECLSPEC int SDLCALL | SDL_GetNumRenderDrivers (void)
| Get the number of 2D rendering drivers available for the current display. More...
DECLSPEC int SDLCALL | SDL_GetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode *blendMode)
| Get the blend mode used for drawing operations. More...
DECLSPEC int | 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_GetRenderDriverInfo (int index, SDL_RendererInfo *info)
| Get information about a specific 2D rendering driver for the current display. 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 of a rendering context. 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_GetTextureAlphaMod (SDL_Texture *texture, Uint8 *alpha)
| Get the additional alpha value used in render 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_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_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 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_QueryTexture (SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
| Query the attributes of a texture. More...
DECLSPEC int SDLCALL | SDL_RenderClear (SDL_Renderer *renderer)
| Clear 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_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_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_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 void SDLCALL | SDL_RenderGetClipRect (SDL_Renderer *renderer, SDL_Rect *rect)
| Get the clip rectangle for the current target. More...
DECLSPEC void SDLCALL | SDL_RenderGetLogicalSize (SDL_Renderer *renderer, int *w, int *h)
| Get device independent resolution for rendering. More...
DECLSPEC void SDLCALL | SDL_RenderGetScale (SDL_Renderer *renderer, float *scaleX, float *scaleY)
| Get the drawing scale for 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 void SDLCALL | SDL_RenderPresent (SDL_Renderer *renderer)
| Update the screen with rendering performed. 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 int SDLCALL | SDL_RenderSetClipRect (SDL_Renderer *renderer, const SDL_Rect *rect)
| Set the clip rectangle for the current target. More...
DECLSPEC int SDLCALL | SDL_RenderSetLogicalSize (SDL_Renderer *renderer, int w, int h)
| Set device independent resolution for rendering. 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 int SDLCALL | SDL_RenderSetViewport (SDL_Renderer *renderer, const SDL_Rect *rect)
| Set the drawing area for rendering on the current target. 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_SetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode blendMode)
| Set the blend mode used for drawing operations (Fill and Line). More...
DECLSPEC int | 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_SetRenderTarget (SDL_Renderer *renderer, SDL_Texture *texture)
| Set a texture as the current rendering target. 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_SetTextureBlendMode (SDL_Texture *texture, SDL_BlendMode blendMode)
| Set the blend mode used for texture copy operations. 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 void SDLCALL | SDL_UnlockTexture (SDL_Texture *texture)
| Unlock a texture, uploading the changes to video memory, if needed. 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...

## Detailed Description

Header file for SDL 2D rendering functions.

This API supports the following features:

- single pixel points
- single pixel lines
- filled rectangles
- texture images

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

typedef struct SDL_Renderer SDL_Renderer

Definition at line 122 of file SDL_render.h.

typedef struct SDL_RendererInfo SDL_RendererInfo

Information on the capabilities of a render driver or context.

typedef struct SDL_Texture SDL_Texture

Definition at line 128 of file SDL_render.h.

## Enumeration Type Documentation

enum 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.

enum 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.

enum 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.

enum 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.

## Function Documentation

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

Create a 2D rendering context for a window.

Parameters

  window | The window where rendering is displayed.
  index | The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
  flags | SDL_RendererFlags.

Returns
  A valid rendering context or NULL if there was an error.

See Also
  SDL_CreateSoftwareRenderer()
  SDL_GetRendererInfo()
  SDL_DestroyRenderer()

Definition at line 204 of file SDL_render.c.

References SDL_RenderDriver::CreateRenderer, SDL_RendererInfo::flags, SDL_Renderer::hidden, SDL_Renderer::info, SDL_RenderDriver::info, SDL_Renderer::magic, SDL_RendererInfo::name, NULL, renderer_magic, SDL_Renderer::scale, SDL_AddEventWatch(), SDL_FALSE, SDL_GetHint(), SDL_GetNumRenderDrivers(), SDL_GetRenderer(), SDL_GetWindowFlags(), SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_VSYNC, SDL_LOG_CATEGORY_RENDER, SDL_LogInfo(), SDL_RENDERER_PRESENTVSYNC, SDL_RendererEventWatch(), SDL_RenderSetViewport(), SDL_SetError(), SDL_SetWindowData(), SDL_strcasecmp(), SDL_TRUE, SDL_WINDOW_HIDDEN, SDL_WINDOW_MINIMIZED, SDL_WINDOWRENDERDATA, SDL_Renderer::window, SDL_FPoint::x, and SDL_FPoint::y.

Referenced by SDL_CreateWindowAndRenderer(), SDL_CreateWindowTexture(), and SDLTest_CommonInit().

DECLSPEC SDL_Renderer* SDLCALL SDL_CreateSoftwareRenderer | ( | SDL_Surface * | surface | ) |

Create a 2D software rendering context for a surface.

Parameters

  surface | The surface where rendering is done.

Returns
  A valid rendering context or NULL if there was an error.

See Also
  SDL_CreateRenderer()
  SDL_DestroyRenderer()

Definition at line 301 of file SDL_render.c.

References SDL_Renderer::magic, NULL, renderer_magic, SDL_Renderer::scale, SDL_RenderSetViewport(), SDL_SetError(), SW_CreateRendererForSurface(), SDL_FPoint::x, and SDL_FPoint::y.

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

  renderer | The renderer.
  format | The format of the texture.
  access | One of the enumerated values in SDL_TextureAccess.
  w | The width of the texture in pixels.
  h | The height of the texture in pixels.

Returns
  The created texture is returned, or 0 if no rendering context was active, the format was unsupported, or the width or height were out of range.

See Also
  SDL_QueryTexture()
  SDL_UpdateTexture()
  SDL_DestroyTexture()

Definition at line 396 of file SDL_render.c.

References SDL_Texture::a, SDL_Texture::access, SDL_Texture::b, CHECK_RENDERER_MAGIC, SDL_Renderer::CreateTexture, SDL_Texture::format, SDL_Texture::g, GetClosestSupportedFormat(), SDL_Texture::h, SDL_Renderer::info, IsSupportedFormat(), SDL_Texture::magic, SDL_Texture::native, SDL_Texture::next, NULL, SDL_Texture::pitch, SDL_Texture::pixels, SDL_Texture::prev, SDL_Texture::r, SDL_Texture::renderer, SDL_BYTESPERPIXEL, SDL_calloc(), SDL_CreateTexture(), SDL_DestroyTexture(), SDL_ISPIXELFORMAT_FOURCC, SDL_ISPIXELFORMAT_INDEXED, SDL_OutOfMemory, SDL_SetError(), SDL_SW_CreateYUVTexture(), SDL_TEXTUREACCESS_STREAMING, SDL_RendererInfo::texture_formats, texture_magic, SDL_Renderer::textures, SDL_Texture::w, and SDL_Texture::yuv.

Referenced by SDL_CreateTexture(), SDL_CreateTextureFromSurface(), and SDL_CreateWindowTexture().

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

Create a texture from an existing surface.

Parameters

  renderer | The renderer.
  surface | The surface containing pixel data used to fill the texture.

Returns
  The created texture is returned, or 0 on error.

Note
  The surface is not modified or freed by this function.

See Also
  SDL_QueryTexture()
  SDL_DestroyTexture()

Definition at line 481 of file SDL_render.c.

References SDL_PixelFormat::Amask, CHECK_RENDERER_MAGIC, SDL_Surface::format, SDL_PixelFormat::format, SDL_Surface::h, i, SDL_Renderer::info, NULL, SDL_RendererInfo::num_texture_formats, SDL_Surface::pitch, SDL_Surface::pixels, SDL_AllocFormat(), SDL_BLENDMODE_BLEND, SDL_ConvertSurface(), SDL_CreateTexture(), SDL_DestroyTexture(), SDL_FALSE, SDL_FreeFormat(), SDL_FreeSurface(), SDL_GetColorKey(), SDL_GetSurfaceAlphaMod(), SDL_GetSurfaceBlendMode(), SDL_GetSurfaceColorMod(), SDL_ISPIXELFORMAT_ALPHA, SDL_ISPIXELFORMAT_FOURCC, SDL_LockSurface(), SDL_MUSTLOCK, SDL_SetError(), SDL_SetTextureAlphaMod(), SDL_SetTextureBlendMode(), SDL_SetTextureColorMod(), SDL_TEXTUREACCESS_STATIC, SDL_TRUE, SDL_UnlockSurface(), SDL_UpdateTexture(), SDL_RendererInfo::texture_formats, and SDL_Surface::w.

Referenced by SDLTest_DrawCharacter().

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

  width | The width of the window
  height | The height of the window
  window_flags | The flags used to create the window
  window | A pointer filled with the window, or NULL on error
  renderer | A pointer filled with the renderer, or NULL on error

Returns
  0 on success, or -1 on error

Definition at line 184 of file SDL_render.c.

References NULL, SDL_CreateRenderer(), SDL_CreateWindow(), and SDL_WINDOWPOS_UNDEFINED.

DECLSPEC void SDLCALL SDL_DestroyRenderer | ( | SDL_Renderer * | renderer | ) |

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

See Also
  SDL_CreateRenderer()

Definition at line 1832 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::DestroyRenderer, SDL_Renderer::magic, NULL, SDL_DelEventWatch(), SDL_DestroyTexture(), SDL_RendererEventWatch(), SDL_SetWindowData(), SDL_WINDOWRENDERDATA, SDL_Renderer::textures, and SDL_Renderer::window.

Referenced by SDL_CreateWindowTexture(), SDL_DestroyWindowTexture(), and SDLTest_CommonQuit().

DECLSPEC void SDLCALL SDL_DestroyTexture | ( | SDL_Texture * | texture | ) |

Destroy the specified texture.

See Also
  SDL_CreateTexture()
  SDL_CreateTextureFromSurface()

Definition at line 1797 of file SDL_render.c.

References CHECK_TEXTURE_MAGIC, SDL_Renderer::DestroyTexture, SDL_Texture::magic, SDL_Texture::native, SDL_Texture::next, NULL, SDL_Texture::pixels, SDL_Texture::prev, SDL_Texture::renderer, SDL_DestroyTexture(), SDL_free(), SDL_SetRenderTarget(), SDL_SW_DestroyYUVTexture(), SDL_Renderer::target, SDL_Renderer::textures, and SDL_Texture::yuv.

Referenced by SDL_CreateTexture(), SDL_CreateTextureFromSurface(), SDL_CreateWindowTexture(), SDL_DestroyRenderer(), SDL_DestroyTexture(), and SDL_DestroyWindowTexture().

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

Definition at line 78 of file SDL_render.c.

References SDL_arraysize.

Referenced by SDL_CreateRenderer(), SDL_CreateWindowTexture(), SDL_GetRenderDriverInfo(), and SDLTest_CommonInit().

DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode | ( | SDL_Renderer * | renderer,
|  | SDL_BlendMode * | blendMode
| ) |  |

Get the blend mode used for drawing operations.

Parameters

  renderer | The renderer from which blend mode should be queried.
  blendMode | A pointer filled in with the current blend mode.

Returns
  0 on success, or -1 on error

See Also
  SDL_SetRenderDrawBlendMode()

Definition at line 1315 of file SDL_render.c.

References SDL_Renderer::blendMode, and CHECK_RENDERER_MAGIC.

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

  renderer | The renderer from which drawing color should be queried.
  r | A pointer to the red value used to draw on the rendering target.
  g | A pointer to the green value used to draw on the rendering target.
  b | A pointer to the blue value used to draw on the rendering target.
  a | A 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

Definition at line 1285 of file SDL_render.c.

References SDL_Renderer::a, SDL_Renderer::b, CHECK_RENDERER_MAGIC, SDL_Renderer::g, and SDL_Renderer::r.

Referenced by SDLTest_DrawCharacter().

DECLSPEC int SDLCALL SDL_GetRenderDriverInfo | ( | int | index,
|  | SDL_RendererInfo * | info
| ) |  |

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

Parameters

  index | The index of the driver to query information about.
  info | A 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()

Definition at line 88 of file SDL_render.c.

References SDL_RenderDriver::info, SDL_GetNumRenderDrivers(), and SDL_SetError().

Referenced by SDL_CreateWindowTexture(), and SDLTest_CommonInit().

DECLSPEC SDL_Renderer* SDLCALL SDL_GetRenderer | ( | SDL_Window * | window | ) |

Get the renderer associated with a window.

Definition at line 323 of file SDL_render.c.

References SDL_GetWindowData(), and SDL_WINDOWRENDERDATA.

Referenced by SDL_CreateRenderer().

DECLSPEC int SDLCALL SDL_GetRendererInfo | ( | SDL_Renderer * | renderer,
|  | SDL_RendererInfo * | info
| ) |  |

Get information about a rendering context.

Definition at line 329 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, and SDL_Renderer::info.

Referenced by SDL_CreateWindowTexture(), and SDLTest_CommonInit().

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

Get the output size of a rendering context.

Definition at line 338 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::GetOutputSize, NULL, SDL_GetWindowSize(), SDL_QueryTexture(), SDL_SetError(), SDL_Renderer::target, and SDL_Renderer::window.

Referenced by SDL_RenderSetViewport(), and UpdateLogicalSize().

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

Definition at line 1101 of file SDL_render.c.

References SDL_Renderer::target.

DECLSPEC int SDLCALL SDL_GetTextureAlphaMod | ( | SDL_Texture * | texture,
|  | Uint8 * | alpha
| ) |  |

Get the additional alpha value used in render copy operations.

Parameters

  texture | The texture to query.
  alpha | A pointer filled in with the current alpha value.

Returns
  0 on success, or -1 if the texture is not valid.

See Also
  SDL_SetTextureAlphaMod()

Definition at line 652 of file SDL_render.c.

References SDL_Texture::a, and CHECK_TEXTURE_MAGIC.

DECLSPEC int SDLCALL SDL_GetTextureBlendMode | ( | SDL_Texture * | texture,
|  | SDL_BlendMode * | blendMode
| ) |  |

Get the blend mode used for texture copy operations.

Parameters

  texture | The texture to query.
  blendMode | A pointer filled in with the current blend mode.

Returns
  0 on success, or -1 if the texture is not valid.

See Also
  SDL_SetTextureBlendMode()

Definition at line 681 of file SDL_render.c.

References SDL_Texture::blendMode, and CHECK_TEXTURE_MAGIC.

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

  texture | The texture to query.
  r | A pointer filled in with the current red color value.
  g | A pointer filled in with the current green color value.
  b | A 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()

Definition at line 611 of file SDL_render.c.

References SDL_Texture::b, CHECK_TEXTURE_MAGIC, SDL_Texture::g, and SDL_Texture::r.

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

  texture | The SDL texture to bind
  texw | A pointer to a float that will be filled with the texture width
  texh | A pointer to a float that will be filled with the texture height

Returns
  0 on success, or -1 if the operation is not supported

Definition at line 1854 of file SDL_render.c.

References CHECK_TEXTURE_MAGIC, SDL_Renderer::GL_BindTexture, SDL_Texture::native, SDL_Texture::renderer, SDL_GL_BindTexture(), and SDL_Unsupported.

Referenced by SDL_GL_BindTexture().

DECLSPEC int SDLCALL SDL_GL_UnbindTexture | ( | SDL_Texture * | texture | ) |

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

Parameters

  texture | The SDL texture to unbind

Returns
  0 on success, or -1 if the operation is not supported

Definition at line 1869 of file SDL_render.c.

References CHECK_TEXTURE_MAGIC, SDL_Renderer::GL_UnbindTexture, SDL_Texture::renderer, and SDL_Unsupported.

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

  texture | The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
  rect | A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
  pixels | This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
  pitch | This 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()

Definition at line 932 of file SDL_render.c.

References SDL_Texture::access, CHECK_TEXTURE_MAGIC, SDL_Texture::h, SDL_Rect::h, SDL_Renderer::LockTexture, SDL_Texture::native, SDL_Texture::renderer, SDL_LockTextureNative(), SDL_LockTextureYUV(), SDL_SetError(), SDL_TEXTUREACCESS_STREAMING, SDL_Texture::w, SDL_Rect::w, SDL_Rect::x, SDL_Rect::y, and SDL_Texture::yuv.

Referenced by SDL_UnlockTextureNative(), SDL_UnlockTextureYUV(), SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), and SDL_UpdateTextureYUVPlanar().

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

Query the attributes of a texture.

Parameters

  texture | A texture to be queried.
  format | A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format.
  access | A pointer filled in with the actual access to the texture.
  w | A pointer filled in with the width of the texture in pixels.
  h | A pointer filled in with the height of the texture in pixels.

Returns
  0 on success, or -1 if the texture is not valid.

Definition at line 565 of file SDL_render.c.

References SDL_Texture::access, CHECK_TEXTURE_MAGIC, SDL_Texture::format, SDL_Texture::h, and SDL_Texture::w.

Referenced by SDL_GetRendererOutputSize().

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.

Returns
  0 on success, or -1 on error

Definition at line 1324 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::hidden, and SDL_Renderer::RenderClear.

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

  renderer | The renderer which should copy parts of a texture.
  texture | The source texture.
  srcrect | A pointer to the source rectangle, or NULL for the entire texture.
  dstrect | A pointer to the destination rectangle, or NULL for the entire rendering target.

Returns
  0 on success, or -1 on error

Definition at line 1634 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, CHECK_TEXTURE_MAGIC, SDL_FRect::h, SDL_Texture::h, SDL_Rect::h, SDL_Renderer::hidden, SDL_Texture::native, SDL_Renderer::RenderCopy, SDL_Texture::renderer, SDL_Renderer::scale, SDL_HasIntersection(), SDL_IntersectRect(), SDL_RenderGetViewport(), SDL_SetError(), SDL_FRect::w, SDL_Texture::w, SDL_Rect::w, SDL_FPoint::x, SDL_FRect::x, SDL_Rect::x, SDL_FPoint::y, SDL_FRect::y, and SDL_Rect::y.

Referenced by SDL_UpdateWindowTexture(), and SDLTest_DrawCharacter().

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

  renderer | The renderer which should copy parts of a texture.
  texture | The source texture.
  srcrect | A pointer to the source rectangle, or NULL for the entire texture.
  dstrect | A pointer to the destination rectangle, or NULL for the entire rendering target.
  angle | An angle in degrees that indicates the rotation that will be applied to dstrect
  center | A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
  flip | An SDL_RendererFlip value stating which flipping actions should be performed on the texture

Returns
  0 on success, or -1 on error

Definition at line 1687 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, CHECK_TEXTURE_MAGIC, SDL_FRect::h, SDL_Texture::h, SDL_Rect::h, SDL_Texture::native, SDL_Renderer::RenderCopyEx, SDL_Texture::renderer, SDL_Renderer::scale, SDL_IntersectRect(), SDL_RenderGetViewport(), SDL_SetError(), SDL_FRect::w, SDL_Texture::w, SDL_Rect::w, SDL_FPoint::x, SDL_FRect::x, SDL_Point::x, SDL_Rect::x, SDL_FPoint::y, SDL_FRect::y, SDL_Point::y, and SDL_Rect::y.

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

  renderer | The renderer which should draw a line.
  x1 | The x coordinate of the start point.
  y1 | The y coordinate of the start point.
  x2 | The x coordinate of the end point.
  y2 | The y coordinate of the end point.

Returns
  0 on success, or -1 on error

Definition at line 1413 of file SDL_render.c.

References SDL_RenderDrawLines(), SDL_Point::x, and SDL_Point::y.

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

  renderer | The renderer which should draw multiple lines.
  points | The points along the lines
  count | The number of points, drawing count-1 lines

Returns
  0 on success, or -1 on error

Definition at line 1481 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::hidden, i, SDL_Renderer::RenderDrawLines, RenderDrawLinesWithRects(), SDL_Renderer::scale, SDL_OutOfMemory, SDL_SetError(), SDL_stack_alloc, SDL_stack_free, SDL_FPoint::x, SDL_Point::x, SDL_FPoint::y, and SDL_Point::y.

Referenced by SDL_RenderDrawLine(), and SDL_RenderDrawRect().

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

Draw a point on the current rendering target.

Parameters

  renderer | The renderer which should draw a point.
  x | The x coordinate of the point.
  y | The y coordinate of the point.

Returns
  0 on success, or -1 on error

Definition at line 1336 of file SDL_render.c.

References SDL_RenderDrawPoints(), SDL_Point::x, and SDL_Point::y.

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

Draw multiple points on the current rendering target.

Parameters

  renderer | The renderer which should draw multiple points.
  points | The points to draw
  count | The number of points to draw

Returns
  0 on success, or -1 on error

Definition at line 1372 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::hidden, i, SDL_Renderer::RenderDrawPoints, RenderDrawPointsWithRects(), SDL_Renderer::scale, SDL_OutOfMemory, SDL_SetError(), SDL_stack_alloc, SDL_stack_free, SDL_FPoint::x, SDL_Point::x, SDL_FPoint::y, and SDL_Point::y.

Referenced by SDL_RenderDrawPoint().

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

Draw a rectangle on the current rendering target.

Parameters

  renderer | The renderer which should draw a rectangle.
  rect | A pointer to the destination rectangle, or NULL to outline the entire rendering target.

Returns
  0 on success, or -1 on error

Definition at line 1522 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Rect::h, SDL_RenderDrawLines(), SDL_RenderGetViewport(), SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.

Referenced by 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

  renderer | The renderer which should draw multiple rectangles.
  rects | A pointer to an array of destination rectangles.
  count | The number of rectangles.

Returns
  0 on success, or -1 on error

Definition at line 1551 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::hidden, i, SDL_RenderDrawRect(), and SDL_SetError().

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

  renderer | The renderer which should fill a rectangle.
  rect | A pointer to the destination rectangle, or NULL for the entire rendering target.

Returns
  0 on success, or -1 on error

Definition at line 1578 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_RenderFillRects(), SDL_RenderGetViewport(), SDL_Rect::x, and SDL_Rect::y.

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

  renderer | The renderer which should fill multiple rectangles.
  rects | A pointer to an array of destination rectangles.
  count | The number of rectangles.

Returns
  0 on success, or -1 on error

Definition at line 1595 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_FRect::h, SDL_Rect::h, SDL_Renderer::hidden, i, SDL_Renderer::RenderFillRects, SDL_Renderer::scale, SDL_OutOfMemory, SDL_SetError(), SDL_stack_alloc, SDL_stack_free, SDL_FRect::w, SDL_Rect::w, SDL_FPoint::x, SDL_FRect::x, SDL_Rect::x, SDL_FPoint::y, SDL_FRect::y, and SDL_Rect::y.

Referenced by SDL_RenderFillRect().

DECLSPEC void SDLCALL SDL_RenderGetClipRect | ( | SDL_Renderer * | renderer,
|  | SDL_Rect * | rect
| ) |  |

Get the clip rectangle for the current target.

Parameters

  renderer | The renderer from which clip rectangle should be queried.
  rect | A pointer filled in with the current clip rectangle, or an empty rectangle if clipping is disabled.

See Also
  SDL_RenderSetClipRect()

Definition at line 1236 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::clip_rect, SDL_Rect::h, int, SDL_Renderer::scale, SDL_Rect::w, SDL_FPoint::x, SDL_Rect::x, SDL_FPoint::y, and SDL_Rect::y.

Referenced by SDLTest_CommonEvent().

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

Get device independent resolution for rendering.

Parameters

  renderer | The renderer from which resolution should be queried.
  w | A pointer filled with the width of the logical resolution
  h | A pointer filled with the height of the logical resolution

See Also
  SDL_RenderSetLogicalSize()

Definition at line 1174 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::logical_h, and SDL_Renderer::logical_w.

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

Get the drawing scale for the current target.

Parameters

  renderer | The renderer from which drawing scale should be queried.
  scaleX | A pointer filled in with the horizontal scaling factor
  scaleY | A pointer filled in with the vertical scaling factor

See Also
  SDL_RenderSetScale()

Definition at line 1259 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::scale, SDL_FPoint::x, and SDL_FPoint::y.

DECLSPEC void SDLCALL SDL_RenderGetViewport | ( | SDL_Renderer * | renderer,
|  | SDL_Rect * | rect
| ) |  |

Get the drawing area for the current target.

See Also
  SDL_RenderSetViewport()

Definition at line 1207 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Rect::h, int, SDL_Renderer::scale, SDL_Renderer::viewport, SDL_Rect::w, SDL_FPoint::x, SDL_Rect::x, SDL_FPoint::y, and SDL_Rect::y.

Referenced by SDL_RenderCopy(), SDL_RenderCopyEx(), SDL_RenderDrawRect(), SDL_RenderFillRect(), and SDLTest_ScreenShot().

DECLSPEC void SDLCALL SDL_RenderPresent | ( | SDL_Renderer * | renderer | ) |

Update the screen with rendering performed.

Definition at line 1785 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::hidden, and SDL_Renderer::RenderPresent.

Referenced by SDL_UpdateWindowTexture().

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

  renderer | The renderer from which pixels should be read.
  rect | A pointer to the rectangle to read, or NULL for the entire render target.
  format | The desired format of the pixel data, or 0 to use the format of the rendering target
  pixels | A pointer to be filled in with the pixel data
  pitch | The 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.

Definition at line 1748 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Rect::h, SDL_Renderer::RenderReadPixels, SDL_BYTESPERPIXEL, SDL_GetWindowPixelFormat(), SDL_IntersectRect(), SDL_Unsupported, SDL_Renderer::viewport, SDL_Rect::w, SDL_Renderer::window, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDLTest_ScreenShot().

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

Set the clip rectangle for the current target.

Parameters

  renderer | The renderer for which clip rectangle should be set.
  rect | A 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()

Definition at line 1220 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::clip_rect, SDL_Rect::h, int, SDL_Renderer::scale, SDL_ceil(), SDL_floor(), SDL_zero, SDL_Renderer::UpdateClipRect, SDL_Rect::w, SDL_FPoint::x, SDL_Rect::x, SDL_FPoint::y, and SDL_Rect::y.

Referenced by SDLTest_CommonEvent().

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

Set device independent resolution for rendering.

Parameters

  renderer | The renderer for which resolution should be set.
  w | The width of the logical resolution
  h | The 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()

Definition at line 1154 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::logical_h, SDL_Renderer::logical_w, NULL, SDL_RenderSetScale(), SDL_RenderSetViewport(), and UpdateLogicalSize().

Referenced by SDLTest_CommonInit().

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

Set the drawing scale for rendering on the current target.

Parameters

  renderer | The renderer for which the drawing scale should be set.
  scaleX | The horizontal scaling factor
  scaleY | The 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()

Definition at line 1249 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Renderer::scale, SDL_FPoint::x, and SDL_FPoint::y.

Referenced by SDL_RenderSetLogicalSize(), SDLTest_CommonInit(), and UpdateLogicalSize().

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

Set the drawing area for rendering on the current target.

Parameters

  renderer | The renderer for which the drawing area should be set.
  rect | The 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()

Definition at line 1187 of file SDL_render.c.

References CHECK_RENDERER_MAGIC, SDL_Rect::h, int, SDL_Renderer::scale, SDL_ceil(), SDL_floor(), SDL_GetRendererOutputSize(), SDL_Renderer::UpdateViewport, SDL_Renderer::viewport, SDL_Rect::w, SDL_FPoint::x, SDL_Rect::x, SDL_FPoint::y, and SDL_Rect::y.

Referenced by SDL_CreateRenderer(), SDL_CreateSoftwareRenderer(), SDL_CreateWindowTexture(), SDL_RenderSetLogicalSize(), and UpdateLogicalSize().

DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported | ( | SDL_Renderer * | renderer | ) |

Determines whether a window supports the use of render targets.

Parameters

  renderer | The renderer that will be checked

Returns
  SDL_TRUE if supported, SDL_FALSE if not.

Definition at line 1025 of file SDL_render.c.

References SDL_RendererInfo::flags, SDL_Renderer::info, SDL_FALSE, SDL_RENDERER_TARGETTEXTURE, and SDL_Renderer::SetRenderTarget.

Referenced by SDL_SetRenderTarget().

DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode | ( | SDL_Renderer * | renderer,
|  | SDL_BlendMode | blendMode
| ) |  |

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

Parameters

  renderer | The renderer for which blend mode should be set.
  blendMode | SDL_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()

Definition at line 1306 of file SDL_render.c.

References SDL_Renderer::blendMode, and CHECK_RENDERER_MAGIC.

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

  renderer | The renderer for which drawing color should be set.
  r | The red value used to draw on the rendering target.
  g | The green value used to draw on the rendering target.
  b | The blue value used to draw on the rendering target.
  a | The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).

Returns
  0 on success, or -1 on error

Definition at line 1272 of file SDL_render.c.

References SDL_Renderer::a, SDL_Renderer::b, CHECK_RENDERER_MAGIC, SDL_Renderer::g, and SDL_Renderer::r.

DECLSPEC int SDLCALL SDL_SetRenderTarget | ( | SDL_Renderer * | renderer,
|  | SDL_Texture * | texture
| ) |  |

Set a texture as the current rendering target.

Parameters

  renderer | The renderer.
  texture | The 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()

Definition at line 1034 of file SDL_render.c.

References SDL_Texture::access, CHECK_TEXTURE_MAGIC, SDL_Renderer::clip_rect, SDL_Renderer::clip_rect_backup, SDL_Texture::h, SDL_Rect::h, SDL_Renderer::logical_h, SDL_Renderer::logical_h_backup, SDL_Renderer::logical_w, SDL_Renderer::logical_w_backup, SDL_Texture::native, SDL_Texture::renderer, SDL_Renderer::scale, SDL_Renderer::scale_backup, SDL_RenderTargetSupported(), SDL_SetError(), SDL_TEXTUREACCESS_TARGET, SDL_Unsupported, SDL_Renderer::SetRenderTarget, SDL_Renderer::target, SDL_Renderer::UpdateClipRect, SDL_Renderer::UpdateViewport, SDL_Renderer::viewport, SDL_Renderer::viewport_backup, SDL_Texture::w, SDL_Rect::w, SDL_FPoint::x, SDL_Rect::x, SDL_FPoint::y, and SDL_Rect::y.

Referenced by SDL_DestroyTexture().

DECLSPEC int SDLCALL SDL_SetTextureAlphaMod | ( | SDL_Texture * | texture,
|  | Uint8 | alpha
| ) |  |

Set an additional alpha value used in render copy operations.

Parameters

  texture | The texture to update.
  alpha | The 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()

Definition at line 629 of file SDL_render.c.

References SDL_Texture::a, CHECK_TEXTURE_MAGIC, SDL_Texture::modMode, SDL_Texture::native, SDL_Texture::renderer, SDL_SetTextureAlphaMod(), SDL_TEXTUREMODULATE_ALPHA, and SDL_Renderer::SetTextureAlphaMod.

Referenced by SDL_CreateTextureFromSurface(), SDL_SetTextureAlphaMod(), and SDLTest_DrawCharacter().

DECLSPEC int SDLCALL SDL_SetTextureBlendMode | ( | SDL_Texture * | texture,
|  | SDL_BlendMode | blendMode
| ) |  |

Set the blend mode used for texture copy operations.

Parameters

  texture | The texture to update.
  blendMode | SDL_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()

Definition at line 663 of file SDL_render.c.

References SDL_Texture::blendMode, CHECK_TEXTURE_MAGIC, SDL_Texture::native, SDL_Texture::renderer, SDL_SetTextureBlendMode(), and SDL_Renderer::SetTextureBlendMode.

Referenced by SDL_CreateTextureFromSurface(), and SDL_SetTextureBlendMode().

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

  texture | The texture to update.
  r | The red color value multiplied into copy operations.
  g | The green color value multiplied into copy operations.
  b | The 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()

Definition at line 586 of file SDL_render.c.

References SDL_Texture::b, CHECK_TEXTURE_MAGIC, SDL_Texture::g, SDL_Texture::modMode, SDL_Texture::native, SDL_Texture::r, SDL_Texture::renderer, SDL_SetTextureColorMod(), SDL_TEXTUREMODULATE_COLOR, and SDL_Renderer::SetTextureColorMod.

Referenced by SDL_CreateTextureFromSurface(), SDL_SetTextureColorMod(), and SDLTest_DrawCharacter().

DECLSPEC void SDLCALL SDL_UnlockTexture | ( | SDL_Texture * | texture | ) |

Unlock a texture, uploading the changes to video memory, if needed.

See Also
  SDL_LockTexture()

Definition at line 1005 of file SDL_render.c.

References SDL_Texture::access, CHECK_TEXTURE_MAGIC, SDL_Texture::native, SDL_Texture::renderer, SDL_TEXTUREACCESS_STREAMING, SDL_UnlockTextureNative(), SDL_UnlockTextureYUV(), SDL_Renderer::UnlockTexture, and SDL_Texture::yuv.

Referenced by SDL_UnlockTextureNative(), SDL_UnlockTextureYUV(), SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), and SDL_UpdateTextureYUVPlanar().

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

  texture | The texture to update
  rect | A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  pixels | The raw pixel data.
  pitch | The number of bytes between rows of pixel data.

Returns
  0 on success, or -1 if the texture is not valid.

Note
  This is a fairly slow function.

Definition at line 775 of file SDL_render.c.

References CHECK_TEXTURE_MAGIC, SDL_Texture::h, SDL_Rect::h, SDL_Texture::native, SDL_Texture::renderer, SDL_InvalidParamError, SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), SDL_Renderer::UpdateTexture, SDL_Texture::w, SDL_Rect::w, SDL_Rect::x, SDL_Rect::y, and SDL_Texture::yuv.

Referenced by SDL_CreateTextureFromSurface(), SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), SDL_UpdateTextureYUVPlanar(), and SDL_UpdateWindowTexture().

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

  texture | The texture to update
  rect | A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  Yplane | The raw pixel data for the Y plane.
  Ypitch | The number of bytes between rows of pixel data for the Y plane.
  Uplane | The raw pixel data for the U plane.
  Upitch | The number of bytes between rows of pixel data for the U plane.
  Vplane | The raw pixel data for the V plane.
  Vpitch | The 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.

Definition at line 856 of file SDL_render.c.

References CHECK_TEXTURE_MAGIC, SDL_Texture::format, SDL_Texture::h, SDL_Rect::h, SDL_Texture::native, SDL_Texture::renderer, SDL_assert, SDL_InvalidParamError, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_YV12, SDL_SetError(), SDL_Unsupported, SDL_UpdateTextureYUVPlanar(), SDL_Renderer::UpdateTextureYUV, SDL_Texture::w, SDL_Rect::w, SDL_Rect::x, SDL_Rect::y, and SDL_Texture::yuv.