SDL 3.0
SDL_render.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_render.h
24 *
25 * Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 * * single pixel points
29 * * single pixel lines
30 * * filled rectangles
31 * * texture images
32 *
33 * The primitives may be drawn in opaque, blended, or additive modes.
34 *
35 * The texture images may be drawn in opaque, blended, or additive modes.
36 * They can have an additional color tint or alpha modulation applied to
37 * them, and may also be stretched with linear interpolation.
38 *
39 * This API is designed to accelerate simple 2D operations. You may
40 * want more functionality such as polygons and particle effects and
41 * in that case you should use SDL's OpenGL/Direct3D support or one
42 * of the many good 3D engines.
43 *
44 * These functions must be called from the main thread.
45 * See this bug for details: https://github.com/libsdl-org/SDL/issues/986
46 */
47
48#ifndef SDL_render_h_
49#define SDL_render_h_
50
51#include <SDL3/SDL_stdinc.h>
52#include <SDL3/SDL_events.h>
53#include <SDL3/SDL_properties.h>
54#include <SDL3/SDL_rect.h>
55#include <SDL3/SDL_video.h>
56
57#include <SDL3/SDL_begin_code.h>
58/* Set up for C function definitions, even when using C++ */
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63/**
64 * Flags used when creating a rendering context
65 */
66typedef enum
67{
68 SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
69 SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
70 acceleration */
71 SDL_RENDERER_PRESENTVSYNC = 0x00000004 /**< Present is synchronized
72 with the refresh rate */
74
75/**
76 * Information on the capabilities of a render driver or context.
77 */
78typedef struct SDL_RendererInfo
79{
80 const char *name; /**< The name of the renderer */
81 Uint32 flags; /**< Supported ::SDL_RendererFlags */
82 Uint32 num_texture_formats; /**< The number of available texture formats */
83 Uint32 texture_formats[16]; /**< The available texture formats */
84 int max_texture_width; /**< The maximum texture width */
85 int max_texture_height; /**< The maximum texture height */
87
88/**
89 * Vertex structure
90 */
91typedef struct SDL_Vertex
92{
93 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
94 SDL_Color color; /**< Vertex color */
95 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
97
98/**
99 * The access pattern allowed for a texture.
100 */
101typedef enum
102{
103 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
104 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
105 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
107
108/**
109 * Flip constants for SDL_RenderTextureRotated
110 */
111typedef enum
112{
113 SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
114 SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
115 SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
117
118/**
119 * How the logical size is mapped to the output
120 */
121typedef enum
122{
123 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
124 SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
125 SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars */
126 SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
127 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE /**< The rendered content is scaled up by integer multiples to fit the output resolution */
129
130/**
131 * A structure representing rendering state
132 */
133struct SDL_Renderer;
135
136/**
137 * An efficient driver-specific representation of pixel data
138 */
139struct SDL_Texture;
141
142/* Function prototypes */
143
144/**
145 * Get the number of 2D rendering drivers available for the current display.
146 *
147 * A render driver is a set of code that handles rendering and texture
148 * management on a particular display. Normally there is only one, but some
149 * drivers may have several available with different capabilities.
150 *
151 * There may be none if SDL was compiled without render support.
152 *
153 * \returns a number >= 0 on success or a negative error code on failure; call
154 * SDL_GetError() for more information.
155 *
156 * \since This function is available since SDL 3.0.0.
157 *
158 * \sa SDL_CreateRenderer
159 * \sa SDL_GetRenderDriver
160 */
161extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
162
163/**
164 * Use this function to get the name of a built in 2D rendering driver.
165 *
166 * The list of rendering drivers is given in the order that they are normally
167 * initialized by default; the drivers that seem more reasonable to choose
168 * first (as far as the SDL developers believe) are earlier in the list.
169 *
170 * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
171 * "direct3d12" or "metal". These never have Unicode characters, and are not
172 * meant to be proper names.
173 *
174 * The returned value points to a static, read-only string; do not modify or
175 * free it!
176 *
177 * \param index the index of the rendering driver; the value ranges from 0 to
178 * SDL_GetNumRenderDrivers() - 1
179 * \returns the name of the rendering driver at the requested index, or NULL
180 * if an invalid index was specified.
181 *
182 * \since This function is available since SDL 3.0.0.
183 *
184 * \sa SDL_GetNumRenderDrivers
185 */
186extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
187
188/**
189 * Create a window and default renderer.
190 *
191 * \param width the width of the window
192 * \param height the height of the window
193 * \param window_flags the flags used to create the window (see
194 * SDL_CreateWindow())
195 * \param window a pointer filled with the window, or NULL on error
196 * \param renderer a pointer filled with the renderer, or NULL on error
197 * \returns 0 on success or a negative error code on failure; call
198 * SDL_GetError() for more information.
199 *
200 * \since This function is available since SDL 3.0.0.
201 *
202 * \sa SDL_CreateRenderer
203 * \sa SDL_CreateWindow
204 */
205extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer);
206
207/**
208 * Create a 2D rendering context for a window.
209 *
210 * If you want a specific renderer, you can specify its name here. A list of
211 * available renderers can be obtained by calling SDL_GetRenderDriver multiple
212 * times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you don't
213 * need a specific renderer, specify NULL and SDL will attempt to choose the
214 * best option for you, based on what is available on the user's system.
215 *
216 * By default the rendering size matches the window size in pixels, but you
217 * can call SDL_SetRenderLogicalPresentation() to change the content size and
218 * scaling options.
219 *
220 * \param window the window where rendering is displayed
221 * \param name the name of the rendering driver to initialize, or NULL to
222 * initialize the first one supporting the requested flags
223 * \param flags 0, or one or more SDL_RendererFlags OR'd together
224 * \returns a valid rendering context or NULL if there was an error; call
225 * SDL_GetError() for more information.
226 *
227 * \since This function is available since SDL 3.0.0.
228 *
229 * \sa SDL_CreateRendererWithProperties
230 * \sa SDL_CreateSoftwareRenderer
231 * \sa SDL_DestroyRenderer
232 * \sa SDL_GetNumRenderDrivers
233 * \sa SDL_GetRenderDriver
234 * \sa SDL_GetRendererInfo
235 */
236extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags);
237
238/**
239 * Create a 2D rendering context for a window, with the specified properties.
240 *
241 * These are the supported properties:
242 *
243 * - "window" (pointer) - the window where rendering is displayed
244 * - "surface" (pointer) - the surface where rendering is displayed, if you
245 * want a software renderer without a window
246 * - "name" (string) - the name of the rendering driver to use, if a specific
247 * one is desired
248 * - "present_vsync" (boolean) - true if you want present synchronized with
249 * the refresh rate
250 *
251 * \param props the properties to use
252 * \returns a valid rendering context or NULL if there was an error; call
253 * SDL_GetError() for more information.
254 *
255 * \since This function is available since SDL 3.0.0.
256 *
257 * \sa SDL_CreateRenderer
258 * \sa SDL_CreateSoftwareRenderer
259 * \sa SDL_DestroyRenderer
260 * \sa SDL_GetRendererInfo
261 */
263
264/**
265 * Create a 2D software rendering context for a surface.
266 *
267 * Two other API which can be used to create SDL_Renderer:
268 * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
269 * create a software renderer, but they are intended to be used with an
270 * SDL_Window as the final destination and not an SDL_Surface.
271 *
272 * \param surface the SDL_Surface structure representing the surface where
273 * rendering is done
274 * \returns a valid rendering context or NULL if there was an error; call
275 * SDL_GetError() for more information.
276 *
277 * \since This function is available since SDL 3.0.0.
278 *
279 * \sa SDL_CreateRenderer
280 * \sa SDL_CreateWindowRenderer
281 * \sa SDL_DestroyRenderer
282 */
283extern DECLSPEC SDL_Renderer *SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
284
285/**
286 * Get the renderer associated with a window.
287 *
288 * \param window the window to query
289 * \returns the rendering context on success or NULL on failure; call
290 * SDL_GetError() for more information.
291 *
292 * \since This function is available since SDL 3.0.0.
293 *
294 * \sa SDL_CreateRenderer
295 */
296extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetRenderer(SDL_Window *window);
297
298/**
299 * Get the window associated with a renderer.
300 *
301 * \param renderer the renderer to query
302 * \returns the window on success or NULL on failure; call SDL_GetError() for
303 * more information.
304 *
305 * \since This function is available since SDL 3.0.0.
306 */
307extern DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
308
309/**
310 * Get information about a rendering context.
311 *
312 * \param renderer the rendering context
313 * \param info an SDL_RendererInfo structure filled with information about the
314 * current renderer
315 * \returns 0 on success or a negative error code on failure; call
316 * SDL_GetError() for more information.
317 *
318 * \since This function is available since SDL 3.0.0.
319 *
320 * \sa SDL_CreateRenderer
321 */
322extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
323
324/**
325 * Get the properties associated with a renderer.
326 *
327 * The following read-only properties are provided by SDL:
328 *
329 * ```
330 * "SDL.renderer.d3d9.device" (pointer) - the IDirect3DDevice9 associated with the renderer
331 * "SDL.renderer.d3d11.device" (pointer) - the ID3D11Device associated with the renderer
332 * "SDL.renderer.d3d12.device" (pointer) - the ID3D12Device associated with the renderer
333 * "SDL.renderer.d3d12.command_queue" (pointer) - the ID3D12CommandQueue associated with the renderer
334 * ```
335 *
336 * \param renderer the rendering context
337 * \returns a valid property ID on success or 0 on failure; call
338 * SDL_GetError() for more information.
339 *
340 * \since This function is available since SDL 3.0.0.
341 *
342 * \sa SDL_GetProperty
343 * \sa SDL_SetProperty
344 */
345extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer);
346
347/**
348 * Get the output size in pixels of a rendering context.
349 *
350 * This returns the true output size in pixels, ignoring any render targets or
351 * logical size and presentation.
352 *
353 * \param renderer the rendering context
354 * \param w a pointer filled in with the width in pixels
355 * \param h a pointer filled in with the height in pixels
356 * \returns 0 on success or a negative error code on failure; call
357 * SDL_GetError() for more information.
358 *
359 * \since This function is available since SDL 3.0.0.
360 *
361 * \sa SDL_GetRenderer
362 */
363extern DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
364
365/**
366 * Get the current output size in pixels of a rendering context.
367 *
368 * If a rendering target is active, this will return the size of the rendering
369 * target in pixels, otherwise if a logical size is set, it will return the
370 * logical size, otherwise it will return the value of
371 * SDL_GetRenderOutputSize().
372 *
373 * \param renderer the rendering context
374 * \param w a pointer filled in with the current width
375 * \param h a pointer filled in with the current height
376 * \returns 0 on success or a negative error code on failure; call
377 * SDL_GetError() for more information.
378 *
379 * \since This function is available since SDL 3.0.0.
380 *
381 * \sa SDL_GetRenderOutputSize
382 * \sa SDL_GetRenderer
383 */
384extern DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
385
386/**
387 * Create a texture for a rendering context.
388 *
389 * You can set the texture scaling method by setting
390 * `SDL_HINT_RENDER_SCALE_QUALITY` before creating the texture.
391 *
392 * \param renderer the rendering context
393 * \param format one of the enumerated values in SDL_PixelFormatEnum
394 * \param access one of the enumerated values in SDL_TextureAccess
395 * \param w the width of the texture in pixels
396 * \param h the height of the texture in pixels
397 * \returns a pointer to the created texture or NULL if no rendering context
398 * was active, the format was unsupported, or the width or height
399 * were out of range; call SDL_GetError() for more information.
400 *
401 * \since This function is available since SDL 3.0.0.
402 *
403 * \sa SDL_CreateTextureFromSurface
404 * \sa SDL_CreateTextureWithProperties
405 * \sa SDL_DestroyTexture
406 * \sa SDL_QueryTexture
407 * \sa SDL_UpdateTexture
408 */
409extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h);
410
411/**
412 * Create a texture from an existing surface.
413 *
414 * The surface is not modified or freed by this function.
415 *
416 * The SDL_TextureAccess hint for the created texture is
417 * `SDL_TEXTUREACCESS_STATIC`.
418 *
419 * The pixel format of the created texture may be different from the pixel
420 * format of the surface. Use SDL_QueryTexture() to query the pixel format of
421 * the texture.
422 *
423 * \param renderer the rendering context
424 * \param surface the SDL_Surface structure containing pixel data used to fill
425 * the texture
426 * \returns the created texture or NULL on failure; call SDL_GetError() for
427 * more information.
428 *
429 * \since This function is available since SDL 3.0.0.
430 *
431 * \sa SDL_CreateTexture
432 * \sa SDL_CreateTextureWithProperties
433 * \sa SDL_DestroyTexture
434 * \sa SDL_QueryTexture
435 */
436extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
437
438/**
439 * Create a texture for a rendering context with the specified properties.
440 *
441 * These are the supported properties:
442 *
443 * - "format" (number) - one of the enumerated values in SDL_PixelFormatEnum,
444 * defaults to the best RGBA format for the renderer
445 * - "access" (number) - one of the enumerated values in SDL_TextureAccess,
446 * defaults to SDL_TEXTUREACCESS_STATIC
447 * - "width" (number) - the width of the texture in pixels, required
448 * - "height" (number) - the height of the texture in pixels, required
449 *
450 * With the direct3d11 renderer:
451 *
452 * - "d3d11.texture" (pointer) - the ID3D11Texture2D associated with the
453 * texture, if you want to wrap an existing texture.
454 * - "d3d11.texture_u" (pointer) - the ID3D11Texture2D associated with the U
455 * plane of a YUV texture, if you want to wrap an existing texture.
456 * - "d3d11.texture_v" (pointer) - the ID3D11Texture2D associated with the V
457 * plane of a YUV texture, if you want to wrap an existing texture.
458 *
459 * With the direct3d12 renderer:
460 *
461 * - "d3d12.texture" (pointer) - the ID3D12Resource associated with the
462 * texture, if you want to wrap an existing texture.
463 * - "d3d12.texture_u" (pointer) - the ID3D12Resource associated with the U
464 * plane of a YUV texture, if you want to wrap an existing texture.
465 * - "d3d12.texture_v" (pointer) - the ID3D12Resource associated with the V
466 * plane of a YUV texture, if you want to wrap an existing texture.
467 *
468 * With the opengl renderer:
469 *
470 * - "opengl.texture" (number) - the GLuint texture associated with the
471 * texture, if you want to wrap an existing texture.
472 * - "opengl.texture_uv" (number) - the GLuint texture associated with the UV
473 * plane of an NV12 texture, if you want to wrap an existing texture.
474 * - "opengl.texture_u" (number) - the GLuint texture associated with the U
475 * plane of a YUV texture, if you want to wrap an existing texture.
476 * - "opengl.texture_v" (number) - the GLuint texture associated with the V
477 * plane of a YUV texture, if you want to wrap an existing texture.
478 *
479 * With the opengles2 renderer:
480 *
481 * - "opengles2.texture" (number) - the GLuint texture associated with the
482 * texture, if you want to wrap an existing texture.
483 * - "opengles2.texture_uv" (number) - the GLuint texture associated with the
484 * UV plane of an NV12 texture, if you want to wrap an existing texture.
485 * - "opengles2.texture_u" (number) - the GLuint texture associated with the U
486 * plane of a YUV texture, if you want to wrap an existing texture.
487 * - "opengles2.texture_v" (number) - the GLuint texture associated with the V
488 * plane of a YUV texture, if you want to wrap an existing texture.
489 *
490 * \param renderer the rendering context
491 * \param props the properties to use
492 * \returns a pointer to the created texture or NULL if no rendering context
493 * was active, the format was unsupported, or the width or height
494 * were out of range; call SDL_GetError() for more information.
495 *
496 * \since This function is available since SDL 3.0.0.
497 *
498 * \sa SDL_CreateTextureFromSurface
499 * \sa SDL_CreateTexture
500 * \sa SDL_DestroyTexture
501 * \sa SDL_QueryTexture
502 * \sa SDL_UpdateTexture
503 */
505
506/**
507 * Get the properties associated with a texture.
508 *
509 * The following read-only properties are provided by SDL:
510 *
511 * With the direct3d11 renderer:
512 *
513 * - "SDL.texture.d3d11.texture" (pointer) - the ID3D11Texture2D associated
514 * with the texture
515 * - "SDL.texture.d3d11.texture_u" (pointer) - the ID3D11Texture2D associated
516 * with the U plane of a YUV texture
517 * - "SDL.texture.d3d11.texture_v" (pointer) - the ID3D11Texture2D associated
518 * with the V plane of a YUV texture
519 *
520 * With the direct3d12 renderer:
521 *
522 * - "SDL.texture.d3d12.texture" (pointer) - the ID3D12Resource associated
523 * with the texture
524 * - "SDL.texture.d3d12.texture_u" (pointer) - the ID3D12Resource associated
525 * with the U plane of a YUV texture
526 * - "SDL.texture.d3d12.texture_v" (pointer) - the ID3D12Resource associated
527 * with the V plane of a YUV texture
528 *
529 * With the opengl renderer:
530 *
531 * - "SDL.texture.opengl.texture" (number) - the GLuint texture associated
532 * with the texture
533 * - "SDL.texture.opengl.texture_uv" (number) - the GLuint texture associated
534 * with the UV plane of an NV12 texture
535 * - "SDL.texture.opengl.texture_u" (number) - the GLuint texture associated
536 * with the U plane of a YUV texture
537 * - "SDL.texture.opengl.texture_v" (number) - the GLuint texture associated
538 * with the V plane of a YUV texture
539 * - "SDL.texture.opengl.tex_w" (float) - the texture coordinate width of the
540 * texture (0.0 - 1.0)
541 * - "SDL.texture.opengl.tex_h" (float) - the texture coordinate height of the
542 * texture (0.0 - 1.0)
543 *
544 * With the opengles2 renderer:
545 *
546 * - "SDL.texture.opengles2.texture" (number) - the GLuint texture associated
547 * with the texture
548 * - "SDL.texture.opengles2.texture_uv" (number) - the GLuint texture
549 * associated with the UV plane of an NV12 texture
550 * - "SDL.texture.opengles2.texture_u" (number) - the GLuint texture
551 * associated with the U plane of a YUV texture
552 * - "SDL.texture.opengles2.texture_v" (number) - the GLuint texture
553 * associated with the V plane of a YUV texture
554 *
555 * \param texture the texture to query
556 * \returns a valid property ID on success or 0 on failure; call
557 * SDL_GetError() for more information.
558 *
559 * \since This function is available since SDL 3.0.0.
560 *
561 * \sa SDL_GetProperty
562 * \sa SDL_SetProperty
563 */
564extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
565
566/**
567 * Query the attributes of a texture.
568 *
569 * \param texture the texture to query
570 * \param format a pointer filled in with the raw format of the texture; the
571 * actual format may differ, but pixel transfers will use this
572 * format (one of the SDL_PixelFormatEnum values). This argument
573 * can be NULL if you don't need this information.
574 * \param access a pointer filled in with the actual access to the texture
575 * (one of the SDL_TextureAccess values). This argument can be
576 * NULL if you don't need this information.
577 * \param w a pointer filled in with the width of the texture in pixels. This
578 * argument can be NULL if you don't need this information.
579 * \param h a pointer filled in with the height of the texture in pixels. This
580 * argument can be NULL if you don't need this information.
581 * \returns 0 on success or a negative error code on failure; call
582 * SDL_GetError() for more information.
583 *
584 * \since This function is available since SDL 3.0.0.
585 *
586 * \sa SDL_CreateTexture
587 */
588extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
589
590/**
591 * Set an additional color value multiplied into render copy operations.
592 *
593 * When this texture is rendered, during the copy operation each source color
594 * channel is modulated by the appropriate color value according to the
595 * following formula:
596 *
597 * `srcC = srcC * (color / 255)`
598 *
599 * Color modulation is not always supported by the renderer; it will return -1
600 * if color modulation is not supported.
601 *
602 * \param texture the texture to update
603 * \param r the red color value multiplied into copy operations
604 * \param g the green color value multiplied into copy operations
605 * \param b the blue color value multiplied into copy operations
606 * \returns 0 on success or a negative error code on failure; call
607 * SDL_GetError() for more information.
608 *
609 * \since This function is available since SDL 3.0.0.
610 *
611 * \sa SDL_GetTextureColorMod
612 * \sa SDL_SetTextureAlphaMod
613 */
614extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
615
616
617/**
618 * Get the additional color value multiplied into render copy operations.
619 *
620 * \param texture the texture to query
621 * \param r a pointer filled in with the current red color value
622 * \param g a pointer filled in with the current green color value
623 * \param b a pointer filled in with the current blue color value
624 * \returns 0 on success or a negative error code on failure; call
625 * SDL_GetError() for more information.
626 *
627 * \since This function is available since SDL 3.0.0.
628 *
629 * \sa SDL_GetTextureAlphaMod
630 * \sa SDL_SetTextureColorMod
631 */
632extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
633
634/**
635 * Set an additional alpha value multiplied into render copy operations.
636 *
637 * When this texture is rendered, during the copy operation the source alpha
638 * value is modulated by this alpha value according to the following formula:
639 *
640 * `srcA = srcA * (alpha / 255)`
641 *
642 * Alpha modulation is not always supported by the renderer; it will return -1
643 * if alpha modulation is not supported.
644 *
645 * \param texture the texture to update
646 * \param alpha the source alpha value multiplied into copy operations
647 * \returns 0 on success or a negative error code on failure; call
648 * SDL_GetError() for more information.
649 *
650 * \since This function is available since SDL 3.0.0.
651 *
652 * \sa SDL_GetTextureAlphaMod
653 * \sa SDL_SetTextureColorMod
654 */
655extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
656
657/**
658 * Get the additional alpha value multiplied into render copy operations.
659 *
660 * \param texture the texture to query
661 * \param alpha a pointer filled in with the current alpha value
662 * \returns 0 on success or a negative error code on failure; call
663 * SDL_GetError() for more information.
664 *
665 * \since This function is available since SDL 3.0.0.
666 *
667 * \sa SDL_GetTextureColorMod
668 * \sa SDL_SetTextureAlphaMod
669 */
670extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
671
672/**
673 * Set the blend mode for a texture, used by SDL_RenderTexture().
674 *
675 * If the blend mode is not supported, the closest supported mode is chosen
676 * and this function returns -1.
677 *
678 * \param texture the texture to update
679 * \param blendMode the SDL_BlendMode to use for texture blending
680 * \returns 0 on success or a negative error code on failure; call
681 * SDL_GetError() for more information.
682 *
683 * \since This function is available since SDL 3.0.0.
684 *
685 * \sa SDL_GetTextureBlendMode
686 * \sa SDL_RenderTexture
687 */
688extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
689
690/**
691 * Get the blend mode used for texture copy operations.
692 *
693 * \param texture the texture to query
694 * \param blendMode a pointer filled in with the current SDL_BlendMode
695 * \returns 0 on success or a negative error code on failure; call
696 * SDL_GetError() for more information.
697 *
698 * \since This function is available since SDL 3.0.0.
699 *
700 * \sa SDL_SetTextureBlendMode
701 */
702extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
703
704/**
705 * Set the scale mode used for texture scale operations.
706 *
707 * If the scale mode is not supported, the closest supported mode is chosen.
708 *
709 * \param texture The texture to update.
710 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
711 * \returns 0 on success or a negative error code on failure; call
712 * SDL_GetError() for more information.
713 *
714 * \since This function is available since SDL 3.0.0.
715 *
716 * \sa SDL_GetTextureScaleMode
717 */
718extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
719
720/**
721 * Get the scale mode used for texture scale operations.
722 *
723 * \param texture the texture to query.
724 * \param scaleMode a pointer filled in with the current scale mode.
725 * \returns 0 on success or a negative error code on failure; call
726 * SDL_GetError() for more information.
727 *
728 * \since This function is available since SDL 3.0.0.
729 *
730 * \sa SDL_SetTextureScaleMode
731 */
732extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
733
734/**
735 * Update the given texture rectangle with new pixel data.
736 *
737 * The pixel data must be in the pixel format of the texture. Use
738 * SDL_QueryTexture() to query the pixel format of the texture.
739 *
740 * This is a fairly slow function, intended for use with static textures that
741 * do not change often.
742 *
743 * If the texture is intended to be updated often, it is preferred to create
744 * the texture as streaming and use the locking functions referenced below.
745 * While this function will work with streaming textures, for optimization
746 * reasons you may not get the pixels back if you lock the texture afterward.
747 *
748 * \param texture the texture to update
749 * \param rect an SDL_Rect structure representing the area to update, or NULL
750 * to update the entire texture
751 * \param pixels the raw pixel data in the format of the texture
752 * \param pitch the number of bytes in a row of pixel data, including padding
753 * between lines
754 * \returns 0 on success or a negative error code on failure; call
755 * SDL_GetError() for more information.
756 *
757 * \since This function is available since SDL 3.0.0.
758 *
759 * \sa SDL_CreateTexture
760 * \sa SDL_LockTexture
761 * \sa SDL_UnlockTexture
762 */
763extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
764
765/**
766 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
767 * data.
768 *
769 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
770 * block of Y and U/V planes in the proper order, but this function is
771 * available if your pixel data is not contiguous.
772 *
773 * \param texture the texture to update
774 * \param rect a pointer to the rectangle of pixels to update, or NULL to
775 * update the entire texture
776 * \param Yplane the raw pixel data for the Y plane
777 * \param Ypitch the number of bytes between rows of pixel data for the Y
778 * plane
779 * \param Uplane the raw pixel data for the U plane
780 * \param Upitch the number of bytes between rows of pixel data for the U
781 * plane
782 * \param Vplane the raw pixel data for the V plane
783 * \param Vpitch the number of bytes between rows of pixel data for the V
784 * plane
785 * \returns 0 on success or a negative error code on failure; call
786 * SDL_GetError() for more information.
787 *
788 * \since This function is available since SDL 3.0.0.
789 *
790 * \sa SDL_UpdateTexture
791 */
792extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
793 const SDL_Rect *rect,
794 const Uint8 *Yplane, int Ypitch,
795 const Uint8 *Uplane, int Upitch,
796 const Uint8 *Vplane, int Vpitch);
797
798/**
799 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
800 *
801 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
802 * block of NV12/21 planes in the proper order, but this function is available
803 * if your pixel data is not contiguous.
804 *
805 * \param texture the texture to update
806 * \param rect a pointer to the rectangle of pixels to update, or NULL to
807 * update the entire texture.
808 * \param Yplane the raw pixel data for the Y plane.
809 * \param Ypitch the number of bytes between rows of pixel data for the Y
810 * plane.
811 * \param UVplane the raw pixel data for the UV plane.
812 * \param UVpitch the number of bytes between rows of pixel data for the UV
813 * plane.
814 * \returns 0 on success or a negative error code on failure; call
815 * SDL_GetError() for more information.
816 *
817 * \since This function is available since SDL 3.0.0.
818 */
819extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
820 const SDL_Rect *rect,
821 const Uint8 *Yplane, int Ypitch,
822 const Uint8 *UVplane, int UVpitch);
823
824/**
825 * Lock a portion of the texture for **write-only** pixel access.
826 *
827 * As an optimization, the pixels made available for editing don't necessarily
828 * contain the old texture data. This is a write-only operation, and if you
829 * need to keep a copy of the texture data you should do that at the
830 * application level.
831 *
832 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
833 * changes.
834 *
835 * \param texture the texture to lock for access, which was created with
836 * `SDL_TEXTUREACCESS_STREAMING`
837 * \param rect an SDL_Rect structure representing the area to lock for access;
838 * NULL to lock the entire texture
839 * \param pixels this is filled in with a pointer to the locked pixels,
840 * appropriately offset by the locked area
841 * \param pitch this is filled in with the pitch of the locked pixels; the
842 * pitch is the length of one row in bytes
843 * \returns 0 on success or a negative error code if the texture is not valid
844 * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
845 * SDL_GetError() for more information.
846 *
847 * \since This function is available since SDL 3.0.0.
848 *
849 * \sa SDL_UnlockTexture
850 */
851extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
852 const SDL_Rect *rect,
853 void **pixels, int *pitch);
854
855/**
856 * Lock a portion of the texture for **write-only** pixel access, and expose
857 * it as a SDL surface.
858 *
859 * Besides providing an SDL_Surface instead of raw pixel data, this function
860 * operates like SDL_LockTexture.
861 *
862 * As an optimization, the pixels made available for editing don't necessarily
863 * contain the old texture data. This is a write-only operation, and if you
864 * need to keep a copy of the texture data you should do that at the
865 * application level.
866 *
867 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
868 * changes.
869 *
870 * The returned surface is freed internally after calling SDL_UnlockTexture()
871 * or SDL_DestroyTexture(). The caller should not free it.
872 *
873 * \param texture the texture to lock for access, which must be created with
874 * `SDL_TEXTUREACCESS_STREAMING`
875 * \param rect a pointer to the rectangle to lock for access. If the rect is
876 * NULL, the entire texture will be locked
877 * \param surface this is filled in with an SDL surface representing the
878 * locked area
879 * \returns 0 on success or a negative error code on failure; call
880 * SDL_GetError() for more information.
881 *
882 * \since This function is available since SDL 3.0.0.
883 *
884 * \sa SDL_LockTexture
885 * \sa SDL_UnlockTexture
886 */
887extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
888 const SDL_Rect *rect,
889 SDL_Surface **surface);
890
891/**
892 * Unlock a texture, uploading the changes to video memory, if needed.
893 *
894 * **Warning**: Please note that SDL_LockTexture() is intended to be
895 * write-only; it will not guarantee the previous contents of the texture will
896 * be provided. You must fully initialize any area of a texture that you lock
897 * before unlocking it, as the pixels might otherwise be uninitialized memory.
898 *
899 * Which is to say: locking and immediately unlocking a texture can result in
900 * corrupted textures, depending on the renderer in use.
901 *
902 * \param texture a texture locked by SDL_LockTexture()
903 *
904 * \since This function is available since SDL 3.0.0.
905 *
906 * \sa SDL_LockTexture
907 */
908extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
909
910/**
911 * Set a texture as the current rendering target.
912 *
913 * The default render target is the window for which the renderer was created.
914 * To stop rendering to a texture and render to the window again, call this
915 * function with a NULL `texture`.
916 *
917 * \param renderer the rendering context
918 * \param texture the targeted texture, which must be created with the
919 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
920 * window instead of a texture.
921 * \returns 0 on success or a negative error code on failure; call
922 * SDL_GetError() for more information.
923 *
924 * \since This function is available since SDL 3.0.0.
925 *
926 * \sa SDL_GetRenderTarget
927 */
928extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
929
930/**
931 * Get the current render target.
932 *
933 * The default render target is the window for which the renderer was created,
934 * and is reported a NULL here.
935 *
936 * \param renderer the rendering context
937 * \returns the current render target or NULL for the default render target.
938 *
939 * \since This function is available since SDL 3.0.0.
940 *
941 * \sa SDL_SetRenderTarget
942 */
943extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
944
945/**
946 * Set a device independent resolution and presentation mode for rendering.
947 *
948 * This function sets the width and height of the logical rendering output. A
949 * render target is created at the specified size and used for rendering and
950 * then copied to the output during presentation.
951 *
952 * You can disable logical coordinates by setting the mode to
953 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
954 * resolution of the output window.
955 *
956 * You can convert coordinates in an event into rendering coordinates using
957 * SDL_ConvertEventToRenderCoordinates().
958 *
959 * \param renderer the rendering context
960 * \param w the width of the logical resolution
961 * \param h the height of the logical resolution
962 * \param mode the presentation mode used
963 * \param scale_mode the scale mode used
964 * \returns 0 on success or a negative error code on failure; call
965 * SDL_GetError() for more information.
966 *
967 * \since This function is available since SDL 3.0.0.
968 *
969 * \sa SDL_ConvertEventToRenderCoordinates
970 * \sa SDL_GetRenderLogicalPresentation
971 */
972extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
973
974/**
975 * Get device independent resolution and presentation mode for rendering.
976 *
977 * This function gets the width and height of the logical rendering output, or
978 * the output size in pixels if a logical resolution is not enabled.
979 *
980 * \param renderer the rendering context
981 * \param w an int to be filled with the width
982 * \param h an int to be filled with the height
983 * \param mode a pointer filled in with the presentation mode
984 * \param scale_mode a pointer filled in with the scale mode
985 * \returns 0 on success or a negative error code on failure; call
986 * SDL_GetError() for more information.
987 *
988 * \since This function is available since SDL 3.0.0.
989 *
990 * \sa SDL_SetRenderLogicalPresentation
991 */
992extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
993
994/**
995 * Get a point in render coordinates when given a point in window coordinates.
996 *
997 * \param renderer the rendering context
998 * \param window_x the x coordinate in window coordinates
999 * \param window_y the y coordinate in window coordinates
1000 * \param x a pointer filled with the x coordinate in render coordinates
1001 * \param y a pointer filled with the y coordinate in render coordinates
1002 * \returns 0 on success or a negative error code on failure; call
1003 * SDL_GetError() for more information.
1004 *
1005 * \since This function is available since SDL 3.0.0.
1006 *
1007 * \sa SDL_SetRenderLogicalPresentation
1008 * \sa SDL_SetRenderScale
1009 */
1010extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
1011
1012/**
1013 * Get a point in window coordinates when given a point in render coordinates.
1014 *
1015 * \param renderer the rendering context
1016 * \param x the x coordinate in render coordinates
1017 * \param y the y coordinate in render coordinates
1018 * \param window_x a pointer filled with the x coordinate in window
1019 * coordinates
1020 * \param window_y a pointer filled with the y coordinate in window
1021 * coordinates
1022 * \returns 0 on success or a negative error code on failure; call
1023 * SDL_GetError() for more information.
1024 *
1025 * \since This function is available since SDL 3.0.0.
1026 *
1027 * \sa SDL_SetRenderLogicalPresentation
1028 * \sa SDL_SetRenderScale
1029 */
1030extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
1031
1032/**
1033 * Convert the coordinates in an event to render coordinates.
1034 *
1035 * Touch coordinates are converted from normalized coordinates in the window
1036 * to non-normalized rendering coordinates.
1037 *
1038 * Once converted, the coordinates may be outside the rendering area.
1039 *
1040 * \param renderer the rendering context
1041 * \param event the event to modify
1042 * \returns 0 on success or a negative error code on failure; call
1043 * SDL_GetError() for more information.
1044 *
1045 * \since This function is available since SDL 3.0.0.
1046 *
1047 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
1048 */
1049extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
1050
1051/**
1052 * Set the drawing area for rendering on the current target.
1053 *
1054 * \param renderer the rendering context
1055 * \param rect the SDL_Rect structure representing the drawing area, or NULL
1056 * to set the viewport to the entire target
1057 * \returns 0 on success or a negative error code on failure; call
1058 * SDL_GetError() for more information.
1059 *
1060 * \since This function is available since SDL 3.0.0.
1061 *
1062 * \sa SDL_GetRenderViewport
1063 */
1064extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
1065
1066/**
1067 * Get the drawing area for the current target.
1068 *
1069 * \param renderer the rendering context
1070 * \param rect an SDL_Rect structure filled in with the current drawing area
1071 * \returns 0 on success or a negative error code on failure; call
1072 * SDL_GetError() for more information.
1073 *
1074 * \since This function is available since SDL 3.0.0.
1075 *
1076 * \sa SDL_SetRenderViewport
1077 */
1078extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
1079
1080/**
1081 * Set the clip rectangle for rendering on the specified target.
1082 *
1083 * \param renderer the rendering context
1084 * \param rect an SDL_Rect structure representing the clip area, relative to
1085 * the viewport, or NULL to disable clipping
1086 * \returns 0 on success or a negative error code on failure; call
1087 * SDL_GetError() for more information.
1088 *
1089 * \since This function is available since SDL 3.0.0.
1090 *
1091 * \sa SDL_GetRenderClipRect
1092 * \sa SDL_RenderClipEnabled
1093 */
1094extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
1095
1096/**
1097 * Get the clip rectangle for the current target.
1098 *
1099 * \param renderer the rendering context
1100 * \param rect an SDL_Rect structure filled in with the current clipping area
1101 * or an empty rectangle if clipping is disabled
1102 * \returns 0 on success or a negative error code on failure; call
1103 * SDL_GetError() for more information.
1104 *
1105 * \since This function is available since SDL 3.0.0.
1106 *
1107 * \sa SDL_RenderClipEnabled
1108 * \sa SDL_SetRenderClipRect
1109 */
1110extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1111
1112/**
1113 * Get whether clipping is enabled on the given renderer.
1114 *
1115 * \param renderer the rendering context
1116 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
1117 * SDL_GetError() for more information.
1118 *
1119 * \since This function is available since SDL 3.0.0.
1120 *
1121 * \sa SDL_GetRenderClipRect
1122 * \sa SDL_SetRenderClipRect
1123 */
1124extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1125
1126/**
1127 * Set the drawing scale for rendering on the current target.
1128 *
1129 * The drawing coordinates are scaled by the x/y scaling factors before they
1130 * are used by the renderer. This allows resolution independent drawing with a
1131 * single coordinate system.
1132 *
1133 * If this results in scaling or subpixel drawing by the rendering backend, it
1134 * will be handled using the appropriate quality hints. For best results use
1135 * integer scaling factors.
1136 *
1137 * \param renderer the rendering context
1138 * \param scaleX the horizontal scaling factor
1139 * \param scaleY the vertical scaling factor
1140 * \returns 0 on success or a negative error code on failure; call
1141 * SDL_GetError() for more information.
1142 *
1143 * \since This function is available since SDL 3.0.0.
1144 *
1145 * \sa SDL_GetRenderScale
1146 */
1147extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1148
1149/**
1150 * Get the drawing scale for the current target.
1151 *
1152 * \param renderer the rendering context
1153 * \param scaleX a pointer filled in with the horizontal scaling factor
1154 * \param scaleY a pointer filled in with the vertical scaling factor
1155 * \returns 0 on success or a negative error code on failure; call
1156 * SDL_GetError() for more information.
1157 *
1158 * \since This function is available since SDL 3.0.0.
1159 *
1160 * \sa SDL_SetRenderScale
1161 */
1162extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1163
1164/**
1165 * Set the color used for drawing operations (Rect, Line and Clear).
1166 *
1167 * Set the color for drawing or filling rectangles, lines, and points, and for
1168 * SDL_RenderClear().
1169 *
1170 * \param renderer the rendering context
1171 * \param r the red value used to draw on the rendering target
1172 * \param g the green value used to draw on the rendering target
1173 * \param b the blue value used to draw on the rendering target
1174 * \param a the alpha value used to draw on the rendering target; usually
1175 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1176 * specify how the alpha channel is used
1177 * \returns 0 on success or a negative error code on failure; call
1178 * SDL_GetError() for more information.
1179 *
1180 * \since This function is available since SDL 3.0.0.
1181 *
1182 * \sa SDL_GetRenderDrawColor
1183 * \sa SDL_RenderClear
1184 * \sa SDL_RenderLine
1185 * \sa SDL_RenderLines
1186 * \sa SDL_RenderPoint
1187 * \sa SDL_RenderPoints
1188 * \sa SDL_RenderRect
1189 * \sa SDL_RenderRects
1190 * \sa SDL_RenderFillRect
1191 * \sa SDL_RenderFillRects
1192 */
1193extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1194
1195/**
1196 * Get the color used for drawing operations (Rect, Line and Clear).
1197 *
1198 * \param renderer the rendering context
1199 * \param r a pointer filled in with the red value used to draw on the
1200 * rendering target
1201 * \param g a pointer filled in with the green value used to draw on the
1202 * rendering target
1203 * \param b a pointer filled in with the blue value used to draw on the
1204 * rendering target
1205 * \param a a pointer filled in with the alpha value used to draw on the
1206 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1207 * \returns 0 on success or a negative error code on failure; call
1208 * SDL_GetError() for more information.
1209 *
1210 * \since This function is available since SDL 3.0.0.
1211 *
1212 * \sa SDL_SetRenderDrawColor
1213 */
1214extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1215
1216/**
1217 * Set the blend mode used for drawing operations (Fill and Line).
1218 *
1219 * If the blend mode is not supported, the closest supported mode is chosen.
1220 *
1221 * \param renderer the rendering context
1222 * \param blendMode the SDL_BlendMode to use for blending
1223 * \returns 0 on success or a negative error code on failure; call
1224 * SDL_GetError() for more information.
1225 *
1226 * \since This function is available since SDL 3.0.0.
1227 *
1228 * \sa SDL_GetRenderDrawBlendMode
1229 * \sa SDL_RenderLine
1230 * \sa SDL_RenderLines
1231 * \sa SDL_RenderPoint
1232 * \sa SDL_RenderPoints
1233 * \sa SDL_RenderRect
1234 * \sa SDL_RenderRects
1235 * \sa SDL_RenderFillRect
1236 * \sa SDL_RenderFillRects
1237 */
1238extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1239
1240/**
1241 * Get the blend mode used for drawing operations.
1242 *
1243 * \param renderer the rendering context
1244 * \param blendMode a pointer filled in with the current SDL_BlendMode
1245 * \returns 0 on success or a negative error code on failure; call
1246 * SDL_GetError() for more information.
1247 *
1248 * \since This function is available since SDL 3.0.0.
1249 *
1250 * \sa SDL_SetRenderDrawBlendMode
1251 */
1252extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1253
1254/**
1255 * Clear the current rendering target with the drawing color.
1256 *
1257 * This function clears the entire rendering target, ignoring the viewport and
1258 * the clip rectangle.
1259 *
1260 * \param renderer the rendering context
1261 * \returns 0 on success or a negative error code on failure; call
1262 * SDL_GetError() for more information.
1263 *
1264 * \since This function is available since SDL 3.0.0.
1265 *
1266 * \sa SDL_SetRenderDrawColor
1267 */
1268extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1269
1270/**
1271 * Draw a point on the current rendering target at subpixel precision.
1272 *
1273 * \param renderer The renderer which should draw a point.
1274 * \param x The x coordinate of the point.
1275 * \param y The y coordinate of the point.
1276 * \returns 0 on success, or -1 on error
1277 *
1278 * \since This function is available since SDL 3.0.0.
1279 */
1280extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1281
1282/**
1283 * Draw multiple points on the current rendering target at subpixel precision.
1284 *
1285 * \param renderer The renderer which should draw multiple points.
1286 * \param points The points to draw
1287 * \param count The number of points to draw
1288 * \returns 0 on success or a negative error code on failure; call
1289 * SDL_GetError() for more information.
1290 *
1291 * \since This function is available since SDL 3.0.0.
1292 */
1293extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1294
1295/**
1296 * Draw a line on the current rendering target at subpixel precision.
1297 *
1298 * \param renderer The renderer which should draw a line.
1299 * \param x1 The x coordinate of the start point.
1300 * \param y1 The y coordinate of the start point.
1301 * \param x2 The x coordinate of the end point.
1302 * \param y2 The y coordinate of the end point.
1303 * \returns 0 on success, or -1 on error
1304 *
1305 * \since This function is available since SDL 3.0.0.
1306 */
1307extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1308
1309/**
1310 * Draw a series of connected lines on the current rendering target at
1311 * subpixel precision.
1312 *
1313 * \param renderer The renderer which should draw multiple lines.
1314 * \param points The points along the lines
1315 * \param count The number of points, drawing count-1 lines
1316 * \returns 0 on success or a negative error code on failure; call
1317 * SDL_GetError() for more information.
1318 *
1319 * \since This function is available since SDL 3.0.0.
1320 */
1321extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1322
1323/**
1324 * Draw a rectangle on the current rendering target at subpixel precision.
1325 *
1326 * \param renderer The renderer which should draw a rectangle.
1327 * \param rect A pointer to the destination rectangle, or NULL to outline the
1328 * entire rendering target.
1329 * \returns 0 on success, or -1 on error
1330 *
1331 * \since This function is available since SDL 3.0.0.
1332 */
1333extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1334
1335/**
1336 * Draw some number of rectangles on the current rendering target at subpixel
1337 * precision.
1338 *
1339 * \param renderer The renderer which should draw multiple rectangles.
1340 * \param rects A pointer to an array of destination rectangles.
1341 * \param count The number of rectangles.
1342 * \returns 0 on success or a negative error code on failure; call
1343 * SDL_GetError() for more information.
1344 *
1345 * \since This function is available since SDL 3.0.0.
1346 */
1347extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1348
1349/**
1350 * Fill a rectangle on the current rendering target with the drawing color at
1351 * subpixel precision.
1352 *
1353 * \param renderer The renderer which should fill a rectangle.
1354 * \param rect A pointer to the destination rectangle, or NULL for the entire
1355 * rendering target.
1356 * \returns 0 on success, or -1 on error
1357 *
1358 * \since This function is available since SDL 3.0.0.
1359 */
1360extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1361
1362/**
1363 * Fill some number of rectangles on the current rendering target with the
1364 * drawing color at subpixel precision.
1365 *
1366 * \param renderer The renderer which should fill multiple rectangles.
1367 * \param rects A pointer to an array of destination rectangles.
1368 * \param count The number of rectangles.
1369 * \returns 0 on success or a negative error code on failure; call
1370 * SDL_GetError() for more information.
1371 *
1372 * \since This function is available since SDL 3.0.0.
1373 */
1374extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1375
1376/**
1377 * Copy a portion of the texture to the current rendering target at subpixel
1378 * precision.
1379 *
1380 * \param renderer The renderer which should copy parts of a texture.
1381 * \param texture The source texture.
1382 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1383 * texture.
1384 * \param dstrect A pointer to the destination rectangle, or NULL for the
1385 * entire rendering target.
1386 * \returns 0 on success, or -1 on error
1387 *
1388 * \since This function is available since SDL 3.0.0.
1389 */
1390extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
1391
1392/**
1393 * Copy a portion of the source texture to the current rendering target, with
1394 * rotation and flipping, at subpixel precision.
1395 *
1396 * \param renderer The renderer which should copy parts of a texture.
1397 * \param texture The source texture.
1398 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1399 * texture.
1400 * \param dstrect A pointer to the destination rectangle, or NULL for the
1401 * entire rendering target.
1402 * \param angle An angle in degrees that indicates the rotation that will be
1403 * applied to dstrect, rotating it in a clockwise direction
1404 * \param center A pointer to a point indicating the point around which
1405 * dstrect will be rotated (if NULL, rotation will be done
1406 * around dstrect.w/2, dstrect.h/2).
1407 * \param flip An SDL_RendererFlip value stating which flipping actions should
1408 * be performed on the texture
1409 * \returns 0 on success or a negative error code on failure; call
1410 * SDL_GetError() for more information.
1411 *
1412 * \since This function is available since SDL 3.0.0.
1413 */
1414extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
1415 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
1416 const double angle, const SDL_FPoint *center,
1417 const SDL_RendererFlip flip);
1418
1419/**
1420 * Render a list of triangles, optionally using a texture and indices into the
1421 * vertex array Color and alpha modulation is done per vertex
1422 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1423 *
1424 * \param renderer The rendering context.
1425 * \param texture (optional) The SDL texture to use.
1426 * \param vertices Vertices.
1427 * \param num_vertices Number of vertices.
1428 * \param indices (optional) An array of integer indices into the 'vertices'
1429 * array, if NULL all vertices will be rendered in sequential
1430 * order.
1431 * \param num_indices Number of indices.
1432 * \returns 0 on success, or -1 if the operation is not supported
1433 *
1434 * \since This function is available since SDL 3.0.0.
1435 *
1436 * \sa SDL_RenderGeometryRaw
1437 * \sa SDL_Vertex
1438 */
1439extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1440 SDL_Texture *texture,
1441 const SDL_Vertex *vertices, int num_vertices,
1442 const int *indices, int num_indices);
1443
1444/**
1445 * Render a list of triangles, optionally using a texture and indices into the
1446 * vertex arrays Color and alpha modulation is done per vertex
1447 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1448 *
1449 * \param renderer The rendering context.
1450 * \param texture (optional) The SDL texture to use.
1451 * \param xy Vertex positions
1452 * \param xy_stride Byte size to move from one element to the next element
1453 * \param color Vertex colors (as SDL_Color)
1454 * \param color_stride Byte size to move from one element to the next element
1455 * \param uv Vertex normalized texture coordinates
1456 * \param uv_stride Byte size to move from one element to the next element
1457 * \param num_vertices Number of vertices.
1458 * \param indices (optional) An array of indices into the 'vertices' arrays,
1459 * if NULL all vertices will be rendered in sequential order.
1460 * \param num_indices Number of indices.
1461 * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
1462 * \returns 0 on success or a negative error code on failure; call
1463 * SDL_GetError() for more information.
1464 *
1465 * \since This function is available since SDL 3.0.0.
1466 *
1467 * \sa SDL_RenderGeometry
1468 * \sa SDL_Vertex
1469 */
1470extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1471 SDL_Texture *texture,
1472 const float *xy, int xy_stride,
1473 const SDL_Color *color, int color_stride,
1474 const float *uv, int uv_stride,
1475 int num_vertices,
1476 const void *indices, int num_indices, int size_indices);
1477
1478/**
1479 * Read pixels from the current rendering target to an array of pixels.
1480 *
1481 * **WARNING**: This is a very slow operation, and should not be used
1482 * frequently. If you're using this on the main rendering target, it should be
1483 * called after rendering and before SDL_RenderPresent().
1484 *
1485 * `pitch` specifies the number of bytes between rows in the destination
1486 * `pixels` data. This allows you to write to a subrectangle or have padded
1487 * rows in the destination. Generally, `pitch` should equal the number of
1488 * pixels per row in the `pixels` data times the number of bytes per pixel,
1489 * but it might contain additional padding (for example, 24bit RGB Windows
1490 * Bitmap data pads all rows to multiples of 4 bytes).
1491 *
1492 * \param renderer the rendering context
1493 * \param rect an SDL_Rect structure representing the area in pixels relative
1494 * to the to current viewport, or NULL for the entire viewport
1495 * \param format an SDL_PixelFormatEnum value of the desired format of the
1496 * pixel data, or 0 to use the format of the rendering target
1497 * \param pixels a pointer to the pixel data to copy into
1498 * \param pitch the pitch of the `pixels` parameter
1499 * \returns 0 on success or a negative error code on failure; call
1500 * SDL_GetError() for more information.
1501 *
1502 * \since This function is available since SDL 3.0.0.
1503 */
1504extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1505 const SDL_Rect *rect,
1506 Uint32 format,
1507 void *pixels, int pitch);
1508
1509/**
1510 * Update the screen with any rendering performed since the previous call.
1511 *
1512 * SDL's rendering functions operate on a backbuffer; that is, calling a
1513 * rendering function such as SDL_RenderLine() does not directly put a line on
1514 * the screen, but rather updates the backbuffer. As such, you compose your
1515 * entire scene and *present* the composed backbuffer to the screen as a
1516 * complete picture.
1517 *
1518 * Therefore, when using SDL's rendering API, one does all drawing intended
1519 * for the frame, and then calls this function once per frame to present the
1520 * final drawing to the user.
1521 *
1522 * The backbuffer should be considered invalidated after each present; do not
1523 * assume that previous contents will exist between frames. You are strongly
1524 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1525 * starting each new frame's drawing, even if you plan to overwrite every
1526 * pixel.
1527 *
1528 * \param renderer the rendering context
1529 * \returns 0 on success or a negative error code on failure; call
1530 * SDL_GetError() for more information.
1531 *
1532 * \threadsafety You may only call this function on the main thread.
1533 *
1534 * \since This function is available since SDL 3.0.0.
1535 *
1536 * \sa SDL_RenderClear
1537 * \sa SDL_RenderLine
1538 * \sa SDL_RenderLines
1539 * \sa SDL_RenderPoint
1540 * \sa SDL_RenderPoints
1541 * \sa SDL_RenderRect
1542 * \sa SDL_RenderRects
1543 * \sa SDL_RenderFillRect
1544 * \sa SDL_RenderFillRects
1545 * \sa SDL_SetRenderDrawBlendMode
1546 * \sa SDL_SetRenderDrawColor
1547 */
1548extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1549
1550/**
1551 * Destroy the specified texture.
1552 *
1553 * Passing NULL or an otherwise invalid texture will set the SDL error message
1554 * to "Invalid texture".
1555 *
1556 * \param texture the texture to destroy
1557 *
1558 * \since This function is available since SDL 3.0.0.
1559 *
1560 * \sa SDL_CreateTexture
1561 * \sa SDL_CreateTextureFromSurface
1562 */
1563extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1564
1565/**
1566 * Destroy the rendering context for a window and free associated textures.
1567 *
1568 * If `renderer` is NULL, this function will return immediately after setting
1569 * the SDL error message to "Invalid renderer". See SDL_GetError().
1570 *
1571 * \param renderer the rendering context
1572 *
1573 * \since This function is available since SDL 3.0.0.
1574 *
1575 * \sa SDL_CreateRenderer
1576 */
1577extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1578
1579/**
1580 * Force the rendering context to flush any pending commands and state.
1581 *
1582 * You do not need to (and in fact, shouldn't) call this function unless you
1583 * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
1584 * addition to using an SDL_Renderer.
1585 *
1586 * This is for a very-specific case: if you are using SDL's render API, and
1587 * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
1588 * calls. If this applies, you should call this function between calls to
1589 * SDL's render API and the low-level API you're using in cooperation.
1590 *
1591 * In all other cases, you can ignore this function.
1592 *
1593 * This call makes SDL flush any pending rendering work it was queueing up to
1594 * do later in a single batch, and marks any internal cached state as invalid,
1595 * so it'll prepare all its state again later, from scratch.
1596 *
1597 * This means you do not need to save state in your rendering code to protect
1598 * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
1599 * OpenGL state that can confuse things; you should use your best judgement
1600 * and be prepared to make changes if specific state needs to be protected.
1601 *
1602 * \param renderer the rendering context
1603 * \returns 0 on success or a negative error code on failure; call
1604 * SDL_GetError() for more information.
1605 *
1606 * \since This function is available since SDL 3.0.0.
1607 */
1608extern DECLSPEC int SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
1609
1610
1611/**
1612 * Bind an OpenGL/ES/ES2 texture to the current context.
1613 *
1614 * This is for use with OpenGL instructions when rendering OpenGL primitives
1615 * directly.
1616 *
1617 * If not NULL, `texw` and `texh` will be filled with the width and height
1618 * values suitable for the provided texture. In most cases, both will be 1.0,
1619 * however, on systems that support the GL_ARB_texture_rectangle extension,
1620 * these values will actually be the pixel width and height used to create the
1621 * texture, so this factor needs to be taken into account when providing
1622 * texture coordinates to OpenGL.
1623 *
1624 * You need a renderer to create an SDL_Texture, therefore you can only use
1625 * this function with an implicit OpenGL context from SDL_CreateRenderer(),
1626 * not with your own OpenGL context. If you need control over your OpenGL
1627 * context, you need to write your own texture-loading methods.
1628 *
1629 * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
1630 * re-order the color channels in the shaders phase, so the uploaded texture
1631 * may have swapped color channels.
1632 *
1633 * \param texture the texture to bind to the current OpenGL/ES/ES2 context
1634 * \param texw a pointer to a float value which will be filled with the
1635 * texture width or NULL if you don't need that value
1636 * \param texh a pointer to a float value which will be filled with the
1637 * texture height or NULL if you don't need that value
1638 * \returns 0 on success or a negative error code on failure; call
1639 * SDL_GetError() for more information.
1640 *
1641 * \since This function is available since SDL 3.0.0.
1642 *
1643 * \sa SDL_GL_MakeCurrent
1644 * \sa SDL_GL_UnbindTexture
1645 */
1646extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
1647
1648/**
1649 * Unbind an OpenGL/ES/ES2 texture from the current context.
1650 *
1651 * See SDL_GL_BindTexture() for examples on how to use these functions
1652 *
1653 * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
1654 * \returns 0 on success or a negative error code on failure; call
1655 * SDL_GetError() for more information.
1656 *
1657 * \since This function is available since SDL 3.0.0.
1658 *
1659 * \sa SDL_GL_BindTexture
1660 * \sa SDL_GL_MakeCurrent
1661 */
1662extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
1663
1664/**
1665 * Get the CAMetalLayer associated with the given Metal renderer.
1666 *
1667 * This function returns `void *`, so SDL doesn't have to include Metal's
1668 * headers, but it can be safely cast to a `CAMetalLayer *`.
1669 *
1670 * \param renderer The renderer to query
1671 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1672 * Metal renderer
1673 *
1674 * \since This function is available since SDL 3.0.0.
1675 *
1676 * \sa SDL_GetRenderMetalCommandEncoder
1677 */
1678extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1679
1680/**
1681 * Get the Metal command encoder for the current frame
1682 *
1683 * This function returns `void *`, so SDL doesn't have to include Metal's
1684 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1685 *
1686 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1687 * SDL a drawable to render to, which might happen if the window is
1688 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1689 * render targets, just the window's backbuffer. Check your return values!
1690 *
1691 * \param renderer The renderer to query
1692 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1693 * renderer isn't a Metal renderer or there was an error.
1694 *
1695 * \since This function is available since SDL 3.0.0.
1696 *
1697 * \sa SDL_GetRenderMetalLayer
1698 */
1699extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1700
1701/**
1702 * Toggle VSync of the given renderer.
1703 *
1704 * \param renderer The renderer to toggle
1705 * \param vsync 1 for on, 0 for off. All other values are reserved
1706 * \returns 0 on success or a negative error code on failure; call
1707 * SDL_GetError() for more information.
1708 *
1709 * \since This function is available since SDL 3.0.0.
1710 */
1711extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1712
1713/**
1714 * Get VSync of the given renderer.
1715 *
1716 * \param renderer The renderer to toggle
1717 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1718 * reserved
1719 * \returns 0 on success or a negative error code on failure; call
1720 * SDL_GetError() for more information.
1721 *
1722 * \since This function is available since SDL 3.0.0.
1723 */
1724extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
1725
1726/* Ends C function definitions when using C++ */
1727#ifdef __cplusplus
1728}
1729#endif
1730#include <SDL3/SDL_close_code.h>
1731
1732#endif /* SDL_render_h_ */
SDL_BlendMode
Uint32 SDL_PropertiesID
void SDL_DestroyTexture(SDL_Texture *texture)
int SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode)
int SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
struct SDL_Texture SDL_Texture
Definition SDL_render.h:140
int SDL_RenderClear(SDL_Renderer *renderer)
int SDL_RenderGeometryRaw(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
int SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
int SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_Window * SDL_GetRenderWindow(SDL_Renderer *renderer)
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)
int SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
int SDL_FlushRenderer(SDL_Renderer *renderer)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
void SDL_UnlockTexture(SDL_Texture *texture)
int SDL_GetNumRenderDrivers(void)
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_RendererFlags
Definition SDL_render.h:67
@ SDL_RENDERER_SOFTWARE
Definition SDL_render.h:68
@ SDL_RENDERER_ACCELERATED
Definition SDL_render.h:69
@ SDL_RENDERER_PRESENTVSYNC
Definition SDL_render.h:71
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props)
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
int SDL_GL_UnbindTexture(SDL_Texture *texture)
int SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
SDL_RendererFlip
Definition SDL_render.h:112
@ SDL_FLIP_VERTICAL
Definition SDL_render.h:115
@ SDL_FLIP_NONE
Definition SDL_render.h:113
@ SDL_FLIP_HORIZONTAL
Definition SDL_render.h:114
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
SDL_TextureAccess
Definition SDL_render.h:102
@ SDL_TEXTUREACCESS_STATIC
Definition SDL_render.h:103
@ SDL_TEXTUREACCESS_STREAMING
Definition SDL_render.h:104
@ SDL_TEXTUREACCESS_TARGET
Definition SDL_render.h:105
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
int SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
SDL_bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
int SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
SDL_RendererLogicalPresentation
Definition SDL_render.h:122
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition SDL_render.h:125
@ SDL_LOGICAL_PRESENTATION_DISABLED
Definition SDL_render.h:123
@ SDL_LOGICAL_PRESENTATION_OVERSCAN
Definition SDL_render.h:126
@ SDL_LOGICAL_PRESENTATION_STRETCH
Definition SDL_render.h:124
@ SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
Definition SDL_render.h:127
int SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
int SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
const char * SDL_GetRenderDriver(int index)
void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer)
int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)
int SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
struct SDL_Renderer SDL_Renderer
Definition SDL_render.h:134
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags)
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode)
int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
int SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
int SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
int SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_RenderPresent(SDL_Renderer *renderer)
uint8_t Uint8
Definition SDL_stdinc.h:149
int SDL_bool
Definition SDL_stdinc.h:136
uint32_t Uint32
Definition SDL_stdinc.h:173
SDL_ScaleMode
Definition SDL_surface.h:72
struct SDL_Window SDL_Window
Definition SDL_video.h:121
const char * name
Definition SDL_render.h:80
Uint32 texture_formats[16]
Definition SDL_render.h:83
Uint32 num_texture_formats
Definition SDL_render.h:82
SDL_FPoint tex_coord
Definition SDL_render.h:95
SDL_Color color
Definition SDL_render.h:94
SDL_FPoint position
Definition SDL_render.h:93