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