21 #include "../SDL_internal.h"
33 #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData"
35 #define CHECK_RENDERER_MAGIC(renderer, retval) \
36 SDL_assert(renderer && renderer->magic == &renderer_magic); \
37 if (!renderer || renderer->magic != &renderer_magic) { \
38 SDL_SetError("Invalid renderer"); \
42 #define CHECK_TEXTURE_MAGIC(texture, retval) \
43 SDL_assert(texture && texture->magic == &texture_magic); \
44 if (!texture || texture->magic != &texture_magic) { \
45 SDL_SetError("Invalid texture"); \
50 #define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \
51 srcAlphaFactor, dstAlphaFactor, alphaOperation) \
52 (SDL_BlendMode)(((Uint32)colorOperation << 0) | \
53 ((Uint32)srcColorFactor << 4) | \
54 ((Uint32)dstColorFactor << 8) | \
55 ((Uint32)alphaOperation << 16) | \
56 ((Uint32)srcAlphaFactor << 20) | \
57 ((Uint32)dstAlphaFactor << 24))
59 #define SDL_BLENDMODE_NONE_FULL \
60 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \
61 SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD)
63 #define SDL_BLENDMODE_BLEND_FULL \
64 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
65 SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD)
67 #define SDL_BLENDMODE_ADD_FULL \
68 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \
69 SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
71 #define SDL_BLENDMODE_MOD_FULL \
72 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \
73 SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
75 #if !SDL_RENDER_DISABLED
77 #if SDL_VIDEO_RENDER_D3D
80 #if SDL_VIDEO_RENDER_D3D11
83 #if SDL_VIDEO_RENDER_OGL
86 #if SDL_VIDEO_RENDER_OGL_ES2
89 #if SDL_VIDEO_RENDER_OGL_ES
92 #if SDL_VIDEO_RENDER_DIRECTFB
95 #if SDL_VIDEO_RENDER_METAL
98 #if SDL_VIDEO_RENDER_PSP
113 #if !SDL_RENDER_DISABLED
123 #if !SDL_RENDER_DISABLED
125 return SDL_SetError(
"index must be in the range of 0 - %d",
131 return SDL_SetError(
"SDL not built with rendering support");
152 if (window == renderer->
window) {
210 if (window == renderer->
window) {
211 int logical_w, logical_h;
216 event->motion.x -= (int)(viewport.
x * renderer->
dpi_scale.
x);
217 event->motion.y -= (int)(viewport.
y * renderer->
dpi_scale.
y);
235 if (window == renderer->
window) {
236 int logical_w, logical_h;
241 event->button.x -= (int)(viewport.
x * renderer->
dpi_scale.
x);
242 event->button.y -= (int)(viewport.
y * renderer->
dpi_scale.
y);
250 int logical_w, logical_h;
259 event->tfinger.x *= (w - 1);
260 event->tfinger.y *= (h - 1);
262 event->tfinger.x -= (viewport.
x * renderer->
dpi_scale.
x);
263 event->tfinger.y -= (viewport.
y * renderer->
dpi_scale.
y);
264 event->tfinger.x = (
event->tfinger.x / (scale.
x * renderer->
dpi_scale.
x));
265 event->tfinger.y = (
event->tfinger.y / (scale.
y * renderer->
dpi_scale.
y));
268 event->tfinger.x =
event->tfinger.x / (logical_w - 1);
270 event->tfinger.x = 0.5f;
273 event->tfinger.y =
event->tfinger.y / (logical_h - 1);
275 event->tfinger.y = 0.5f;
289 width, height, window_flags);
306 #if !SDL_RENDER_DISABLED
317 SDL_SetError(
"Renderer already associated with window");
332 for (index = 0; index <
n; ++
index) {
344 for (index = 0; index <
n; ++
index) {
347 if ((driver->
info.
flags & flags) == flags) {
363 SDL_SetError(
"index must be -1 or in the range of 0 - %d",
382 int output_w, output_h;
383 if (renderer->
GetOutputSize(renderer, &output_w, &output_h) == 0) {
385 renderer->
dpi_scale.
x = (float)window_w / output_w;
386 renderer->
dpi_scale.
y = (float)window_h / output_h;
403 "Created renderer: %s", renderer->
info.
name);
415 #if !SDL_RENDER_DISABLED
446 *info = renderer->
info;
459 }
else if (renderer->
window) {
464 return SDL_SetError(
"Renderer doesn't support querying output size");
558 if (w <= 0 || h <= 0) {
647 SDL_SetError(
"SDL_CreateTextureFromSurface() passed NULL surface");
668 surface->
w, surface->
h);
730 *format = texture->
format;
733 *access = texture->
access;
752 if (r < 255 || g < 255 || b < 255) {
855 const void *
pixels,
int pitch)
866 full_rect.
w = texture->
w;
867 full_rect.
h = texture->
h;
872 void *native_pixels =
NULL;
873 int native_pitch = 0;
875 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
879 rect->
w, rect->
h, native_pixels, native_pitch);
884 const size_t alloclen = rect->
h * temp_pitch;
891 rect->
w, rect->
h, temp_pixels, temp_pitch);
901 const void *
pixels,
int pitch)
905 if (!rect->
w || !rect->
h) {
911 void *native_pixels =
NULL;
912 int native_pitch = 0;
914 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
918 texture->
format, pixels, pitch,
919 native->
format, native_pixels, native_pitch);
924 const size_t alloclen = rect->
h * temp_pitch;
931 texture->
format, pixels, pitch,
932 native->
format, temp_pixels, temp_pitch);
942 const void *
pixels,
int pitch)
959 full_rect.
w = texture->
w;
960 full_rect.
h = texture->
h;
964 if ((rect->
w == 0) || (rect->
h == 0)) {
966 }
else if (texture->
yuv) {
968 }
else if (texture->
native) {
972 return renderer->
UpdateTexture(renderer, texture, rect, pixels, pitch);
978 const Uint8 *Yplane,
int Ypitch,
979 const Uint8 *Uplane,
int Upitch,
980 const Uint8 *Vplane,
int Vpitch)
991 full_rect.
w = texture->
w;
992 full_rect.
h = texture->
h;
995 if (!rect->
w || !rect->
h) {
1001 void *native_pixels =
NULL;
1002 int native_pitch = 0;
1004 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
1008 rect->
w, rect->
h, native_pixels, native_pitch);
1013 const size_t alloclen = rect->
h * temp_pitch;
1020 rect->
w, rect->
h, temp_pixels, temp_pitch);
1029 const Uint8 *Yplane,
int Ypitch,
1030 const Uint8 *Uplane,
int Upitch,
1031 const Uint8 *Vplane,
int Vpitch)
1059 return SDL_SetError(
"Texture format must by YV12 or IYUV");
1065 full_rect.
w = texture->
w;
1066 full_rect.
h = texture->
h;
1070 if (!rect->
w || !rect->
h) {
1081 return renderer->
UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
1090 void **
pixels,
int *pitch)
1097 void **
pixels,
int *pitch)
1101 rect->
y * texture->
pitch +
1103 *pitch = texture->
pitch;
1109 void **
pixels,
int *pitch)
1117 return SDL_SetError(
"SDL_LockTexture(): texture must be streaming");
1123 full_rect.
w = texture->
w;
1124 full_rect.
h = texture->
h;
1130 }
else if (texture->
native) {
1134 return renderer->
LockTexture(renderer, texture, rect, pixels, pitch);
1142 void *native_pixels =
NULL;
1143 int native_pitch = 0;
1148 rect.
w = texture->
w;
1149 rect.
h = texture->
h;
1151 if (
SDL_LockTexture(native, &rect, &native_pixels, &native_pitch) < 0) {
1155 rect.
w, rect.
h, native_pixels, native_pitch);
1163 void *native_pixels =
NULL;
1164 int native_pitch = 0;
1167 rect->
y * texture->
pitch +
1169 int pitch = texture->
pitch;
1171 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
1175 texture->
format, pixels, pitch,
1176 native->
format, native_pixels, native_pitch);
1192 }
else if (texture->
native) {
1215 if (texture == renderer->
target) {
1223 if (renderer != texture->
renderer) {
1224 return SDL_SetError(
"Texture was not created with this renderer");
1227 return SDL_SetError(
"Texture not created with SDL_TEXTUREACCESS_TARGET");
1231 texture = texture->
native;
1237 if (texture && !renderer->
target) {
1260 renderer->
scale.
x = 1.0f;
1261 renderer->
scale.
y = 1.0f;
1301 int scale_policy = 0;
1312 if (hint && (*hint ==
'1' ||
SDL_strcasecmp(hint,
"overscan") == 0)) {
1313 #if SDL_VIDEO_RENDER_D3D
1321 if (overscan_supported) {
1330 real_aspect = (
float)w /
h;
1336 if (want_aspect > real_aspect) {
1337 scale = (float)(w / renderer->
logical_w);
1342 viewport.
x = (w - viewport.
w) / 2;
1344 viewport.
y = (
h - viewport.
h) / 2;
1347 }
else if (
SDL_fabs(want_aspect-real_aspect) < 0.0001) {
1351 }
else if (want_aspect > real_aspect) {
1352 if (scale_policy == 1) {
1361 viewport.
x = (w - viewport.
w) / 2;
1369 viewport.
y = (
h - viewport.
h) / 2;
1373 if (scale_policy == 1) {
1382 viewport.
y = (
h - viewport.
h) / 2;
1390 viewport.
x = (w - viewport.
w) / 2;
1528 renderer->
scale.
x = scaleX;
1529 renderer->
scale.
y = scaleY;
1539 *scaleX = renderer->
scale.
x;
1542 *scaleY = renderer->
scale.
y;
1635 for (i = 0; i <
count; ++
i) {
1636 frects[
i].
x = points[
i].
x * renderer->
scale.
x;
1637 frects[
i].
y = points[
i].
y * renderer->
scale.
y;
1660 return SDL_SetError(
"SDL_RenderDrawPoints(): Passed NULL points");
1671 if (renderer->
scale.
x != 1.0f || renderer->
scale.
y != 1.0f) {
1679 for (i = 0; i <
count; ++
i) {
1680 fpoints[
i].
x = points[
i].
x * renderer->
scale.
x;
1681 fpoints[
i].
y = points[
i].
y * renderer->
scale.
y;
1720 for (i = 0; i < count-1; ++
i) {
1721 if (points[i].
x == points[i+1].
x) {
1725 frect = &frects[nrects++];
1726 frect->
x = points[
i].
x * renderer->
scale.
x;
1727 frect->
y = minY * renderer->
scale.
y;
1729 frect->
h = (maxY - minY + 1) * renderer->
scale.
y;
1730 }
else if (points[i].
y == points[i+1].
y) {
1731 int minX =
SDL_min(points[i].
x, points[i+1].x);
1734 frect = &frects[nrects++];
1735 frect->
x = minX * renderer->
scale.
x;
1736 frect->
y = points[
i].
y * renderer->
scale.
y;
1737 frect->
w = (maxX - minX + 1) * renderer->
scale.
x;
1741 fpoints[0].
x = points[
i].
x * renderer->
scale.
x;
1742 fpoints[0].
y = points[
i].
y * renderer->
scale.
y;
1743 fpoints[1].
x = points[i+1].
x * renderer->
scale.
x;
1744 fpoints[1].
y = points[i+1].
y * renderer->
scale.
y;
1770 return SDL_SetError(
"SDL_RenderDrawLines(): Passed NULL points");
1781 if (renderer->
scale.
x != 1.0f || renderer->
scale.
y != 1.0f) {
1789 for (i = 0; i <
count; ++
i) {
1790 fpoints[
i].
x = points[
i].
x * renderer->
scale.
x;
1791 fpoints[
i].
y = points[
i].
y * renderer->
scale.
y;
1817 points[0].
x = rect->
x;
1818 points[0].
y = rect->
y;
1819 points[1].
x = rect->
x+rect->
w-1;
1820 points[1].
y = rect->
y;
1821 points[2].
x = rect->
x+rect->
w-1;
1822 points[2].
y = rect->
y+rect->
h-1;
1823 points[3].
x = rect->
x;
1824 points[3].
y = rect->
y+rect->
h-1;
1825 points[4].
x = rect->
x;
1826 points[4].
y = rect->
y;
1839 return SDL_SetError(
"SDL_RenderDrawRects(): Passed NULL rects");
1850 for (i = 0; i <
count; ++
i) {
1861 SDL_Rect full_rect = { 0, 0, 0, 0 };
1886 return SDL_SetError(
"SDL_RenderFillRects(): Passed NULL rects");
1901 for (i = 0; i <
count; ++
i) {
1902 frects[
i].
x = rects[
i].
x * renderer->
scale.
x;
1903 frects[
i].
y = rects[
i].
y * renderer->
scale.
y;
1904 frects[
i].
w = rects[
i].
w * renderer->
scale.
x;
1905 frects[
i].
h = rects[
i].
h * renderer->
scale.
y;
1919 SDL_Rect real_srcrect = { 0, 0, 0, 0 };
1920 SDL_Rect real_dstrect = { 0, 0, 0, 0 };
1926 if (renderer != texture->
renderer) {
1927 return SDL_SetError(
"Texture was not created with this renderer");
1937 real_srcrect.
w = texture->
w;
1938 real_srcrect.
h = texture->
h;
1952 real_dstrect = *dstrect;
1956 texture = texture->
native;
1959 frect.
x = real_dstrect.
x * renderer->
scale.
x;
1960 frect.
y = real_dstrect.
y * renderer->
scale.
y;
1961 frect.
w = real_dstrect.
w * renderer->
scale.
x;
1962 frect.
h = real_dstrect.
h * renderer->
scale.
y;
1964 return renderer->
RenderCopy(renderer, texture, &real_srcrect, &frect);
1973 SDL_Rect real_srcrect = { 0, 0, 0, 0 };
1974 SDL_Rect real_dstrect = { 0, 0, 0, 0 };
1979 if (flip ==
SDL_FLIP_NONE && (
int)(angle/360) == angle/360) {
1986 if (renderer != texture->
renderer) {
1987 return SDL_SetError(
"Texture was not created with this renderer");
1990 return SDL_SetError(
"Renderer does not support RenderCopyEx");
2000 real_srcrect.
w = texture->
w;
2001 real_srcrect.
h = texture->
h;
2010 real_dstrect = *dstrect;
2018 texture = texture->
native;
2022 real_center = *center;
2024 real_center.
x = real_dstrect.
w/2;
2025 real_center.
y = real_dstrect.
h/2;
2028 frect.
x = real_dstrect.
x * renderer->
scale.
x;
2029 frect.
y = real_dstrect.
y * renderer->
scale.
y;
2030 frect.
w = real_dstrect.
w * renderer->
scale.
x;
2031 frect.
h = real_dstrect.
h * renderer->
scale.
y;
2033 fcenter.
x = real_center.
x * renderer->
scale.
x;
2034 fcenter.
y = real_center.
y * renderer->
scale.
y;
2036 return renderer->
RenderCopyEx(renderer, texture, &real_srcrect, &frect, angle, &fcenter, flip);
2063 if (real_rect.
y > rect->
y) {
2064 pixels = (
Uint8 *)pixels + pitch * (real_rect.
y - rect->
y);
2066 if (real_rect.
x > rect->
x) {
2068 pixels = (
Uint8 *)pixels + bpp * (real_rect.
x - rect->
x);
2073 format, pixels, pitch);
2096 if (texture == renderer->
target) {
2102 if (texture->
next) {
2105 if (texture->
prev) {
2247 srcAlphaFactor, dstAlphaFactor, alphaOperation);
SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode)
SDL_BlendFactor
The normalized factor used to multiply pixel components.
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
Create a window and default renderer.
int(* UpdateClipRect)(SDL_Renderer *renderer)
GLenum GLenum GLenum GLenum GLenum scale
SDL_MouseMotionEvent motion
#define SDL_DelEventWatch
GLdouble GLdouble GLdouble r
#define SDL_GetWindowData
#define SDL_HasIntersection
GLuint GLfloat GLfloat GLfloat x1
SDL_SW_YUVTexture * SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
#define SDL_UnlockSurface
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
static int SDL_UpdateTextureYUVPlanar(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
int 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.
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
#define SDL_HINT_RENDER_VSYNC
A variable controlling whether updates to the SDL screen surface should be synchronized with the vert...
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
void * SDL_RenderGetMetalCommandEncoder(SDL_Renderer *renderer)
Get the Metal command encoder for the current frame.
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
SDL_Rect clip_rect_backup
static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_Rect *viewport, SDL_FPoint *scale)
GLint GLint GLint GLint GLint x
int(* RenderClear)(SDL_Renderer *renderer)
#define SDL_ISPIXELFORMAT_INDEXED(format)
SDL_RenderDriver GLES_RenderDriver
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
int(* RenderDrawPoints)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
SDL_RenderDriver DirectFB_RenderDriver
#define SDL_ConvertSurface
void *(* GetMetalLayer)(SDL_Renderer *renderer)
GLuint GLuint GLsizei count
int(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
#define SDL_HINT_RENDER_SCALE_QUALITY
A variable controlling the scaling quality.
SDL_Renderer *(* CreateRenderer)(SDL_Window *window, Uint32 flags)
SDL_RenderDriver D3D11_RenderDriver
GLfloat GLfloat GLfloat GLfloat h
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
Get the current render target or NULL for the default render target.
GLfixed GLfixed GLfixed y2
SDL_RenderDriver PSP_RenderDriver
static SDL_ScaleMode SDL_GetScaleMode(void)
The structure that defines a point.
A collection of pixels used in software blitting.
Uint32 texture_formats[16]
SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode)
#define SDL_GetWindowFlags
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, void **pixels, int *pitch)
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).
SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode)
SDL_BlendMode SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation)
Create a custom blend mode, which may or may not be supported by a given renderer.
#define SDL_BYTESPERPIXEL(X)
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_RenderDrawPoint(SDL_Renderer *renderer, int x, int y)
Draw a point on the current rendering target.
#define SDL_WINDOWPOS_UNDEFINED
SDL_RenderDriver GL_RenderDriver
#define SDL_ISPIXELFORMAT_ALPHA(format)
static int RenderDrawPointsWithRects(SDL_Renderer *renderer, const SDL_Point *points, int count)
#define SDL_InvalidParamError(param)
int SDL_RenderSetViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the drawing area for rendering on the current target.
void SDL_RenderPresent(SDL_Renderer *renderer)
Update the screen with rendering performed.
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Read pixels from the current rendering target.
#define SDL_IntersectRect
SDL_BlendOperation
The blend operation used when combining source and destination pixel components.
static char texture_magic
void SDL_RenderGetLogicalSize(SDL_Renderer *renderer, int *w, int *h)
Get device independent resolution for rendering.
int SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
static int SDL_LockTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
GLfloat GLfloat GLfloat alpha
GLuint GLint GLboolean GLint GLenum access
void *(* GetMetalCommandEncoder)(SDL_Renderer *renderer)
static int RenderDrawLinesWithRects(SDL_Renderer *renderer, const SDL_Point *points, int count)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Fill a rectangle on the current rendering target with the drawing color.
GLint GLint GLsizei width
GLfixed GLfixed GLint GLint GLfixed points
void * SDL_RenderGetMetalLayer(SDL_Renderer *renderer)
Get the CAMetalLayer associated with the given Metal renderer.
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
Query the attributes of a texture.
#define SDL_GetHintBoolean
#define SDL_GetSurfaceBlendMode
SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface *surface)
static void SDL_UnlockTextureNative(SDL_Texture *texture)
static SDL_BlendMode blendMode
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
Get the blend mode used for texture copy operations.
#define SDL_SetWindowData
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static SDL_BlendMode SDL_GetShortBlendMode(SDL_BlendMode blendMode)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
Create a 2D software rendering context for a surface.
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, const void *pixels, int pitch)
#define SDL_GetWindowSize
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
Set the blend mode used for texture copy operations.
SDL_RenderDriver METAL_RenderDriver
SDL_RenderDriver GLES2_RenderDriver
GLenum GLenum GLuint texture
#define CHECK_RENDERER_MAGIC(renderer, retval)
SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode)
int(* UpdateTextureYUV)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
void SDL_DestroyTexture(SDL_Texture *texture)
Destroy the specified texture.
void SDL_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
SDL_RenderDriver SW_RenderDriver
int SDL_RenderDrawRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count)
Draw some number of rectangles on the current rendering target.
static SDL_Renderer * renderer
int SDL_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw multiple points on the current rendering target.
#define SDL_stack_alloc(type, count)
void SDL_UnlockTexture(SDL_Texture *texture)
Unlock a texture, uploading the changes to video memory, if needed.
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
Get the blend mode used for drawing operations.
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
Create a texture from an existing surface.
int(* RenderDrawLines)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
#define SDL_BLENDMODE_BLEND_FULL
int SDL_RenderSetIntegerScale(SDL_Renderer *renderer, SDL_bool enable)
Set whether to force integer scales for resolution-independent rendering.
GLfloat GLfloat GLfloat GLfloat maxX
GLubyte GLubyte GLubyte GLubyte w
#define SDL_BLENDMODE_MOD_FULL
int SDL_RenderDrawRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Draw a rectangle on the current rendering target.
int(* SetTextureColorMod)(SDL_Renderer *renderer, SDL_Texture *texture)
GLint GLint GLint GLint GLint GLint y
int SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture *swdata)
int 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.
SDL_RenderDriver D3D_RenderDriver
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
#define SDL_GetWindowFromID
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value used in render copy operations.
int 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.
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer *renderer)
Get whether integer scales are forced for resolution-independent rendering.
SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
Determines whether a window supports the use of render targets.
int(* RenderCopy)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
#define SDL_BLENDMODE_NONE_FULL
static int UpdateLogicalSize(SDL_Renderer *renderer)
#define SDL_GetSurfaceAlphaMod
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_RenderSetScale(SDL_Renderer *renderer, float scaleX, float scaleY)
Set the drawing scale for rendering on the current target.
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
Set an additional alpha value used in render copy operations.
void SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
Get the clip rectangle for the current target.
#define SDL_assert(condition)
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
int(* SetTextureBlendMode)(SDL_Renderer *renderer, SDL_Texture *texture)
#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE
A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
int SDL_RenderClear(SDL_Renderer *renderer)
Clear the current rendering target with the drawing color.
SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer *renderer)
Get whether clipping is enabled on the given renderer.
#define SDL_OutOfMemory()
#define SDL_GetCurrentVideoDriver
GLfloat GLfloat GLfloat GLfloat GLfloat maxY
SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode)
int(* GetOutputSize)(SDL_Renderer *renderer, int *w, int *h)
int(* GL_BindTexture)(SDL_Renderer *renderer, SDL_Texture *texture, float *texw, float *texh)
Information on the capabilities of a render driver or context.
static const SDL_RenderDriver * render_drivers[]
#define SDL_WINDOWRENDERDATA
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format)
GLint GLint GLsizei GLsizei height
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for a window.
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
#define SDL_GetSurfaceColorMod
int(* GL_UnbindTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
EGLSurface EGLNativeWindowType * window
#define CHECK_TEXTURE_MAGIC(texture, retval)
#define SDL_AddEventWatch
int SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
int(* RenderFillRects)(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
int SDL_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw a series of connected lines on the current rendering target.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
int 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.
The type used to identify a window.
#define SDL_GetWindowPixelFormat
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
Get the renderer associated with a window.
SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode)
SDL_bool(* SupportsBlendMode)(SDL_Renderer *renderer, SDL_BlendMode blendMode)
void SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
Get the drawing area for the current target.
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, Uint32 target_format, int w, int h, void *pixels, int pitch)
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
void SDL_RenderGetScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value used in render copy operations.
SDL_MouseButtonEvent button
Uint32 num_texture_formats
int SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the clip rectangle for the current target.
int SDL_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip)
Copy a portion of the source texture to the current rendering target, rotating it by angle around the...
#define SDL_arraysize(array)
static char renderer_magic
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).
int(* UpdateViewport)(SDL_Renderer *renderer)
#define SDL_BLENDMODE_ADD_FULL
#define SDL_ConvertPixels
#define SDL_ISPIXELFORMAT_FOURCC(format)
EGLSurface EGLint * rects
#define SDL_stack_free(data)
static SDL_BlendMode SDL_GetLongBlendMode(SDL_BlendMode blendMode)
int(* RenderCopyEx)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcquad, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
int SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
Set device independent resolution for rendering.
void(* RenderPresent)(SDL_Renderer *renderer)
GLboolean GLboolean GLboolean GLboolean a
void(* DestroyRenderer)(SDL_Renderer *renderer)
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
Set a texture as the current rendering target.
int SDL_RenderDrawLine(SDL_Renderer *renderer, int x1, int y1, int x2, int y2)
Draw a line on the current rendering target.
int(* SetTextureAlphaMod)(SDL_Renderer *renderer, SDL_Texture *texture)
static void SDL_UnlockTextureYUV(SDL_Texture *texture)
GLboolean GLboolean GLboolean b
SDL_bool clipping_enabled_backup
#define SDL_Unsupported()
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
Create a texture for a rendering context.
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
Get the additional alpha value used in render copy operations.
SDL_bool clipping_enabled
static int SDL_RendererEventWatch(void *userdata, SDL_Event *event)
#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, srcAlphaFactor, dstAlphaFactor, alphaOperation)
A rectangle, with the origin at the upper left.
int SDL_GL_UnbindTexture(SDL_Texture *texture)
Unbind a texture from the current OpenGL/ES/ES2 context.
static int SDL_LockTextureNative(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.
static SDL_bool IsSupportedBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)