SDL 3.0
SDL_render.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 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 * # CategoryRender
24 *
25 * Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 *
29 * - single pixel points
30 * - single pixel lines
31 * - filled rectangles
32 * - texture images
33 * - 2D polygons
34 *
35 * The primitives may be drawn in opaque, blended, or additive modes.
36 *
37 * The texture images may be drawn in opaque, blended, or additive modes. They
38 * can have an additional color tint or alpha modulation applied to them, and
39 * may also be stretched with linear interpolation.
40 *
41 * This API is designed to accelerate simple 2D operations. You may want more
42 * functionality such as 3D polygons and particle effects, and in that case
43 * you should use SDL's OpenGL/Direct3D support, the SDL3 GPU API, or one of
44 * the many good 3D engines.
45 *
46 * These functions must be called from the main thread. See this bug for
47 * details: https://github.com/libsdl-org/SDL/issues/986
48 */
49
50#ifndef SDL_render_h_
51#define SDL_render_h_
52
53#include <SDL3/SDL_stdinc.h>
54#include <SDL3/SDL_blendmode.h>
55#include <SDL3/SDL_error.h>
56#include <SDL3/SDL_events.h>
57#include <SDL3/SDL_pixels.h>
58#include <SDL3/SDL_properties.h>
59#include <SDL3/SDL_rect.h>
60#include <SDL3/SDL_surface.h>
61#include <SDL3/SDL_video.h>
62#include <SDL3/SDL_gpu.h>
63
64#include <SDL3/SDL_begin_code.h>
65/* Set up for C function definitions, even when using C++ */
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70/**
71 * The name of the software renderer.
72 *
73 * \since This macro is available since SDL 3.2.0.
74 */
75#define SDL_SOFTWARE_RENDERER "software"
76
77/**
78 * Vertex structure.
79 *
80 * \since This struct is available since SDL 3.2.0.
81 */
82typedef struct SDL_Vertex
83{
84 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
85 SDL_FColor color; /**< Vertex color */
86 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
88
89/**
90 * The access pattern allowed for a texture.
91 *
92 * \since This enum is available since SDL 3.2.0.
93 */
95{
96 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
97 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
98 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
100
101/**
102 * The addressing mode for a texture when used in SDL_RenderGeometry().
103 *
104 * This affects how texture coordinates are interpreted outside of [0, 1]
105 *
106 * \since This enum is available since SDL 3.4.0.
107 */
109{
111 SDL_TEXTURE_ADDRESS_AUTO, /**< Wrapping is enabled if texture coordinates are outside [0, 1], this is the default */
112 SDL_TEXTURE_ADDRESS_CLAMP, /**< Texture coordinates are clamped to the [0, 1] range */
113 SDL_TEXTURE_ADDRESS_WRAP /**< The texture is repeated (tiled) */
115
116/**
117 * How the logical size is mapped to the output.
118 *
119 * \since This enum is available since SDL 3.2.0.
120 */
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 *
133 * \since This struct is available since SDL 3.2.0.
134 */
136
137#ifndef SDL_INTERNAL
138
139/**
140 * An efficient driver-specific representation of pixel data
141 *
142 * \since This struct is available since SDL 3.2.0.
143 *
144 * \sa SDL_CreateTexture
145 * \sa SDL_CreateTextureFromSurface
146 * \sa SDL_CreateTextureWithProperties
147 * \sa SDL_DestroyTexture
148 */
150{
151 SDL_PixelFormat format; /**< The format of the texture, read-only */
152 int w; /**< The width of the texture, read-only. */
153 int h; /**< The height of the texture, read-only. */
154
155 int refcount; /**< Application reference count, used when freeing texture */
156};
157#endif /* !SDL_INTERNAL */
158
159typedef struct SDL_Texture SDL_Texture;
160
161/* Function prototypes */
162
163/**
164 * Get the number of 2D rendering drivers available for the current display.
165 *
166 * A render driver is a set of code that handles rendering and texture
167 * management on a particular display. Normally there is only one, but some
168 * drivers may have several available with different capabilities.
169 *
170 * There may be none if SDL was compiled without render support.
171 *
172 * \returns the number of built in render drivers.
173 *
174 * \threadsafety It is safe to call this function from any thread.
175 *
176 * \since This function is available since SDL 3.2.0.
177 *
178 * \sa SDL_CreateRenderer
179 * \sa SDL_GetRenderDriver
180 */
181extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
182
183/**
184 * Use this function to get the name of a built in 2D rendering driver.
185 *
186 * The list of rendering drivers is given in the order that they are normally
187 * initialized by default; the drivers that seem more reasonable to choose
188 * first (as far as the SDL developers believe) are earlier in the list.
189 *
190 * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
191 * "direct3d12" or "metal". These never have Unicode characters, and are not
192 * meant to be proper names.
193 *
194 * \param index the index of the rendering driver; the value ranges from 0 to
195 * SDL_GetNumRenderDrivers() - 1.
196 * \returns the name of the rendering driver at the requested index, or NULL
197 * if an invalid index was specified.
198 *
199 * \threadsafety It is safe to call this function from any thread.
200 *
201 * \since This function is available since SDL 3.2.0.
202 *
203 * \sa SDL_GetNumRenderDrivers
204 */
205extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index);
206
207/**
208 * Create a window and default renderer.
209 *
210 * \param title the title of the window, in UTF-8 encoding.
211 * \param width the width of the window.
212 * \param height the height of the window.
213 * \param window_flags the flags used to create the window (see
214 * SDL_CreateWindow()).
215 * \param window a pointer filled with the window, or NULL on error.
216 * \param renderer a pointer filled with the renderer, or NULL on error.
217 * \returns true on success or false on failure; call SDL_GetError() for more
218 * information.
219 *
220 * \threadsafety This function should only be called on the main thread.
221 *
222 * \since This function is available since SDL 3.2.0.
223 *
224 * \sa SDL_CreateRenderer
225 * \sa SDL_CreateWindow
226 */
227extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer);
228
229/**
230 * Create a 2D rendering context for a window.
231 *
232 * If you want a specific renderer, you can specify its name here. A list of
233 * available renderers can be obtained by calling SDL_GetRenderDriver()
234 * multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you
235 * don't need a specific renderer, specify NULL and SDL will attempt to choose
236 * the best option for you, based on what is available on the user's system.
237 *
238 * If `name` is a comma-separated list, SDL will try each name, in the order
239 * listed, until one succeeds or all of them fail.
240 *
241 * By default the rendering size matches the window size in pixels, but you
242 * can call SDL_SetRenderLogicalPresentation() to change the content size and
243 * scaling options.
244 *
245 * \param window the window where rendering is displayed.
246 * \param name the name of the rendering driver to initialize, or NULL to let
247 * SDL choose one.
248 * \returns a valid rendering context or NULL if there was an error; call
249 * SDL_GetError() for more information.
250 *
251 * \threadsafety This function should only be called on the main thread.
252 *
253 * \since This function is available since SDL 3.2.0.
254 *
255 * \sa SDL_CreateRendererWithProperties
256 * \sa SDL_CreateSoftwareRenderer
257 * \sa SDL_DestroyRenderer
258 * \sa SDL_GetNumRenderDrivers
259 * \sa SDL_GetRenderDriver
260 * \sa SDL_GetRendererName
261 */
262extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name);
263
264/**
265 * Create a 2D rendering context for a window, with the specified properties.
266 *
267 * These are the supported properties:
268 *
269 * - `SDL_PROP_RENDERER_CREATE_NAME_STRING`: the name of the rendering driver
270 * to use, if a specific one is desired
271 * - `SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`: the window where rendering is
272 * displayed, required if this isn't a software renderer using a surface
273 * - `SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`: the surface where rendering
274 * is displayed, if you want a software renderer without a window
275 * - `SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace
276 * value describing the colorspace for output to the display, defaults to
277 * SDL_COLORSPACE_SRGB. The direct3d11, direct3d12, and metal renderers
278 * support SDL_COLORSPACE_SRGB_LINEAR, which is a linear color space and
279 * supports HDR output. If you select SDL_COLORSPACE_SRGB_LINEAR, drawing
280 * still uses the sRGB colorspace, but values can go beyond 1.0 and float
281 * (linear) format textures can be used for HDR content.
282 * - `SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER`: non-zero if you want
283 * present synchronized with the refresh rate. This property can take any
284 * value that is supported by SDL_SetRenderVSync() for the renderer.
285 *
286 * With the SDL GPU renderer:
287 *
288 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN`: the app is able to
289 * provide SPIR-V shaders to SDL_GPURenderState, optional.
290 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN`: the app is able to
291 * provide DXIL shaders to SDL_GPURenderState, optional.
292 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN`: the app is able to
293 * provide MSL shaders to SDL_GPURenderState, optional.
294 *
295 * With the vulkan renderer:
296 *
297 * - `SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER`: the VkInstance to use
298 * with the renderer, optional.
299 * - `SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR to use
300 * with the renderer, optional.
301 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER`: the
302 * VkPhysicalDevice to use with the renderer, optional.
303 * - `SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER`: the VkDevice to use
304 * with the renderer, optional.
305 * - `SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the
306 * queue family index used for rendering.
307 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the
308 * queue family index used for presentation.
309 *
310 * \param props the properties to use.
311 * \returns a valid rendering context or NULL if there was an error; call
312 * SDL_GetError() for more information.
313 *
314 * \threadsafety This function should only be called on the main thread.
315 *
316 * \since This function is available since SDL 3.2.0.
317 *
318 * \sa SDL_CreateProperties
319 * \sa SDL_CreateRenderer
320 * \sa SDL_CreateSoftwareRenderer
321 * \sa SDL_DestroyRenderer
322 * \sa SDL_GetRendererName
323 */
325
326#define SDL_PROP_RENDERER_CREATE_NAME_STRING "SDL.renderer.create.name"
327#define SDL_PROP_RENDERER_CREATE_WINDOW_POINTER "SDL.renderer.create.window"
328#define SDL_PROP_RENDERER_CREATE_SURFACE_POINTER "SDL.renderer.create.surface"
329#define SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.create.output_colorspace"
330#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER "SDL.renderer.create.present_vsync"
331#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN "SDL.renderer.create.gpu.shaders_spirv"
332#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN "SDL.renderer.create.gpu.shaders_dxil"
333#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN "SDL.renderer.create.gpu.shaders_msl"
334#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER "SDL.renderer.create.vulkan.instance"
335#define SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER "SDL.renderer.create.vulkan.surface"
336#define SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.create.vulkan.physical_device"
337#define SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER "SDL.renderer.create.vulkan.device"
338#define SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.graphics_queue_family_index"
339#define SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.present_queue_family_index"
340
341/**
342 * Create a 2D GPU rendering context for a window, with support for the
343 * specified shader format.
344 *
345 * This is a convenience function to create a SDL GPU backed renderer,
346 * intended to be used with SDL_GPURenderState. The resulting renderer will
347 * support shaders in one of the specified shader formats.
348 *
349 * If no available GPU driver supports any of the specified shader formats,
350 * this function will fail.
351 *
352 * \param window the window where rendering is displayed.
353 * \param format_flags a bitflag indicating which shader formats the app is
354 * able to provide.
355 * \param device a pointer filled with the associated GPU device, or NULL on
356 * error.
357 * \returns a valid rendering context or NULL if there was an error; call
358 * SDL_GetError() for more information.
359 *
360 * \threadsafety This function should only be called on the main thread.
361 *
362 * \since This function is available since SDL 3.4.0.
363 *
364 * \sa SDL_CreateRendererWithProperties
365 * \sa SDL_GetGPUShaderFormats
366 * \sa SDL_CreateGPUShader
367 * \sa SDL_CreateGPURenderState
368 * \sa SDL_SetRenderGPUState
369 */
370extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateGPURenderer(SDL_Window *window, SDL_GPUShaderFormat format_flags, SDL_GPUDevice **device);
371
372/**
373 * Create a 2D software rendering context for a surface.
374 *
375 * Two other API which can be used to create SDL_Renderer:
376 * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
377 * create a software renderer, but they are intended to be used with an
378 * SDL_Window as the final destination and not an SDL_Surface.
379 *
380 * \param surface the SDL_Surface structure representing the surface where
381 * rendering is done.
382 * \returns a valid rendering context or NULL if there was an error; call
383 * SDL_GetError() for more information.
384 *
385 * \threadsafety This function should only be called on the main thread.
386 *
387 * \since This function is available since SDL 3.2.0.
388 *
389 * \sa SDL_DestroyRenderer
390 */
391extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
392
393/**
394 * Get the renderer associated with a window.
395 *
396 * \param window the window to query.
397 * \returns the rendering context on success or NULL on failure; call
398 * SDL_GetError() for more information.
399 *
400 * \threadsafety It is safe to call this function from any thread.
401 *
402 * \since This function is available since SDL 3.2.0.
403 */
404extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window);
405
406/**
407 * Get the window associated with a renderer.
408 *
409 * \param renderer the renderer to query.
410 * \returns the window on success or NULL on failure; call SDL_GetError() for
411 * more information.
412 *
413 * \threadsafety It is safe to call this function from any thread.
414 *
415 * \since This function is available since SDL 3.2.0.
416 */
417extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
418
419/**
420 * Get the name of a renderer.
421 *
422 * \param renderer the rendering context.
423 * \returns the name of the selected renderer, or NULL on failure; call
424 * SDL_GetError() for more information.
425 *
426 * \threadsafety It is safe to call this function from any thread.
427 *
428 * \since This function is available since SDL 3.2.0.
429 *
430 * \sa SDL_CreateRenderer
431 * \sa SDL_CreateRendererWithProperties
432 */
433extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer);
434
435/**
436 * Get the properties associated with a renderer.
437 *
438 * The following read-only properties are provided by SDL:
439 *
440 * - `SDL_PROP_RENDERER_NAME_STRING`: the name of the rendering driver
441 * - `SDL_PROP_RENDERER_WINDOW_POINTER`: the window where rendering is
442 * displayed, if any
443 * - `SDL_PROP_RENDERER_SURFACE_POINTER`: the surface where rendering is
444 * displayed, if this is a software renderer without a window
445 * - `SDL_PROP_RENDERER_VSYNC_NUMBER`: the current vsync setting
446 * - `SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`: the maximum texture width
447 * and height
448 * - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormat *)
449 * array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
450 * representing the available texture formats for this renderer.
451 * - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace value
452 * describing the colorspace for output to the display, defaults to
453 * SDL_COLORSPACE_SRGB.
454 * - `SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN`: true if the output colorspace is
455 * SDL_COLORSPACE_SRGB_LINEAR and the renderer is showing on a display with
456 * HDR enabled. This property can change dynamically when
457 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
458 * - `SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT`: the value of SDR white in the
459 * SDL_COLORSPACE_SRGB_LINEAR colorspace. When HDR is enabled, this value is
460 * automatically multiplied into the color scale. This property can change
461 * dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
462 * - `SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT`: the additional high dynamic range
463 * that can be displayed, in terms of the SDR white point. When HDR is not
464 * enabled, this will be 1.0. This property can change dynamically when
465 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
466 *
467 * With the direct3d renderer:
468 *
469 * - `SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`: the IDirect3DDevice9 associated
470 * with the renderer
471 *
472 * With the direct3d11 renderer:
473 *
474 * - `SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`: the ID3D11Device associated
475 * with the renderer
476 * - `SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER`: the IDXGISwapChain1
477 * associated with the renderer. This may change when the window is resized.
478 *
479 * With the direct3d12 renderer:
480 *
481 * - `SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`: the ID3D12Device associated
482 * with the renderer
483 * - `SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER`: the IDXGISwapChain4
484 * associated with the renderer.
485 * - `SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`: the ID3D12CommandQueue
486 * associated with the renderer
487 *
488 * With the vulkan renderer:
489 *
490 * - `SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER`: the VkInstance associated
491 * with the renderer
492 * - `SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR associated
493 * with the renderer
494 * - `SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER`: the VkPhysicalDevice
495 * associated with the renderer
496 * - `SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER`: the VkDevice associated with
497 * the renderer
498 * - `SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the queue
499 * family index used for rendering
500 * - `SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the queue
501 * family index used for presentation
502 * - `SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`: the number of
503 * swapchain images, or potential frames in flight, used by the Vulkan
504 * renderer
505 *
506 * With the gpu renderer:
507 *
508 * - `SDL_PROP_RENDERER_GPU_DEVICE_POINTER`: the SDL_GPUDevice associated with
509 * the renderer
510 *
511 * \param renderer the rendering context.
512 * \returns a valid property ID on success or 0 on failure; call
513 * SDL_GetError() for more information.
514 *
515 * \threadsafety It is safe to call this function from any thread.
516 *
517 * \since This function is available since SDL 3.2.0.
518 */
520
521#define SDL_PROP_RENDERER_NAME_STRING "SDL.renderer.name"
522#define SDL_PROP_RENDERER_WINDOW_POINTER "SDL.renderer.window"
523#define SDL_PROP_RENDERER_SURFACE_POINTER "SDL.renderer.surface"
524#define SDL_PROP_RENDERER_VSYNC_NUMBER "SDL.renderer.vsync"
525#define SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER "SDL.renderer.max_texture_size"
526#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER "SDL.renderer.texture_formats"
527#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.output_colorspace"
528#define SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN "SDL.renderer.HDR_enabled"
529#define SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT "SDL.renderer.SDR_white_point"
530#define SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT "SDL.renderer.HDR_headroom"
531#define SDL_PROP_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device"
532#define SDL_PROP_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device"
533#define SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER "SDL.renderer.d3d11.swap_chain"
534#define SDL_PROP_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device"
535#define SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER "SDL.renderer.d3d12.swap_chain"
536#define SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER "SDL.renderer.d3d12.command_queue"
537#define SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER "SDL.renderer.vulkan.instance"
538#define SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER "SDL.renderer.vulkan.surface"
539#define SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.vulkan.physical_device"
540#define SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER "SDL.renderer.vulkan.device"
541#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.graphics_queue_family_index"
542#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.present_queue_family_index"
543#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER "SDL.renderer.vulkan.swapchain_image_count"
544#define SDL_PROP_RENDERER_GPU_DEVICE_POINTER "SDL.renderer.gpu.device"
545
546/**
547 * Get the output size in pixels of a rendering context.
548 *
549 * This returns the true output size in pixels, ignoring any render targets or
550 * logical size and presentation.
551 *
552 * For the output size of the current rendering target, with logical size
553 * adjustments, use SDL_GetCurrentRenderOutputSize() instead.
554 *
555 * \param renderer the rendering context.
556 * \param w a pointer filled in with the width in pixels.
557 * \param h a pointer filled in with the height in pixels.
558 * \returns true on success or false on failure; call SDL_GetError() for more
559 * information.
560 *
561 * \threadsafety This function should only be called on the main thread.
562 *
563 * \since This function is available since SDL 3.2.0.
564 *
565 * \sa SDL_GetCurrentRenderOutputSize
566 */
567extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
568
569/**
570 * Get the current output size in pixels of a rendering context.
571 *
572 * If a rendering target is active, this will return the size of the rendering
573 * target in pixels, otherwise return the value of SDL_GetRenderOutputSize().
574 *
575 * Rendering target or not, the output will be adjusted by the current logical
576 * presentation state, dictated by SDL_SetRenderLogicalPresentation().
577 *
578 * \param renderer the rendering context.
579 * \param w a pointer filled in with the current width.
580 * \param h a pointer filled in with the current height.
581 * \returns true on success or false on failure; call SDL_GetError() for more
582 * information.
583 *
584 * \threadsafety This function should only be called on the main thread.
585 *
586 * \since This function is available since SDL 3.2.0.
587 *
588 * \sa SDL_GetRenderOutputSize
589 */
590extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
591
592/**
593 * Create a texture for a rendering context.
594 *
595 * The contents of a texture when first created are not defined.
596 *
597 * \param renderer the rendering context.
598 * \param format one of the enumerated values in SDL_PixelFormat.
599 * \param access one of the enumerated values in SDL_TextureAccess.
600 * \param w the width of the texture in pixels.
601 * \param h the height of the texture in pixels.
602 * \returns the created texture or NULL on failure; call SDL_GetError() for
603 * more information.
604 *
605 * \threadsafety This function should only be called on the main thread.
606 *
607 * \since This function is available since SDL 3.2.0.
608 *
609 * \sa SDL_CreateTextureFromSurface
610 * \sa SDL_CreateTextureWithProperties
611 * \sa SDL_DestroyTexture
612 * \sa SDL_GetTextureSize
613 * \sa SDL_UpdateTexture
614 */
616
617/**
618 * Create a texture from an existing surface.
619 *
620 * The surface is not modified or freed by this function.
621 *
622 * The SDL_TextureAccess hint for the created texture is
623 * `SDL_TEXTUREACCESS_STATIC`.
624 *
625 * The pixel format of the created texture may be different from the pixel
626 * format of the surface, and can be queried using the
627 * SDL_PROP_TEXTURE_FORMAT_NUMBER property.
628 *
629 * \param renderer the rendering context.
630 * \param surface the SDL_Surface structure containing pixel data used to fill
631 * the texture.
632 * \returns the created texture or NULL on failure; call SDL_GetError() for
633 * more information.
634 *
635 * \threadsafety This function should only be called on the main thread.
636 *
637 * \since This function is available since SDL 3.2.0.
638 *
639 * \sa SDL_CreateTexture
640 * \sa SDL_CreateTextureWithProperties
641 * \sa SDL_DestroyTexture
642 */
644
645/**
646 * Create a texture for a rendering context with the specified properties.
647 *
648 * These are the supported properties:
649 *
650 * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_Colorspace value
651 * describing the texture colorspace, defaults to SDL_COLORSPACE_SRGB_LINEAR
652 * for floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures,
653 * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for
654 * YUV textures.
655 * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in
656 * SDL_PixelFormat, defaults to the best RGBA format for the renderer
657 * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in
658 * SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC
659 * - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in
660 * pixels, required
661 * - `SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`: the height of the texture in
662 * pixels, required
663 * - `SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating
664 * point textures, this defines the value of 100% diffuse white, with higher
665 * values being displayed in the High Dynamic Range headroom. This defaults
666 * to 100 for HDR10 textures and 1.0 for floating point textures.
667 * - `SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT`: for HDR10 and floating
668 * point textures, this defines the maximum dynamic range used by the
669 * content, in terms of the SDR white point. This would be equivalent to
670 * maxCLL / SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT for HDR10 content.
671 * If this is defined, any values outside the range supported by the display
672 * will be scaled into the available HDR headroom, otherwise they are
673 * clipped.
674 *
675 * With the direct3d11 renderer:
676 *
677 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D
678 * associated with the texture, if you want to wrap an existing texture.
679 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
680 * associated with the U plane of a YUV texture, if you want to wrap an
681 * existing texture.
682 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
683 * associated with the V plane of a YUV texture, if you want to wrap an
684 * existing texture.
685 *
686 * With the direct3d12 renderer:
687 *
688 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`: the ID3D12Resource
689 * associated with the texture, if you want to wrap an existing texture.
690 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource
691 * associated with the U plane of a YUV texture, if you want to wrap an
692 * existing texture.
693 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource
694 * associated with the V plane of a YUV texture, if you want to wrap an
695 * existing texture.
696 *
697 * With the metal renderer:
698 *
699 * - `SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER`: the CVPixelBufferRef
700 * associated with the texture, if you want to create a texture from an
701 * existing pixel buffer.
702 *
703 * With the opengl renderer:
704 *
705 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`: the GLuint texture
706 * associated with the texture, if you want to wrap an existing texture.
707 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
708 * associated with the UV plane of an NV12 texture, if you want to wrap an
709 * existing texture.
710 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture
711 * associated with the U plane of a YUV texture, if you want to wrap an
712 * existing texture.
713 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture
714 * associated with the V plane of a YUV texture, if you want to wrap an
715 * existing texture.
716 *
717 * With the opengles2 renderer:
718 *
719 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
720 * associated with the texture, if you want to wrap an existing texture.
721 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
722 * associated with the texture, if you want to wrap an existing texture.
723 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
724 * associated with the UV plane of an NV12 texture, if you want to wrap an
725 * existing texture.
726 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
727 * associated with the U plane of a YUV texture, if you want to wrap an
728 * existing texture.
729 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
730 * associated with the V plane of a YUV texture, if you want to wrap an
731 * existing texture.
732 *
733 * With the vulkan renderer:
734 *
735 * - `SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`: the VkImage with layout
736 * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL associated with the texture, if
737 * you want to wrap an existing texture.
738 *
739 * \param renderer the rendering context.
740 * \param props the properties to use.
741 * \returns the created texture or NULL on failure; call SDL_GetError() for
742 * more information.
743 *
744 * \threadsafety This function should only be called on the main thread.
745 *
746 * \since This function is available since SDL 3.2.0.
747 *
748 * \sa SDL_CreateProperties
749 * \sa SDL_CreateTexture
750 * \sa SDL_CreateTextureFromSurface
751 * \sa SDL_DestroyTexture
752 * \sa SDL_GetTextureSize
753 * \sa SDL_UpdateTexture
754 */
756
757#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER "SDL.texture.create.colorspace"
758#define SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER "SDL.texture.create.format"
759#define SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER "SDL.texture.create.access"
760#define SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER "SDL.texture.create.width"
761#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER "SDL.texture.create.height"
762#define SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT "SDL.texture.create.SDR_white_point"
763#define SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT "SDL.texture.create.HDR_headroom"
764#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "SDL.texture.create.d3d11.texture"
765#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER "SDL.texture.create.d3d11.texture_u"
766#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER "SDL.texture.create.d3d11.texture_v"
767#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "SDL.texture.create.d3d12.texture"
768#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER "SDL.texture.create.d3d12.texture_u"
769#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER "SDL.texture.create.d3d12.texture_v"
770#define SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER "SDL.texture.create.metal.pixelbuffer"
771#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER "SDL.texture.create.opengl.texture"
772#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.create.opengl.texture_uv"
773#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.create.opengl.texture_u"
774#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.create.opengl.texture_v"
775#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.create.opengles2.texture"
776#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.create.opengles2.texture_uv"
777#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.create.opengles2.texture_u"
778#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.create.opengles2.texture_v"
779#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER "SDL.texture.create.vulkan.texture"
780
781/**
782 * Get the properties associated with a texture.
783 *
784 * The following read-only properties are provided by SDL:
785 *
786 * - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_Colorspace value describing
787 * the texture colorspace.
788 * - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
789 * SDL_PixelFormat.
790 * - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
791 * SDL_TextureAccess.
792 * - `SDL_PROP_TEXTURE_WIDTH_NUMBER`: the width of the texture in pixels.
793 * - `SDL_PROP_TEXTURE_HEIGHT_NUMBER`: the height of the texture in pixels.
794 * - `SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
795 * textures, this defines the value of 100% diffuse white, with higher
796 * values being displayed in the High Dynamic Range headroom. This defaults
797 * to 100 for HDR10 textures and 1.0 for other textures.
798 * - `SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
799 * textures, this defines the maximum dynamic range used by the content, in
800 * terms of the SDR white point. If this is defined, any values outside the
801 * range supported by the display will be scaled into the available HDR
802 * headroom, otherwise they are clipped. This defaults to 1.0 for SDR
803 * textures, 4.0 for HDR10 textures, and no default for floating point
804 * textures.
805 *
806 * With the direct3d11 renderer:
807 *
808 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D associated
809 * with the texture
810 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
811 * associated with the U plane of a YUV texture
812 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
813 * associated with the V plane of a YUV texture
814 *
815 * With the direct3d12 renderer:
816 *
817 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`: the ID3D12Resource associated
818 * with the texture
819 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource associated
820 * with the U plane of a YUV texture
821 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource associated
822 * with the V plane of a YUV texture
823 *
824 * With the vulkan renderer:
825 *
826 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`: the VkImage associated with the
827 * texture
828 *
829 * With the opengl renderer:
830 *
831 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`: the GLuint texture associated
832 * with the texture
833 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
834 * associated with the UV plane of an NV12 texture
835 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture associated
836 * with the U plane of a YUV texture
837 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture associated
838 * with the V plane of a YUV texture
839 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`: the GLenum for the
840 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc)
841 * - `SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`: the texture coordinate width of
842 * the texture (0.0 - 1.0)
843 * - `SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`: the texture coordinate height of
844 * the texture (0.0 - 1.0)
845 *
846 * With the opengles2 renderer:
847 *
848 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
849 * associated with the texture
850 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
851 * associated with the UV plane of an NV12 texture
852 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
853 * associated with the U plane of a YUV texture
854 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
855 * associated with the V plane of a YUV texture
856 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the
857 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
858 *
859 * \param texture the texture to query.
860 * \returns a valid property ID on success or 0 on failure; call
861 * SDL_GetError() for more information.
862 *
863 * \threadsafety It is safe to call this function from any thread.
864 *
865 * \since This function is available since SDL 3.2.0.
866 */
867extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
868
869#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER "SDL.texture.colorspace"
870#define SDL_PROP_TEXTURE_FORMAT_NUMBER "SDL.texture.format"
871#define SDL_PROP_TEXTURE_ACCESS_NUMBER "SDL.texture.access"
872#define SDL_PROP_TEXTURE_WIDTH_NUMBER "SDL.texture.width"
873#define SDL_PROP_TEXTURE_HEIGHT_NUMBER "SDL.texture.height"
874#define SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT "SDL.texture.SDR_white_point"
875#define SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT "SDL.texture.HDR_headroom"
876#define SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture"
877#define SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER "SDL.texture.d3d11.texture_u"
878#define SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER "SDL.texture.d3d11.texture_v"
879#define SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture"
880#define SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER "SDL.texture.d3d12.texture_u"
881#define SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER "SDL.texture.d3d12.texture_v"
882#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture"
883#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.opengl.texture_uv"
884#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.opengl.texture_u"
885#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.opengl.texture_v"
886#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER "SDL.texture.opengl.target"
887#define SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w"
888#define SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h"
889#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture"
890#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.opengles2.texture_uv"
891#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.opengles2.texture_u"
892#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
893#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER "SDL.texture.opengles2.target"
894#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER "SDL.texture.vulkan.texture"
895
896/**
897 * Get the renderer that created an SDL_Texture.
898 *
899 * \param texture the texture to query.
900 * \returns a pointer to the SDL_Renderer that created the texture, or NULL on
901 * failure; call SDL_GetError() for more information.
902 *
903 * \threadsafety It is safe to call this function from any thread.
904 *
905 * \since This function is available since SDL 3.2.0.
906 */
907extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Texture *texture);
908
909/**
910 * Get the size of a texture, as floating point values.
911 *
912 * \param texture the texture to query.
913 * \param w a pointer filled in with the width of the texture in pixels. This
914 * argument can be NULL if you don't need this information.
915 * \param h a pointer filled in with the height of the texture in pixels. This
916 * argument can be NULL if you don't need this information.
917 * \returns true on success or false on failure; call SDL_GetError() for more
918 * information.
919 *
920 * \threadsafety This function should only be called on the main thread.
921 *
922 * \since This function is available since SDL 3.2.0.
923 */
924extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h);
925
926/**
927 * Set an additional color value multiplied into render copy operations.
928 *
929 * When this texture is rendered, during the copy operation each source color
930 * channel is modulated by the appropriate color value according to the
931 * following formula:
932 *
933 * `srcC = srcC * (color / 255)`
934 *
935 * Color modulation is not always supported by the renderer; it will return
936 * false if color modulation is not supported.
937 *
938 * \param texture the texture to update.
939 * \param r the red color value multiplied into copy operations.
940 * \param g the green color value multiplied into copy operations.
941 * \param b the blue color value multiplied into copy operations.
942 * \returns true on success or false on failure; call SDL_GetError() for more
943 * information.
944 *
945 * \threadsafety This function should only be called on the main thread.
946 *
947 * \since This function is available since SDL 3.2.0.
948 *
949 * \sa SDL_GetTextureColorMod
950 * \sa SDL_SetTextureAlphaMod
951 * \sa SDL_SetTextureColorModFloat
952 */
953extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
954
955
956/**
957 * Set an additional color value multiplied into render copy operations.
958 *
959 * When this texture is rendered, during the copy operation each source color
960 * channel is modulated by the appropriate color value according to the
961 * following formula:
962 *
963 * `srcC = srcC * color`
964 *
965 * Color modulation is not always supported by the renderer; it will return
966 * false if color modulation is not supported.
967 *
968 * \param texture the texture to update.
969 * \param r the red color value multiplied into copy operations.
970 * \param g the green color value multiplied into copy operations.
971 * \param b the blue color value multiplied into copy operations.
972 * \returns true on success or false on failure; call SDL_GetError() for more
973 * information.
974 *
975 * \threadsafety This function should only be called on the main thread.
976 *
977 * \since This function is available since SDL 3.2.0.
978 *
979 * \sa SDL_GetTextureColorModFloat
980 * \sa SDL_SetTextureAlphaModFloat
981 * \sa SDL_SetTextureColorMod
982 */
983extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b);
984
985
986/**
987 * Get the additional color value multiplied into render copy operations.
988 *
989 * \param texture the texture to query.
990 * \param r a pointer filled in with the current red color value.
991 * \param g a pointer filled in with the current green color value.
992 * \param b a pointer filled in with the current blue color value.
993 * \returns true on success or false on failure; call SDL_GetError() for more
994 * information.
995 *
996 * \threadsafety This function should only be called on the main thread.
997 *
998 * \since This function is available since SDL 3.2.0.
999 *
1000 * \sa SDL_GetTextureAlphaMod
1001 * \sa SDL_GetTextureColorModFloat
1002 * \sa SDL_SetTextureColorMod
1003 */
1004extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
1005
1006/**
1007 * Get the additional color value multiplied into render copy operations.
1008 *
1009 * \param texture the texture to query.
1010 * \param r a pointer filled in with the current red color value.
1011 * \param g a pointer filled in with the current green color value.
1012 * \param b a pointer filled in with the current blue color value.
1013 * \returns true on success or false on failure; call SDL_GetError() for more
1014 * information.
1015 *
1016 * \threadsafety This function should only be called on the main thread.
1017 *
1018 * \since This function is available since SDL 3.2.0.
1019 *
1020 * \sa SDL_GetTextureAlphaModFloat
1021 * \sa SDL_GetTextureColorMod
1022 * \sa SDL_SetTextureColorModFloat
1023 */
1024extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b);
1025
1026/**
1027 * Set an additional alpha value multiplied into render copy operations.
1028 *
1029 * When this texture is rendered, during the copy operation the source alpha
1030 * value is modulated by this alpha value according to the following formula:
1031 *
1032 * `srcA = srcA * (alpha / 255)`
1033 *
1034 * Alpha modulation is not always supported by the renderer; it will return
1035 * false if alpha modulation is not supported.
1036 *
1037 * \param texture the texture to update.
1038 * \param alpha the source alpha value multiplied into copy operations.
1039 * \returns true on success or false on failure; call SDL_GetError() for more
1040 * information.
1041 *
1042 * \threadsafety This function should only be called on the main thread.
1043 *
1044 * \since This function is available since SDL 3.2.0.
1045 *
1046 * \sa SDL_GetTextureAlphaMod
1047 * \sa SDL_SetTextureAlphaModFloat
1048 * \sa SDL_SetTextureColorMod
1049 */
1050extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
1051
1052/**
1053 * Set an additional alpha value multiplied into render copy operations.
1054 *
1055 * When this texture is rendered, during the copy operation the source alpha
1056 * value is modulated by this alpha value according to the following formula:
1057 *
1058 * `srcA = srcA * alpha`
1059 *
1060 * Alpha modulation is not always supported by the renderer; it will return
1061 * false if alpha modulation is not supported.
1062 *
1063 * \param texture the texture to update.
1064 * \param alpha the source alpha value multiplied into copy operations.
1065 * \returns true on success or false on failure; call SDL_GetError() for more
1066 * information.
1067 *
1068 * \threadsafety This function should only be called on the main thread.
1069 *
1070 * \since This function is available since SDL 3.2.0.
1071 *
1072 * \sa SDL_GetTextureAlphaModFloat
1073 * \sa SDL_SetTextureAlphaMod
1074 * \sa SDL_SetTextureColorModFloat
1075 */
1076extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha);
1077
1078/**
1079 * Get the additional alpha value multiplied into render copy operations.
1080 *
1081 * \param texture the texture to query.
1082 * \param alpha a pointer filled in with the current alpha value.
1083 * \returns true on success or false on failure; call SDL_GetError() for more
1084 * information.
1085 *
1086 * \threadsafety This function should only be called on the main thread.
1087 *
1088 * \since This function is available since SDL 3.2.0.
1089 *
1090 * \sa SDL_GetTextureAlphaModFloat
1091 * \sa SDL_GetTextureColorMod
1092 * \sa SDL_SetTextureAlphaMod
1093 */
1094extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
1095
1096/**
1097 * Get the additional alpha value multiplied into render copy operations.
1098 *
1099 * \param texture the texture to query.
1100 * \param alpha a pointer filled in with the current alpha value.
1101 * \returns true on success or false on failure; call SDL_GetError() for more
1102 * information.
1103 *
1104 * \threadsafety This function should only be called on the main thread.
1105 *
1106 * \since This function is available since SDL 3.2.0.
1107 *
1108 * \sa SDL_GetTextureAlphaMod
1109 * \sa SDL_GetTextureColorModFloat
1110 * \sa SDL_SetTextureAlphaModFloat
1111 */
1112extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha);
1113
1114/**
1115 * Set the blend mode for a texture, used by SDL_RenderTexture().
1116 *
1117 * If the blend mode is not supported, the closest supported mode is chosen
1118 * and this function returns false.
1119 *
1120 * \param texture the texture to update.
1121 * \param blendMode the SDL_BlendMode to use for texture blending.
1122 * \returns true on success or false on failure; call SDL_GetError() for more
1123 * information.
1124 *
1125 * \threadsafety This function should only be called on the main thread.
1126 *
1127 * \since This function is available since SDL 3.2.0.
1128 *
1129 * \sa SDL_GetTextureBlendMode
1130 */
1131extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
1132
1133/**
1134 * Get the blend mode used for texture copy operations.
1135 *
1136 * \param texture the texture to query.
1137 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1138 * \returns true on success or false on failure; call SDL_GetError() for more
1139 * information.
1140 *
1141 * \threadsafety This function should only be called on the main thread.
1142 *
1143 * \since This function is available since SDL 3.2.0.
1144 *
1145 * \sa SDL_SetTextureBlendMode
1146 */
1147extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
1148
1149/**
1150 * Set the scale mode used for texture scale operations.
1151 *
1152 * The default texture scale mode is SDL_SCALEMODE_LINEAR.
1153 *
1154 * If the scale mode is not supported, the closest supported mode is chosen.
1155 *
1156 * \param texture the texture to update.
1157 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
1158 * \returns true on success or false on failure; call SDL_GetError() for more
1159 * information.
1160 *
1161 * \threadsafety This function should only be called on the main thread.
1162 *
1163 * \since This function is available since SDL 3.2.0.
1164 *
1165 * \sa SDL_GetTextureScaleMode
1166 */
1167extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
1168
1169/**
1170 * Get the scale mode used for texture scale operations.
1171 *
1172 * \param texture the texture to query.
1173 * \param scaleMode a pointer filled in with the current scale mode.
1174 * \returns true on success or false on failure; call SDL_GetError() for more
1175 * information.
1176 *
1177 * \threadsafety This function should only be called on the main thread.
1178 *
1179 * \since This function is available since SDL 3.2.0.
1180 *
1181 * \sa SDL_SetTextureScaleMode
1182 */
1183extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
1184
1185/**
1186 * Update the given texture rectangle with new pixel data.
1187 *
1188 * The pixel data must be in the pixel format of the texture, which can be
1189 * queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
1190 *
1191 * This is a fairly slow function, intended for use with static textures that
1192 * do not change often.
1193 *
1194 * If the texture is intended to be updated often, it is preferred to create
1195 * the texture as streaming and use the locking functions referenced below.
1196 * While this function will work with streaming textures, for optimization
1197 * reasons you may not get the pixels back if you lock the texture afterward.
1198 *
1199 * \param texture the texture to update.
1200 * \param rect an SDL_Rect structure representing the area to update, or NULL
1201 * to update the entire texture.
1202 * \param pixels the raw pixel data in the format of the texture.
1203 * \param pitch the number of bytes in a row of pixel data, including padding
1204 * between lines.
1205 * \returns true on success or false on failure; call SDL_GetError() for more
1206 * information.
1207 *
1208 * \threadsafety This function should only be called on the main thread.
1209 *
1210 * \since This function is available since SDL 3.2.0.
1211 *
1212 * \sa SDL_LockTexture
1213 * \sa SDL_UnlockTexture
1214 * \sa SDL_UpdateNVTexture
1215 * \sa SDL_UpdateYUVTexture
1216 */
1217extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
1218
1219/**
1220 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
1221 * data.
1222 *
1223 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1224 * block of Y and U/V planes in the proper order, but this function is
1225 * available if your pixel data is not contiguous.
1226 *
1227 * \param texture the texture to update.
1228 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1229 * update the entire texture.
1230 * \param Yplane the raw pixel data for the Y plane.
1231 * \param Ypitch the number of bytes between rows of pixel data for the Y
1232 * plane.
1233 * \param Uplane the raw pixel data for the U plane.
1234 * \param Upitch the number of bytes between rows of pixel data for the U
1235 * plane.
1236 * \param Vplane the raw pixel data for the V plane.
1237 * \param Vpitch the number of bytes between rows of pixel data for the V
1238 * plane.
1239 * \returns true on success or false on failure; call SDL_GetError() for more
1240 * information.
1241 *
1242 * \threadsafety This function should only be called on the main thread.
1243 *
1244 * \since This function is available since SDL 3.2.0.
1245 *
1246 * \sa SDL_UpdateNVTexture
1247 * \sa SDL_UpdateTexture
1248 */
1249extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
1250 const SDL_Rect *rect,
1251 const Uint8 *Yplane, int Ypitch,
1252 const Uint8 *Uplane, int Upitch,
1253 const Uint8 *Vplane, int Vpitch);
1254
1255/**
1256 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
1257 *
1258 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1259 * block of NV12/21 planes in the proper order, but this function is available
1260 * if your pixel data is not contiguous.
1261 *
1262 * \param texture the texture to update.
1263 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1264 * update the entire texture.
1265 * \param Yplane the raw pixel data for the Y plane.
1266 * \param Ypitch the number of bytes between rows of pixel data for the Y
1267 * plane.
1268 * \param UVplane the raw pixel data for the UV plane.
1269 * \param UVpitch the number of bytes between rows of pixel data for the UV
1270 * plane.
1271 * \returns true on success or false on failure; call SDL_GetError() for more
1272 * information.
1273 *
1274 * \threadsafety This function should only be called on the main thread.
1275 *
1276 * \since This function is available since SDL 3.2.0.
1277 *
1278 * \sa SDL_UpdateTexture
1279 * \sa SDL_UpdateYUVTexture
1280 */
1281extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
1282 const SDL_Rect *rect,
1283 const Uint8 *Yplane, int Ypitch,
1284 const Uint8 *UVplane, int UVpitch);
1285
1286/**
1287 * Lock a portion of the texture for **write-only** pixel access.
1288 *
1289 * As an optimization, the pixels made available for editing don't necessarily
1290 * contain the old texture data. This is a write-only operation, and if you
1291 * need to keep a copy of the texture data you should do that at the
1292 * application level.
1293 *
1294 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1295 * changes.
1296 *
1297 * \param texture the texture to lock for access, which was created with
1298 * `SDL_TEXTUREACCESS_STREAMING`.
1299 * \param rect an SDL_Rect structure representing the area to lock for access;
1300 * NULL to lock the entire texture.
1301 * \param pixels this is filled in with a pointer to the locked pixels,
1302 * appropriately offset by the locked area.
1303 * \param pitch this is filled in with the pitch of the locked pixels; the
1304 * pitch is the length of one row in bytes.
1305 * \returns true on success or false if the texture is not valid or was not
1306 * created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError()
1307 * for more information.
1308 *
1309 * \threadsafety This function should only be called on the main thread.
1310 *
1311 * \since This function is available since SDL 3.2.0.
1312 *
1313 * \sa SDL_LockTextureToSurface
1314 * \sa SDL_UnlockTexture
1315 */
1316extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
1317 const SDL_Rect *rect,
1318 void **pixels, int *pitch);
1319
1320/**
1321 * Lock a portion of the texture for **write-only** pixel access, and expose
1322 * it as a SDL surface.
1323 *
1324 * Besides providing an SDL_Surface instead of raw pixel data, this function
1325 * operates like SDL_LockTexture.
1326 *
1327 * As an optimization, the pixels made available for editing don't necessarily
1328 * contain the old texture data. This is a write-only operation, and if you
1329 * need to keep a copy of the texture data you should do that at the
1330 * application level.
1331 *
1332 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1333 * changes.
1334 *
1335 * The returned surface is freed internally after calling SDL_UnlockTexture()
1336 * or SDL_DestroyTexture(). The caller should not free it.
1337 *
1338 * \param texture the texture to lock for access, which must be created with
1339 * `SDL_TEXTUREACCESS_STREAMING`.
1340 * \param rect a pointer to the rectangle to lock for access. If the rect is
1341 * NULL, the entire texture will be locked.
1342 * \param surface a pointer to an SDL surface of size **rect**. Don't assume
1343 * any specific pixel content.
1344 * \returns true on success or false on failure; call SDL_GetError() for more
1345 * information.
1346 *
1347 * \threadsafety This function should only be called on the main thread.
1348 *
1349 * \since This function is available since SDL 3.2.0.
1350 *
1351 * \sa SDL_LockTexture
1352 * \sa SDL_UnlockTexture
1353 */
1354extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface);
1355
1356/**
1357 * Unlock a texture, uploading the changes to video memory, if needed.
1358 *
1359 * **Warning**: Please note that SDL_LockTexture() is intended to be
1360 * write-only; it will not guarantee the previous contents of the texture will
1361 * be provided. You must fully initialize any area of a texture that you lock
1362 * before unlocking it, as the pixels might otherwise be uninitialized memory.
1363 *
1364 * Which is to say: locking and immediately unlocking a texture can result in
1365 * corrupted textures, depending on the renderer in use.
1366 *
1367 * \param texture a texture locked by SDL_LockTexture().
1368 *
1369 * \threadsafety This function should only be called on the main thread.
1370 *
1371 * \since This function is available since SDL 3.2.0.
1372 *
1373 * \sa SDL_LockTexture
1374 */
1375extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
1376
1377/**
1378 * Set a texture as the current rendering target.
1379 *
1380 * The default render target is the window for which the renderer was created.
1381 * To stop rendering to a texture and render to the window again, call this
1382 * function with a NULL `texture`.
1383 *
1384 * Viewport, cliprect, scale, and logical presentation are unique to each
1385 * render target. Get and set functions for these states apply to the current
1386 * render target set by this function, and those states persist on each target
1387 * when the current render target changes.
1388 *
1389 * \param renderer the rendering context.
1390 * \param texture the targeted texture, which must be created with the
1391 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
1392 * window instead of a texture.
1393 * \returns true on success or false on failure; call SDL_GetError() for more
1394 * information.
1395 *
1396 * \threadsafety This function should only be called on the main thread.
1397 *
1398 * \since This function is available since SDL 3.2.0.
1399 *
1400 * \sa SDL_GetRenderTarget
1401 */
1402extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
1403
1404/**
1405 * Get the current render target.
1406 *
1407 * The default render target is the window for which the renderer was created,
1408 * and is reported a NULL here.
1409 *
1410 * \param renderer the rendering context.
1411 * \returns the current render target or NULL for the default render target.
1412 *
1413 * \threadsafety This function should only be called on the main thread.
1414 *
1415 * \since This function is available since SDL 3.2.0.
1416 *
1417 * \sa SDL_SetRenderTarget
1418 */
1420
1421/**
1422 * Set a device-independent resolution and presentation mode for rendering.
1423 *
1424 * This function sets the width and height of the logical rendering output.
1425 * The renderer will act as if the current render target is always the
1426 * requested dimensions, scaling to the actual resolution as necessary.
1427 *
1428 * This can be useful for games that expect a fixed size, but would like to
1429 * scale the output to whatever is available, regardless of how a user resizes
1430 * a window, or if the display is high DPI.
1431 *
1432 * Logical presentation can be used with both render target textures and the
1433 * renderer's window; the state is unique to each render target, and this
1434 * function sets the state for the current render target. It might be useful
1435 * to draw to a texture that matches the window dimensions with logical
1436 * presentation enabled, and then draw that texture across the entire window
1437 * with logical presentation disabled. Be careful not to render both with
1438 * logical presentation enabled, however, as this could produce
1439 * double-letterboxing, etc.
1440 *
1441 * You can disable logical coordinates by setting the mode to
1442 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
1443 * resolution of the render target; it is safe to toggle logical presentation
1444 * during the rendering of a frame: perhaps most of the rendering is done to
1445 * specific dimensions but to make fonts look sharp, the app turns off logical
1446 * presentation while drawing text, for example.
1447 *
1448 * For the renderer's window, letterboxing is drawn into the framebuffer if
1449 * logical presentation is enabled during SDL_RenderPresent; be sure to
1450 * reenable it before presenting if you were toggling it, otherwise the
1451 * letterbox areas might have artifacts from previous frames (or artifacts
1452 * from external overlays, etc). Letterboxing is never drawn into texture
1453 * render targets; be sure to call SDL_RenderClear() before drawing into the
1454 * texture so the letterboxing areas are cleared, if appropriate.
1455 *
1456 * You can convert coordinates in an event into rendering coordinates using
1457 * SDL_ConvertEventToRenderCoordinates().
1458 *
1459 * \param renderer the rendering context.
1460 * \param w the width of the logical resolution.
1461 * \param h the height of the logical resolution.
1462 * \param mode the presentation mode used.
1463 * \returns true on success or false on failure; call SDL_GetError() for more
1464 * information.
1465 *
1466 * \threadsafety This function should only be called on the main thread.
1467 *
1468 * \since This function is available since SDL 3.2.0.
1469 *
1470 * \sa SDL_ConvertEventToRenderCoordinates
1471 * \sa SDL_GetRenderLogicalPresentation
1472 * \sa SDL_GetRenderLogicalPresentationRect
1473 */
1475
1476/**
1477 * Get device independent resolution and presentation mode for rendering.
1478 *
1479 * This function gets the width and height of the logical rendering output, or
1480 * the output size in pixels if a logical resolution is not enabled.
1481 *
1482 * Each render target has its own logical presentation state. This function
1483 * gets the state for the current render target.
1484 *
1485 * \param renderer the rendering context.
1486 * \param w an int to be filled with the width.
1487 * \param h an int to be filled with the height.
1488 * \param mode the presentation mode used.
1489 * \returns true on success or false on failure; call SDL_GetError() for more
1490 * information.
1491 *
1492 * \threadsafety This function should only be called on the main thread.
1493 *
1494 * \since This function is available since SDL 3.2.0.
1495 *
1496 * \sa SDL_SetRenderLogicalPresentation
1497 */
1498extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode);
1499
1500/**
1501 * Get the final presentation rectangle for rendering.
1502 *
1503 * This function returns the calculated rectangle used for logical
1504 * presentation, based on the presentation mode and output size. If logical
1505 * presentation is disabled, it will fill the rectangle with the output size,
1506 * in pixels.
1507 *
1508 * Each render target has its own logical presentation state. This function
1509 * gets the rectangle for the current render target.
1510 *
1511 * \param renderer the rendering context.
1512 * \param rect a pointer filled in with the final presentation rectangle, may
1513 * be NULL.
1514 * \returns true on success or false on failure; call SDL_GetError() for more
1515 * information.
1516 *
1517 * \threadsafety This function should only be called on the main thread.
1518 *
1519 * \since This function is available since SDL 3.2.0.
1520 *
1521 * \sa SDL_SetRenderLogicalPresentation
1522 */
1524
1525/**
1526 * Get a point in render coordinates when given a point in window coordinates.
1527 *
1528 * This takes into account several states:
1529 *
1530 * - The window dimensions.
1531 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1532 * - The scale (SDL_SetRenderScale)
1533 * - The viewport (SDL_SetRenderViewport)
1534 *
1535 * \param renderer the rendering context.
1536 * \param window_x the x coordinate in window coordinates.
1537 * \param window_y the y coordinate in window coordinates.
1538 * \param x a pointer filled with the x coordinate in render coordinates.
1539 * \param y a pointer filled with the y coordinate in render coordinates.
1540 * \returns true on success or false on failure; call SDL_GetError() for more
1541 * information.
1542 *
1543 * \threadsafety This function should only be called on the main thread.
1544 *
1545 * \since This function is available since SDL 3.2.0.
1546 *
1547 * \sa SDL_SetRenderLogicalPresentation
1548 * \sa SDL_SetRenderScale
1549 */
1550extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
1551
1552/**
1553 * Get a point in window coordinates when given a point in render coordinates.
1554 *
1555 * This takes into account several states:
1556 *
1557 * - The window dimensions.
1558 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1559 * - The scale (SDL_SetRenderScale)
1560 * - The viewport (SDL_SetRenderViewport)
1561 *
1562 * \param renderer the rendering context.
1563 * \param x the x coordinate in render coordinates.
1564 * \param y the y coordinate in render coordinates.
1565 * \param window_x a pointer filled with the x coordinate in window
1566 * coordinates.
1567 * \param window_y a pointer filled with the y coordinate in window
1568 * coordinates.
1569 * \returns true on success or false on failure; call SDL_GetError() for more
1570 * information.
1571 *
1572 * \threadsafety This function should only be called on the main thread.
1573 *
1574 * \since This function is available since SDL 3.2.0.
1575 *
1576 * \sa SDL_SetRenderLogicalPresentation
1577 * \sa SDL_SetRenderScale
1578 * \sa SDL_SetRenderViewport
1579 */
1580extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
1581
1582/**
1583 * Convert the coordinates in an event to render coordinates.
1584 *
1585 * This takes into account several states:
1586 *
1587 * - The window dimensions.
1588 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1589 * - The scale (SDL_SetRenderScale)
1590 * - The viewport (SDL_SetRenderViewport)
1591 *
1592 * Various event types are converted with this function: mouse, touch, pen,
1593 * etc.
1594 *
1595 * Touch coordinates are converted from normalized coordinates in the window
1596 * to non-normalized rendering coordinates.
1597 *
1598 * Relative mouse coordinates (xrel and yrel event fields) are _also_
1599 * converted. Applications that do not want these fields converted should use
1600 * SDL_RenderCoordinatesFromWindow() on the specific event fields instead of
1601 * converting the entire event structure.
1602 *
1603 * Once converted, coordinates may be outside the rendering area.
1604 *
1605 * \param renderer the rendering context.
1606 * \param event the event to modify.
1607 * \returns true on success or false on failure; call SDL_GetError() for more
1608 * information.
1609 *
1610 * \threadsafety This function should only be called on the main thread.
1611 *
1612 * \since This function is available since SDL 3.2.0.
1613 *
1614 * \sa SDL_RenderCoordinatesFromWindow
1615 */
1616extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
1617
1618/**
1619 * Set the drawing area for rendering on the current target.
1620 *
1621 * Drawing will clip to this area (separately from any clipping done with
1622 * SDL_SetRenderClipRect), and the top left of the area will become coordinate
1623 * (0, 0) for future drawing commands.
1624 *
1625 * The area's width and height must be >= 0.
1626 *
1627 * Each render target has its own viewport. This function sets the viewport
1628 * for the current render target.
1629 *
1630 * \param renderer the rendering context.
1631 * \param rect the SDL_Rect structure representing the drawing area, or NULL
1632 * to set the viewport to the entire target.
1633 * \returns true on success or false on failure; call SDL_GetError() for more
1634 * information.
1635 *
1636 * \threadsafety This function should only be called on the main thread.
1637 *
1638 * \since This function is available since SDL 3.2.0.
1639 *
1640 * \sa SDL_GetRenderViewport
1641 * \sa SDL_RenderViewportSet
1642 */
1643extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
1644
1645/**
1646 * Get the drawing area for the current target.
1647 *
1648 * Each render target has its own viewport. This function gets the viewport
1649 * for the current render target.
1650 *
1651 * \param renderer the rendering context.
1652 * \param rect an SDL_Rect structure filled in with the current drawing area.
1653 * \returns true on success or false on failure; call SDL_GetError() for more
1654 * information.
1655 *
1656 * \threadsafety This function should only be called on the main thread.
1657 *
1658 * \since This function is available since SDL 3.2.0.
1659 *
1660 * \sa SDL_RenderViewportSet
1661 * \sa SDL_SetRenderViewport
1662 */
1663extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
1664
1665/**
1666 * Return whether an explicit rectangle was set as the viewport.
1667 *
1668 * This is useful if you're saving and restoring the viewport and want to know
1669 * whether you should restore a specific rectangle or NULL.
1670 *
1671 * Each render target has its own viewport. This function checks the viewport
1672 * for the current render target.
1673 *
1674 * \param renderer the rendering context.
1675 * \returns true if the viewport was set to a specific rectangle, or false if
1676 * it was set to NULL (the entire target).
1677 *
1678 * \threadsafety This function should only be called on the main thread.
1679 *
1680 * \since This function is available since SDL 3.2.0.
1681 *
1682 * \sa SDL_GetRenderViewport
1683 * \sa SDL_SetRenderViewport
1684 */
1685extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer);
1686
1687/**
1688 * Get the safe area for rendering within the current viewport.
1689 *
1690 * Some devices have portions of the screen which are partially obscured or
1691 * not interactive, possibly due to on-screen controls, curved edges, camera
1692 * notches, TV overscan, etc. This function provides the area of the current
1693 * viewport which is safe to have interactible content. You should continue
1694 * rendering into the rest of the render target, but it should not contain
1695 * visually important or interactible content.
1696 *
1697 * \param renderer the rendering context.
1698 * \param rect a pointer filled in with the area that is safe for interactive
1699 * content.
1700 * \returns true on success or false on failure; call SDL_GetError() for more
1701 * information.
1702 *
1703 * \threadsafety This function should only be called on the main thread.
1704 *
1705 * \since This function is available since SDL 3.2.0.
1706 */
1707extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect);
1708
1709/**
1710 * Set the clip rectangle for rendering on the specified target.
1711 *
1712 * Each render target has its own clip rectangle. This function sets the
1713 * cliprect for the current render target.
1714 *
1715 * \param renderer the rendering context.
1716 * \param rect an SDL_Rect structure representing the clip area, relative to
1717 * the viewport, or NULL to disable clipping.
1718 * \returns true on success or false on failure; call SDL_GetError() for more
1719 * information.
1720 *
1721 * \threadsafety This function should only be called on the main thread.
1722 *
1723 * \since This function is available since SDL 3.2.0.
1724 *
1725 * \sa SDL_GetRenderClipRect
1726 * \sa SDL_RenderClipEnabled
1727 */
1728extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
1729
1730/**
1731 * Get the clip rectangle for the current target.
1732 *
1733 * Each render target has its own clip rectangle. This function gets the
1734 * cliprect for the current render target.
1735 *
1736 * \param renderer the rendering context.
1737 * \param rect an SDL_Rect structure filled in with the current clipping area
1738 * or an empty rectangle if clipping is disabled.
1739 * \returns true on success or false on failure; call SDL_GetError() for more
1740 * information.
1741 *
1742 * \threadsafety This function should only be called on the main thread.
1743 *
1744 * \since This function is available since SDL 3.2.0.
1745 *
1746 * \sa SDL_RenderClipEnabled
1747 * \sa SDL_SetRenderClipRect
1748 */
1749extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1750
1751/**
1752 * Get whether clipping is enabled on the given render target.
1753 *
1754 * Each render target has its own clip rectangle. This function checks the
1755 * cliprect for the current render target.
1756 *
1757 * \param renderer the rendering context.
1758 * \returns true if clipping is enabled or false if not; call SDL_GetError()
1759 * for more information.
1760 *
1761 * \threadsafety This function should only be called on the main thread.
1762 *
1763 * \since This function is available since SDL 3.2.0.
1764 *
1765 * \sa SDL_GetRenderClipRect
1766 * \sa SDL_SetRenderClipRect
1767 */
1768extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1769
1770/**
1771 * Set the drawing scale for rendering on the current target.
1772 *
1773 * The drawing coordinates are scaled by the x/y scaling factors before they
1774 * are used by the renderer. This allows resolution independent drawing with a
1775 * single coordinate system.
1776 *
1777 * If this results in scaling or subpixel drawing by the rendering backend, it
1778 * will be handled using the appropriate quality hints. For best results use
1779 * integer scaling factors.
1780 *
1781 * Each render target has its own scale. This function sets the scale for the
1782 * current render target.
1783 *
1784 * \param renderer the rendering context.
1785 * \param scaleX the horizontal scaling factor.
1786 * \param scaleY the vertical scaling factor.
1787 * \returns true on success or false on failure; call SDL_GetError() for more
1788 * information.
1789 *
1790 * \threadsafety This function should only be called on the main thread.
1791 *
1792 * \since This function is available since SDL 3.2.0.
1793 *
1794 * \sa SDL_GetRenderScale
1795 */
1796extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1797
1798/**
1799 * Get the drawing scale for the current target.
1800 *
1801 * Each render target has its own scale. This function gets the scale for the
1802 * current render target.
1803 *
1804 * \param renderer the rendering context.
1805 * \param scaleX a pointer filled in with the horizontal scaling factor.
1806 * \param scaleY a pointer filled in with the vertical scaling factor.
1807 * \returns true on success or false on failure; call SDL_GetError() for more
1808 * information.
1809 *
1810 * \threadsafety This function should only be called on the main thread.
1811 *
1812 * \since This function is available since SDL 3.2.0.
1813 *
1814 * \sa SDL_SetRenderScale
1815 */
1816extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1817
1818/**
1819 * Set the color used for drawing operations.
1820 *
1821 * Set the color for drawing or filling rectangles, lines, and points, and for
1822 * SDL_RenderClear().
1823 *
1824 * \param renderer the rendering context.
1825 * \param r the red value used to draw on the rendering target.
1826 * \param g the green value used to draw on the rendering target.
1827 * \param b the blue value used to draw on the rendering target.
1828 * \param a the alpha value used to draw on the rendering target; usually
1829 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1830 * specify how the alpha channel is used.
1831 * \returns true on success or false on failure; call SDL_GetError() for more
1832 * information.
1833 *
1834 * \threadsafety This function should only be called on the main thread.
1835 *
1836 * \since This function is available since SDL 3.2.0.
1837 *
1838 * \sa SDL_GetRenderDrawColor
1839 * \sa SDL_SetRenderDrawColorFloat
1840 */
1841extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1842
1843/**
1844 * Set the color used for drawing operations (Rect, Line and Clear).
1845 *
1846 * Set the color for drawing or filling rectangles, lines, and points, and for
1847 * SDL_RenderClear().
1848 *
1849 * \param renderer the rendering context.
1850 * \param r the red value used to draw on the rendering target.
1851 * \param g the green value used to draw on the rendering target.
1852 * \param b the blue value used to draw on the rendering target.
1853 * \param a the alpha value used to draw on the rendering target. Use
1854 * SDL_SetRenderDrawBlendMode to specify how the alpha channel is
1855 * used.
1856 * \returns true on success or false on failure; call SDL_GetError() for more
1857 * information.
1858 *
1859 * \threadsafety This function should only be called on the main thread.
1860 *
1861 * \since This function is available since SDL 3.2.0.
1862 *
1863 * \sa SDL_GetRenderDrawColorFloat
1864 * \sa SDL_SetRenderDrawColor
1865 */
1866extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a);
1867
1868/**
1869 * Get the color used for drawing operations (Rect, Line and Clear).
1870 *
1871 * \param renderer the rendering context.
1872 * \param r a pointer filled in with the red value used to draw on the
1873 * rendering target.
1874 * \param g a pointer filled in with the green value used to draw on the
1875 * rendering target.
1876 * \param b a pointer filled in with the blue value used to draw on the
1877 * rendering target.
1878 * \param a a pointer filled in with the alpha value used to draw on the
1879 * rendering target; usually `SDL_ALPHA_OPAQUE` (255).
1880 * \returns true on success or false on failure; call SDL_GetError() for more
1881 * information.
1882 *
1883 * \threadsafety This function should only be called on the main thread.
1884 *
1885 * \since This function is available since SDL 3.2.0.
1886 *
1887 * \sa SDL_GetRenderDrawColorFloat
1888 * \sa SDL_SetRenderDrawColor
1889 */
1890extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1891
1892/**
1893 * Get the color used for drawing operations (Rect, Line and Clear).
1894 *
1895 * \param renderer the rendering context.
1896 * \param r a pointer filled in with the red value used to draw on the
1897 * rendering target.
1898 * \param g a pointer filled in with the green value used to draw on the
1899 * rendering target.
1900 * \param b a pointer filled in with the blue value used to draw on the
1901 * rendering target.
1902 * \param a a pointer filled in with the alpha value used to draw on the
1903 * rendering target.
1904 * \returns true on success or false on failure; call SDL_GetError() for more
1905 * information.
1906 *
1907 * \threadsafety This function should only be called on the main thread.
1908 *
1909 * \since This function is available since SDL 3.2.0.
1910 *
1911 * \sa SDL_SetRenderDrawColorFloat
1912 * \sa SDL_GetRenderDrawColor
1913 */
1914extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a);
1915
1916/**
1917 * Set the color scale used for render operations.
1918 *
1919 * The color scale is an additional scale multiplied into the pixel color
1920 * value while rendering. This can be used to adjust the brightness of colors
1921 * during HDR rendering, or changing HDR video brightness when playing on an
1922 * SDR display.
1923 *
1924 * The color scale does not affect the alpha channel, only the color
1925 * brightness.
1926 *
1927 * \param renderer the rendering context.
1928 * \param scale the color scale value.
1929 * \returns true on success or false on failure; call SDL_GetError() for more
1930 * information.
1931 *
1932 * \threadsafety This function should only be called on the main thread.
1933 *
1934 * \since This function is available since SDL 3.2.0.
1935 *
1936 * \sa SDL_GetRenderColorScale
1937 */
1938extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale);
1939
1940/**
1941 * Get the color scale used for render operations.
1942 *
1943 * \param renderer the rendering context.
1944 * \param scale a pointer filled in with the current color scale value.
1945 * \returns true on success or false on failure; call SDL_GetError() for more
1946 * information.
1947 *
1948 * \threadsafety This function should only be called on the main thread.
1949 *
1950 * \since This function is available since SDL 3.2.0.
1951 *
1952 * \sa SDL_SetRenderColorScale
1953 */
1954extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale);
1955
1956/**
1957 * Set the blend mode used for drawing operations (Fill and Line).
1958 *
1959 * If the blend mode is not supported, the closest supported mode is chosen.
1960 *
1961 * \param renderer the rendering context.
1962 * \param blendMode the SDL_BlendMode to use for blending.
1963 * \returns true on success or false on failure; call SDL_GetError() for more
1964 * information.
1965 *
1966 * \threadsafety This function should only be called on the main thread.
1967 *
1968 * \since This function is available since SDL 3.2.0.
1969 *
1970 * \sa SDL_GetRenderDrawBlendMode
1971 */
1972extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1973
1974/**
1975 * Get the blend mode used for drawing operations.
1976 *
1977 * \param renderer the rendering context.
1978 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1979 * \returns true on success or false on failure; call SDL_GetError() for more
1980 * information.
1981 *
1982 * \threadsafety This function should only be called on the main thread.
1983 *
1984 * \since This function is available since SDL 3.2.0.
1985 *
1986 * \sa SDL_SetRenderDrawBlendMode
1987 */
1988extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1989
1990/**
1991 * Clear the current rendering target with the drawing color.
1992 *
1993 * This function clears the entire rendering target, ignoring the viewport and
1994 * the clip rectangle. Note, that clearing will also set/fill all pixels of
1995 * the rendering target to current renderer draw color, so make sure to invoke
1996 * SDL_SetRenderDrawColor() when needed.
1997 *
1998 * \param renderer the rendering context.
1999 * \returns true on success or false on failure; call SDL_GetError() for more
2000 * information.
2001 *
2002 * \threadsafety This function should only be called on the main thread.
2003 *
2004 * \since This function is available since SDL 3.2.0.
2005 *
2006 * \sa SDL_SetRenderDrawColor
2007 */
2008extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
2009
2010/**
2011 * Draw a point on the current rendering target at subpixel precision.
2012 *
2013 * \param renderer the renderer which should draw a point.
2014 * \param x the x coordinate of the point.
2015 * \param y the y coordinate of the point.
2016 * \returns true on success or false on failure; call SDL_GetError() for more
2017 * information.
2018 *
2019 * \threadsafety This function should only be called on the main thread.
2020 *
2021 * \since This function is available since SDL 3.2.0.
2022 *
2023 * \sa SDL_RenderPoints
2024 */
2025extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
2026
2027/**
2028 * Draw multiple points on the current rendering target at subpixel precision.
2029 *
2030 * \param renderer the renderer which should draw multiple points.
2031 * \param points the points to draw.
2032 * \param count the number of points to draw.
2033 * \returns true on success or false on failure; call SDL_GetError() for more
2034 * information.
2035 *
2036 * \threadsafety This function should only be called on the main thread.
2037 *
2038 * \since This function is available since SDL 3.2.0.
2039 *
2040 * \sa SDL_RenderPoint
2041 */
2042extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
2043
2044/**
2045 * Draw a line on the current rendering target at subpixel precision.
2046 *
2047 * \param renderer the renderer which should draw a line.
2048 * \param x1 the x coordinate of the start point.
2049 * \param y1 the y coordinate of the start point.
2050 * \param x2 the x coordinate of the end point.
2051 * \param y2 the y coordinate of the end point.
2052 * \returns true on success or false on failure; call SDL_GetError() for more
2053 * information.
2054 *
2055 * \threadsafety This function should only be called on the main thread.
2056 *
2057 * \since This function is available since SDL 3.2.0.
2058 *
2059 * \sa SDL_RenderLines
2060 */
2061extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
2062
2063/**
2064 * Draw a series of connected lines on the current rendering target at
2065 * subpixel precision.
2066 *
2067 * \param renderer the renderer which should draw multiple lines.
2068 * \param points the points along the lines.
2069 * \param count the number of points, drawing count-1 lines.
2070 * \returns true on success or false on failure; call SDL_GetError() for more
2071 * information.
2072 *
2073 * \threadsafety This function should only be called on the main thread.
2074 *
2075 * \since This function is available since SDL 3.2.0.
2076 *
2077 * \sa SDL_RenderLine
2078 */
2079extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
2080
2081/**
2082 * Draw a rectangle on the current rendering target at subpixel precision.
2083 *
2084 * \param renderer the renderer which should draw a rectangle.
2085 * \param rect a pointer to the destination rectangle, or NULL to outline the
2086 * entire rendering target.
2087 * \returns true on success or false on failure; call SDL_GetError() for more
2088 * information.
2089 *
2090 * \threadsafety This function should only be called on the main thread.
2091 *
2092 * \since This function is available since SDL 3.2.0.
2093 *
2094 * \sa SDL_RenderRects
2095 */
2096extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
2097
2098/**
2099 * Draw some number of rectangles on the current rendering target at subpixel
2100 * precision.
2101 *
2102 * \param renderer the renderer which should draw multiple rectangles.
2103 * \param rects a pointer to an array of destination rectangles.
2104 * \param count the number of rectangles.
2105 * \returns true on success or false on failure; call SDL_GetError() for more
2106 * information.
2107 *
2108 * \threadsafety This function should only be called on the main thread.
2109 *
2110 * \since This function is available since SDL 3.2.0.
2111 *
2112 * \sa SDL_RenderRect
2113 */
2114extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2115
2116/**
2117 * Fill a rectangle on the current rendering target with the drawing color at
2118 * subpixel precision.
2119 *
2120 * \param renderer the renderer which should fill a rectangle.
2121 * \param rect a pointer to the destination rectangle, or NULL for the entire
2122 * rendering target.
2123 * \returns true on success or false on failure; call SDL_GetError() for more
2124 * information.
2125 *
2126 * \threadsafety This function should only be called on the main thread.
2127 *
2128 * \since This function is available since SDL 3.2.0.
2129 *
2130 * \sa SDL_RenderFillRects
2131 */
2132extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
2133
2134/**
2135 * Fill some number of rectangles on the current rendering target with the
2136 * drawing color at subpixel precision.
2137 *
2138 * \param renderer the renderer which should fill multiple rectangles.
2139 * \param rects a pointer to an array of destination rectangles.
2140 * \param count the number of rectangles.
2141 * \returns true on success or false on failure; call SDL_GetError() for more
2142 * information.
2143 *
2144 * \threadsafety This function should only be called on the main thread.
2145 *
2146 * \since This function is available since SDL 3.2.0.
2147 *
2148 * \sa SDL_RenderFillRect
2149 */
2150extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2151
2152/**
2153 * Copy a portion of the texture to the current rendering target at subpixel
2154 * precision.
2155 *
2156 * \param renderer the renderer which should copy parts of a texture.
2157 * \param texture the source texture.
2158 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2159 * texture.
2160 * \param dstrect a pointer to the destination rectangle, or NULL for the
2161 * entire rendering target.
2162 * \returns true on success or false on failure; call SDL_GetError() for more
2163 * information.
2164 *
2165 * \threadsafety This function should only be called on the main thread.
2166 *
2167 * \since This function is available since SDL 3.2.0.
2168 *
2169 * \sa SDL_RenderTextureRotated
2170 * \sa SDL_RenderTextureTiled
2171 */
2172extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
2173
2174/**
2175 * Copy a portion of the source texture to the current rendering target, with
2176 * rotation and flipping, at subpixel precision.
2177 *
2178 * \param renderer the renderer which should copy parts of a texture.
2179 * \param texture the source texture.
2180 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2181 * texture.
2182 * \param dstrect a pointer to the destination rectangle, or NULL for the
2183 * entire rendering target.
2184 * \param angle an angle in degrees that indicates the rotation that will be
2185 * applied to dstrect, rotating it in a clockwise direction.
2186 * \param center a pointer to a point indicating the point around which
2187 * dstrect will be rotated (if NULL, rotation will be done
2188 * around dstrect.w/2, dstrect.h/2).
2189 * \param flip an SDL_FlipMode value stating which flipping actions should be
2190 * performed on the texture.
2191 * \returns true on success or false on failure; call SDL_GetError() for more
2192 * information.
2193 *
2194 * \threadsafety This function should only be called on the main thread.
2195 *
2196 * \since This function is available since SDL 3.2.0.
2197 *
2198 * \sa SDL_RenderTexture
2199 */
2200extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
2201 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
2202 double angle, const SDL_FPoint *center,
2203 SDL_FlipMode flip);
2204
2205/**
2206 * Copy a portion of the source texture to the current rendering target, with
2207 * affine transform, at subpixel precision.
2208 *
2209 * \param renderer the renderer which should copy parts of a texture.
2210 * \param texture the source texture.
2211 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2212 * texture.
2213 * \param origin a pointer to a point indicating where the top-left corner of
2214 * srcrect should be mapped to, or NULL for the rendering
2215 * target's origin.
2216 * \param right a pointer to a point indicating where the top-right corner of
2217 * srcrect should be mapped to, or NULL for the rendering
2218 * target's top-right corner.
2219 * \param down a pointer to a point indicating where the bottom-left corner of
2220 * srcrect should be mapped to, or NULL for the rendering target's
2221 * bottom-left corner.
2222 * \returns true on success or false on failure; call SDL_GetError() for more
2223 * information.
2224 *
2225 * \threadsafety You may only call this function from the main thread.
2226 *
2227 * \since This function is available since SDL 3.2.0.
2228 *
2229 * \sa SDL_RenderTexture
2230 */
2231extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureAffine(SDL_Renderer *renderer, SDL_Texture *texture,
2232 const SDL_FRect *srcrect, const SDL_FPoint *origin,
2233 const SDL_FPoint *right, const SDL_FPoint *down);
2234
2235/**
2236 * Tile a portion of the texture to the current rendering target at subpixel
2237 * precision.
2238 *
2239 * The pixels in `srcrect` will be repeated as many times as needed to
2240 * completely fill `dstrect`.
2241 *
2242 * \param renderer the renderer which should copy parts of a texture.
2243 * \param texture the source texture.
2244 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2245 * texture.
2246 * \param scale the scale used to transform srcrect into the destination
2247 * rectangle, e.g. a 32x32 texture with a scale of 2 would fill
2248 * 64x64 tiles.
2249 * \param dstrect a pointer to the destination rectangle, or NULL for the
2250 * entire rendering target.
2251 * \returns true on success or false on failure; call SDL_GetError() for more
2252 * information.
2253 *
2254 * \threadsafety This function should only be called on the main thread.
2255 *
2256 * \since This function is available since SDL 3.2.0.
2257 *
2258 * \sa SDL_RenderTexture
2259 */
2260extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect);
2261
2262/**
2263 * Perform a scaled copy using the 9-grid algorithm to the current rendering
2264 * target at subpixel precision.
2265 *
2266 * The pixels in the texture are split into a 3x3 grid, using the different
2267 * corner sizes for each corner, and the sides and center making up the
2268 * remaining pixels. The corners are then scaled using `scale` and fit into
2269 * the corners of the destination rectangle. The sides and center are then
2270 * stretched into place to cover the remaining destination rectangle.
2271 *
2272 * \param renderer the renderer which should copy parts of a texture.
2273 * \param texture the source texture.
2274 * \param srcrect the SDL_Rect structure representing the rectangle to be used
2275 * for the 9-grid, or NULL to use the entire texture.
2276 * \param left_width the width, in pixels, of the left corners in `srcrect`.
2277 * \param right_width the width, in pixels, of the right corners in `srcrect`.
2278 * \param top_height the height, in pixels, of the top corners in `srcrect`.
2279 * \param bottom_height the height, in pixels, of the bottom corners in
2280 * `srcrect`.
2281 * \param scale the scale used to transform the corner of `srcrect` into the
2282 * corner of `dstrect`, or 0.0f for an unscaled copy.
2283 * \param dstrect a pointer to the destination rectangle, or NULL for the
2284 * entire rendering target.
2285 * \returns true on success or false on failure; call SDL_GetError() for more
2286 * information.
2287 *
2288 * \threadsafety This function should only be called on the main thread.
2289 *
2290 * \since This function is available since SDL 3.2.0.
2291 *
2292 * \sa SDL_RenderTexture
2293 */
2294extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect);
2295
2296/**
2297 * Perform a scaled copy using the 9-grid algorithm to the current rendering
2298 * target at subpixel precision.
2299 *
2300 * The pixels in the texture are split into a 3x3 grid, using the different
2301 * corner sizes for each corner, and the sides and center making up the
2302 * remaining pixels. The corners are then scaled using `scale` and fit into
2303 * the corners of the destination rectangle. The sides and center are then
2304 * tiled into place to cover the remaining destination rectangle.
2305 *
2306 * \param renderer the renderer which should copy parts of a texture.
2307 * \param texture the source texture.
2308 * \param srcrect the SDL_Rect structure representing the rectangle to be used
2309 * for the 9-grid, or NULL to use the entire texture.
2310 * \param left_width the width, in pixels, of the left corners in `srcrect`.
2311 * \param right_width the width, in pixels, of the right corners in `srcrect`.
2312 * \param top_height the height, in pixels, of the top corners in `srcrect`.
2313 * \param bottom_height the height, in pixels, of the bottom corners in
2314 * `srcrect`.
2315 * \param scale the scale used to transform the corner of `srcrect` into the
2316 * corner of `dstrect`, or 0.0f for an unscaled copy.
2317 * \param dstrect a pointer to the destination rectangle, or NULL for the
2318 * entire rendering target.
2319 * \param tileScale the scale used to transform the borders and center of
2320 * `srcrect` into the borders and middle of `dstrect`, or
2321 * 1.0f for an unscaled copy.
2322 * \returns true on success or false on failure; call SDL_GetError() for more
2323 * information.
2324 *
2325 * \threadsafety This function should only be called on the main thread.
2326 *
2327 * \since This function is available since SDL 3.4.0.
2328 *
2329 * \sa SDL_RenderTexture
2330 */
2331extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9GridTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect, float tileScale);
2332
2333/**
2334 * Render a list of triangles, optionally using a texture and indices into the
2335 * vertex array Color and alpha modulation is done per vertex
2336 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2337 *
2338 * \param renderer the rendering context.
2339 * \param texture (optional) The SDL texture to use.
2340 * \param vertices vertices.
2341 * \param num_vertices number of vertices.
2342 * \param indices (optional) An array of integer indices into the 'vertices'
2343 * array, if NULL all vertices will be rendered in sequential
2344 * order.
2345 * \param num_indices number of indices.
2346 * \returns true on success or false on failure; call SDL_GetError() for more
2347 * information.
2348 *
2349 * \threadsafety This function should only be called on the main thread.
2350 *
2351 * \since This function is available since SDL 3.2.0.
2352 *
2353 * \sa SDL_RenderGeometryRaw
2354 * \sa SDL_SetRenderTextureAddressMode
2355 */
2356extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
2357 SDL_Texture *texture,
2358 const SDL_Vertex *vertices, int num_vertices,
2359 const int *indices, int num_indices);
2360
2361/**
2362 * Render a list of triangles, optionally using a texture and indices into the
2363 * vertex arrays Color and alpha modulation is done per vertex
2364 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2365 *
2366 * \param renderer the rendering context.
2367 * \param texture (optional) The SDL texture to use.
2368 * \param xy vertex positions.
2369 * \param xy_stride byte size to move from one element to the next element.
2370 * \param color vertex colors (as SDL_FColor).
2371 * \param color_stride byte size to move from one element to the next element.
2372 * \param uv vertex normalized texture coordinates.
2373 * \param uv_stride byte size to move from one element to the next element.
2374 * \param num_vertices number of vertices.
2375 * \param indices (optional) An array of indices into the 'vertices' arrays,
2376 * if NULL all vertices will be rendered in sequential order.
2377 * \param num_indices number of indices.
2378 * \param size_indices index size: 1 (byte), 2 (short), 4 (int).
2379 * \returns true on success or false on failure; call SDL_GetError() for more
2380 * information.
2381 *
2382 * \threadsafety This function should only be called on the main thread.
2383 *
2384 * \since This function is available since SDL 3.2.0.
2385 *
2386 * \sa SDL_RenderGeometry
2387 * \sa SDL_SetRenderTextureAddressMode
2388 */
2389extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
2390 SDL_Texture *texture,
2391 const float *xy, int xy_stride,
2392 const SDL_FColor *color, int color_stride,
2393 const float *uv, int uv_stride,
2394 int num_vertices,
2395 const void *indices, int num_indices, int size_indices);
2396
2397/**
2398 * Set the texture addressing mode used in SDL_RenderGeometry().
2399 *
2400 * \param renderer the rendering context.
2401 * \param u_mode the SDL_TextureAddressMode to use for horizontal texture
2402 * coordinates in SDL_RenderGeometry().
2403 * \param v_mode the SDL_TextureAddressMode to use for vertical texture
2404 * coordinates in SDL_RenderGeometry().
2405 * \returns true on success or false on failure; call SDL_GetError() for more
2406 * information.
2407 *
2408 * \since This function is available since SDL 3.4.0.
2409 *
2410 * \sa SDL_RenderGeometry
2411 * \sa SDL_RenderGeometryRaw
2412 * \sa SDL_GetRenderTextureAddressMode
2413 */
2415
2416/**
2417 * Get the texture addressing mode used in SDL_RenderGeometry().
2418 *
2419 * \param renderer the rendering context.
2420 * \param u_mode a pointer filled in with the SDL_TextureAddressMode to use
2421 * for horizontal texture coordinates in SDL_RenderGeometry(),
2422 * may be NULL.
2423 * \param v_mode a pointer filled in with the SDL_TextureAddressMode to use
2424 * for vertical texture coordinates in SDL_RenderGeometry(), may
2425 * be NULL.
2426 * \returns true on success or false on failure; call SDL_GetError() for more
2427 * information.
2428 *
2429 * \since This function is available since SDL 3.4.0.
2430 *
2431 * \sa SDL_SetRenderTextureAddressMode
2432 */
2434
2435/**
2436 * Read pixels from the current rendering target.
2437 *
2438 * The returned surface contains pixels inside the desired area clipped to the
2439 * current viewport, and should be freed with SDL_DestroySurface().
2440 *
2441 * Note that this returns the actual pixels on the screen, so if you are using
2442 * logical presentation you should use SDL_GetRenderLogicalPresentationRect()
2443 * to get the area containing your content.
2444 *
2445 * **WARNING**: This is a very slow operation, and should not be used
2446 * frequently. If you're using this on the main rendering target, it should be
2447 * called after rendering and before SDL_RenderPresent().
2448 *
2449 * \param renderer the rendering context.
2450 * \param rect an SDL_Rect structure representing the area to read, which will
2451 * be clipped to the current viewport, or NULL for the entire
2452 * viewport.
2453 * \returns a new SDL_Surface on success or NULL on failure; call
2454 * SDL_GetError() for more information.
2455 *
2456 * \threadsafety This function should only be called on the main thread.
2457 *
2458 * \since This function is available since SDL 3.2.0.
2459 */
2460extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect);
2461
2462/**
2463 * Update the screen with any rendering performed since the previous call.
2464 *
2465 * SDL's rendering functions operate on a backbuffer; that is, calling a
2466 * rendering function such as SDL_RenderLine() does not directly put a line on
2467 * the screen, but rather updates the backbuffer. As such, you compose your
2468 * entire scene and *present* the composed backbuffer to the screen as a
2469 * complete picture.
2470 *
2471 * Therefore, when using SDL's rendering API, one does all drawing intended
2472 * for the frame, and then calls this function once per frame to present the
2473 * final drawing to the user.
2474 *
2475 * The backbuffer should be considered invalidated after each present; do not
2476 * assume that previous contents will exist between frames. You are strongly
2477 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
2478 * starting each new frame's drawing, even if you plan to overwrite every
2479 * pixel.
2480 *
2481 * Please note, that in case of rendering to a texture - there is **no need**
2482 * to call `SDL_RenderPresent` after drawing needed objects to a texture, and
2483 * should not be done; you are only required to change back the rendering
2484 * target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as
2485 * textures by themselves do not have a concept of backbuffers. Calling
2486 * SDL_RenderPresent while rendering to a texture will fail.
2487 *
2488 * \param renderer the rendering context.
2489 * \returns true on success or false on failure; call SDL_GetError() for more
2490 * information.
2491 *
2492 * \threadsafety This function should only be called on the main thread.
2493 *
2494 * \since This function is available since SDL 3.2.0.
2495 *
2496 * \sa SDL_CreateRenderer
2497 * \sa SDL_RenderClear
2498 * \sa SDL_RenderFillRect
2499 * \sa SDL_RenderFillRects
2500 * \sa SDL_RenderLine
2501 * \sa SDL_RenderLines
2502 * \sa SDL_RenderPoint
2503 * \sa SDL_RenderPoints
2504 * \sa SDL_RenderRect
2505 * \sa SDL_RenderRects
2506 * \sa SDL_SetRenderDrawBlendMode
2507 * \sa SDL_SetRenderDrawColor
2508 */
2509extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
2510
2511/**
2512 * Destroy the specified texture.
2513 *
2514 * Passing NULL or an otherwise invalid texture will set the SDL error message
2515 * to "Invalid texture".
2516 *
2517 * \param texture the texture to destroy.
2518 *
2519 * \threadsafety This function should only be called on the main thread.
2520 *
2521 * \since This function is available since SDL 3.2.0.
2522 *
2523 * \sa SDL_CreateTexture
2524 * \sa SDL_CreateTextureFromSurface
2525 */
2526extern SDL_DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
2527
2528/**
2529 * Destroy the rendering context for a window and free all associated
2530 * textures.
2531 *
2532 * This should be called before destroying the associated window.
2533 *
2534 * \param renderer the rendering context.
2535 *
2536 * \threadsafety This function should only be called on the main thread.
2537 *
2538 * \since This function is available since SDL 3.2.0.
2539 *
2540 * \sa SDL_CreateRenderer
2541 */
2542extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
2543
2544/**
2545 * Force the rendering context to flush any pending commands and state.
2546 *
2547 * You do not need to (and in fact, shouldn't) call this function unless you
2548 * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
2549 * addition to using an SDL_Renderer.
2550 *
2551 * This is for a very-specific case: if you are using SDL's render API, and
2552 * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
2553 * calls. If this applies, you should call this function between calls to
2554 * SDL's render API and the low-level API you're using in cooperation.
2555 *
2556 * In all other cases, you can ignore this function.
2557 *
2558 * This call makes SDL flush any pending rendering work it was queueing up to
2559 * do later in a single batch, and marks any internal cached state as invalid,
2560 * so it'll prepare all its state again later, from scratch.
2561 *
2562 * This means you do not need to save state in your rendering code to protect
2563 * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
2564 * OpenGL state that can confuse things; you should use your best judgment and
2565 * be prepared to make changes if specific state needs to be protected.
2566 *
2567 * \param renderer the rendering context.
2568 * \returns true on success or false on failure; call SDL_GetError() for more
2569 * information.
2570 *
2571 * \threadsafety This function should only be called on the main thread.
2572 *
2573 * \since This function is available since SDL 3.2.0.
2574 */
2575extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
2576
2577/**
2578 * Get the CAMetalLayer associated with the given Metal renderer.
2579 *
2580 * This function returns `void *`, so SDL doesn't have to include Metal's
2581 * headers, but it can be safely cast to a `CAMetalLayer *`.
2582 *
2583 * \param renderer the renderer to query.
2584 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
2585 * Metal renderer.
2586 *
2587 * \threadsafety This function should only be called on the main thread.
2588 *
2589 * \since This function is available since SDL 3.2.0.
2590 *
2591 * \sa SDL_GetRenderMetalCommandEncoder
2592 */
2593extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
2594
2595/**
2596 * Get the Metal command encoder for the current frame.
2597 *
2598 * This function returns `void *`, so SDL doesn't have to include Metal's
2599 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
2600 *
2601 * This will return NULL if Metal refuses to give SDL a drawable to render to,
2602 * which might happen if the window is hidden/minimized/offscreen. This
2603 * doesn't apply to command encoders for render targets, just the window's
2604 * backbuffer. Check your return values!
2605 *
2606 * \param renderer the renderer to query.
2607 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
2608 * renderer isn't a Metal renderer or there was an error.
2609 *
2610 * \threadsafety This function should only be called on the main thread.
2611 *
2612 * \since This function is available since SDL 3.2.0.
2613 *
2614 * \sa SDL_GetRenderMetalLayer
2615 */
2616extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
2617
2618
2619/**
2620 * Add a set of synchronization semaphores for the current frame.
2621 *
2622 * The Vulkan renderer will wait for `wait_semaphore` before submitting
2623 * rendering commands and signal `signal_semaphore` after rendering commands
2624 * are complete for this frame.
2625 *
2626 * This should be called each frame that you want semaphore synchronization.
2627 * The Vulkan renderer may have multiple frames in flight on the GPU, so you
2628 * should have multiple semaphores that are used for synchronization. Querying
2629 * SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER will give you the
2630 * maximum number of semaphores you'll need.
2631 *
2632 * \param renderer the rendering context.
2633 * \param wait_stage_mask the VkPipelineStageFlags for the wait.
2634 * \param wait_semaphore a VkSempahore to wait on before rendering the current
2635 * frame, or 0 if not needed.
2636 * \param signal_semaphore a VkSempahore that SDL will signal when rendering
2637 * for the current frame is complete, or 0 if not
2638 * needed.
2639 * \returns true on success or false on failure; call SDL_GetError() for more
2640 * information.
2641 *
2642 * \threadsafety It is **NOT** safe to call this function from two threads at
2643 * once.
2644 *
2645 * \since This function is available since SDL 3.2.0.
2646 */
2647extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);
2648
2649/**
2650 * Toggle VSync of the given renderer.
2651 *
2652 * When a renderer is created, vsync defaults to SDL_RENDERER_VSYNC_DISABLED.
2653 *
2654 * The `vsync` parameter can be 1 to synchronize present with every vertical
2655 * refresh, 2 to synchronize present with every second vertical refresh, etc.,
2656 * SDL_RENDERER_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), or
2657 * SDL_RENDERER_VSYNC_DISABLED to disable. Not every value is supported by
2658 * every driver, so you should check the return value to see whether the
2659 * requested setting is supported.
2660 *
2661 * \param renderer the renderer to toggle.
2662 * \param vsync the vertical refresh sync interval.
2663 * \returns true on success or false on failure; call SDL_GetError() for more
2664 * information.
2665 *
2666 * \threadsafety This function should only be called on the main thread.
2667 *
2668 * \since This function is available since SDL 3.2.0.
2669 *
2670 * \sa SDL_GetRenderVSync
2671 */
2672extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
2673
2674#define SDL_RENDERER_VSYNC_DISABLED 0
2675#define SDL_RENDERER_VSYNC_ADAPTIVE (-1)
2676
2677/**
2678 * Get VSync of the given renderer.
2679 *
2680 * \param renderer the renderer to toggle.
2681 * \param vsync an int filled with the current vertical refresh sync interval.
2682 * See SDL_SetRenderVSync() for the meaning of the value.
2683 * \returns true on success or false on failure; call SDL_GetError() for more
2684 * information.
2685 *
2686 * \threadsafety This function should only be called on the main thread.
2687 *
2688 * \since This function is available since SDL 3.2.0.
2689 *
2690 * \sa SDL_SetRenderVSync
2691 */
2692extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
2693
2694/**
2695 * The size, in pixels, of a single SDL_RenderDebugText() character.
2696 *
2697 * The font is monospaced and square, so this applies to all characters.
2698 *
2699 * \since This macro is available since SDL 3.2.0.
2700 *
2701 * \sa SDL_RenderDebugText
2702 */
2703#define SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE 8
2704
2705/**
2706 * Draw debug text to an SDL_Renderer.
2707 *
2708 * This function will render a string of text to an SDL_Renderer. Note that
2709 * this is a convenience function for debugging, with severe limitations, and
2710 * not intended to be used for production apps and games.
2711 *
2712 * Among these limitations:
2713 *
2714 * - It accepts UTF-8 strings, but will only renders ASCII characters.
2715 * - It has a single, tiny size (8x8 pixels). One can use logical presentation
2716 * or scaling to adjust it, but it will be blurry.
2717 * - It uses a simple, hardcoded bitmap font. It does not allow different font
2718 * selections and it does not support truetype, for proper scaling.
2719 * - It does no word-wrapping and does not treat newline characters as a line
2720 * break. If the text goes out of the window, it's gone.
2721 *
2722 * For serious text rendering, there are several good options, such as
2723 * SDL_ttf, stb_truetype, or other external libraries.
2724 *
2725 * On first use, this will create an internal texture for rendering glyphs.
2726 * This texture will live until the renderer is destroyed.
2727 *
2728 * The text is drawn in the color specified by SDL_SetRenderDrawColor().
2729 *
2730 * \param renderer the renderer which should draw a line of text.
2731 * \param x the x coordinate where the top-left corner of the text will draw.
2732 * \param y the y coordinate where the top-left corner of the text will draw.
2733 * \param str the string to render.
2734 * \returns true on success or false on failure; call SDL_GetError() for more
2735 * information.
2736 *
2737 * \threadsafety This function should only be called on the main thread.
2738 *
2739 * \since This function is available since SDL 3.2.0.
2740 *
2741 * \sa SDL_RenderDebugTextFormat
2742 * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
2743 */
2744extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);
2745
2746/**
2747 * Draw debug text to an SDL_Renderer.
2748 *
2749 * This function will render a printf()-style format string to a renderer.
2750 * Note that this is a convinence function for debugging, with severe
2751 * limitations, and is not intended to be used for production apps and games.
2752 *
2753 * For the full list of limitations and other useful information, see
2754 * SDL_RenderDebugText.
2755 *
2756 * \param renderer the renderer which should draw the text.
2757 * \param x the x coordinate where the top-left corner of the text will draw.
2758 * \param y the y coordinate where the top-left corner of the text will draw.
2759 * \param fmt the format string to draw.
2760 * \param ... additional parameters matching % tokens in the `fmt` string, if
2761 * any.
2762 * \returns true on success or false on failure; call SDL_GetError() for more
2763 * information.
2764 *
2765 * \threadsafety This function should only be called on the main thread.
2766 *
2767 * \since This function is available since SDL 3.2.0.
2768 *
2769 * \sa SDL_RenderDebugText
2770 * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
2771 */
2772extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugTextFormat(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(4);
2773
2774/**
2775 * Set default scale mode for new textures for given renderer.
2776 *
2777 * When a renderer is created, scale_mode defaults to SDL_SCALEMODE_LINEAR.
2778 *
2779 * \param renderer the renderer to update.
2780 * \param scale_mode the scale mode to change to for new textures.
2781 * \returns true on success or false on failure; call SDL_GetError() for more
2782 * information.
2783 *
2784 * \threadsafety This function should only be called on the main thread.
2785 *
2786 * \since This function is available since SDL 3.4.0.
2787 *
2788 * \sa SDL_GetDefaultTextureScaleMode
2789 */
2790extern SDL_DECLSPEC bool SDLCALL SDL_SetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode scale_mode);
2791
2792/**
2793 * Get default texture scale mode of the given renderer.
2794 *
2795 * \param renderer the renderer to get data from.
2796 * \param scale_mode a SDL_ScaleMode filled with current default scale mode.
2797 * See SDL_SetDefaultTextureScaleMode() for the meaning of
2798 * the value.
2799 * \returns true on success or false on failure; call SDL_GetError() for more
2800 * information.
2801 *
2802 * \threadsafety This function should only be called on the main thread.
2803 *
2804 * \since This function is available since SDL 3.4.0.
2805 *
2806 * \sa SDL_SetDefaultTextureScaleMode
2807 */
2808extern SDL_DECLSPEC bool SDLCALL SDL_GetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode *scale_mode);
2809
2810/**
2811 * GPU render state description.
2812 *
2813 * This structure should be initialized using SDL_INIT_INTERFACE().
2814 *
2815 * \since This struct is available since SDL 3.4.0.
2816 *
2817 * \sa SDL_CreateGPURenderState
2818 */
2820{
2821 Uint32 version; /**< the version of this interface */
2822
2823 SDL_GPUShader *fragment_shader; /**< The fragment shader to use when this render state is active */
2824
2825 Sint32 num_sampler_bindings; /**< The number of additional fragment samplers to bind when this render state is active */
2826 const SDL_GPUTextureSamplerBinding *sampler_bindings; /**< Additional fragment samplers to bind when this render state is active */
2827
2828 Sint32 num_storage_textures; /**< The number of storage textures to bind when this render state is active */
2829 SDL_GPUTexture *const *storage_textures; /**< Storage textures to bind when this render state is active */
2830
2831 Sint32 num_storage_buffers; /**< The number of storage buffers to bind when this render state is active */
2832 SDL_GPUBuffer *const *storage_buffers; /**< Storage buffers to bind when this render state is active */
2834
2835/* Check the size of SDL_GPURenderStateDesc
2836 *
2837 * If this assert fails, either the compiler is padding to an unexpected size,
2838 * or the interface has been updated and this should be updated to match and
2839 * the code using this interface should be updated to handle the old version.
2840 */
2841SDL_COMPILE_TIME_ASSERT(SDL_GPURenderStateDesc_SIZE,
2842 (sizeof(void *) == 4 && sizeof(SDL_GPURenderStateDesc) == 32) ||
2843 (sizeof(void *) == 8 && sizeof(SDL_GPURenderStateDesc) == 64));
2844
2845/**
2846 * A custom GPU render state.
2847 *
2848 * \since This struct is available since SDL 3.4.0.
2849 *
2850 * \sa SDL_CreateGPURenderState
2851 * \sa SDL_SetGPURenderStateFragmentUniforms
2852 * \sa SDL_SetRenderGPUState
2853 * \sa SDL_DestroyGPURenderState
2854 */
2856
2857/**
2858 * Create custom GPU render state.
2859 *
2860 * \param renderer the renderer to use.
2861 * \param desc GPU render state description, initialized using
2862 * SDL_INIT_INTERFACE().
2863 * \returns a custom GPU render state or NULL on failure; call SDL_GetError()
2864 * for more information.
2865 *
2866 * \threadsafety This function should be called on the thread that created the
2867 * renderer.
2868 *
2869 * \since This function is available since SDL 3.4.0.
2870 *
2871 * \sa SDL_SetGPURenderStateFragmentUniforms
2872 * \sa SDL_SetRenderGPUState
2873 * \sa SDL_DestroyGPURenderState
2874 */
2876
2877/**
2878 * Set fragment shader uniform variables in a custom GPU render state.
2879 *
2880 * The data is copied and will be pushed using
2881 * SDL_PushGPUFragmentUniformData() during draw call execution.
2882 *
2883 * \param state the state to modify.
2884 * \param slot_index the fragment uniform slot to push data to.
2885 * \param data client data to write.
2886 * \param length the length of the data to write.
2887 * \returns true on success or false on failure; call SDL_GetError() for more
2888 * information.
2889 *
2890 * \threadsafety This function should be called on the thread that created the
2891 * renderer.
2892 *
2893 * \since This function is available since SDL 3.4.0.
2894 */
2895extern SDL_DECLSPEC bool SDLCALL SDL_SetGPURenderStateFragmentUniforms(SDL_GPURenderState *state, Uint32 slot_index, const void *data, Uint32 length);
2896
2897/**
2898 * Set custom GPU render state.
2899 *
2900 * This function sets custom GPU render state for subsequent draw calls. This
2901 * allows using custom shaders with the GPU renderer.
2902 *
2903 * \param renderer the renderer to use.
2904 * \param state the state to to use, or NULL to clear custom GPU render state.
2905 * \returns true on success or false on failure; call SDL_GetError() for more
2906 * information.
2907 *
2908 * \threadsafety This function should be called on the thread that created the
2909 * renderer.
2910 *
2911 * \since This function is available since SDL 3.4.0.
2912 */
2913extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderGPUState(SDL_Renderer *renderer, SDL_GPURenderState *state);
2914
2915/**
2916 * Destroy custom GPU render state.
2917 *
2918 * \param state the state to destroy.
2919 *
2920 * \threadsafety This function should be called on the thread that created the
2921 * renderer.
2922 *
2923 * \since This function is available since SDL 3.4.0.
2924 *
2925 * \sa SDL_CreateGPURenderState
2926 */
2927extern SDL_DECLSPEC void SDLCALL SDL_DestroyGPURenderState(SDL_GPURenderState *state);
2928
2929/* Ends C function definitions when using C++ */
2930#ifdef __cplusplus
2931}
2932#endif
2933#include <SDL3/SDL_close_code.h>
2934
2935#endif /* SDL_render_h_ */
Uint32 SDL_BlendMode
Uint32 SDL_GPUShaderFormat
Definition SDL_gpu.h:1015
struct SDL_GPUTexture SDL_GPUTexture
Definition SDL_gpu.h:457
struct SDL_GPUBuffer SDL_GPUBuffer
Definition SDL_gpu.h:419
struct SDL_GPUShader SDL_GPUShader
Definition SDL_gpu.h:480
struct SDL_GPUDevice SDL_GPUDevice
Definition SDL_gpu.h:395
SDL_PixelFormat
Definition SDL_pixels.h:549
Uint32 SDL_PropertiesID
void SDL_DestroyTexture(SDL_Texture *texture)
bool SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
bool SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
bool SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
bool SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_RenderPresent(SDL_Renderer *renderer)
bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect)
bool SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
bool SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
bool SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
bool SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
SDL_Window * SDL_GetRenderWindow(SDL_Renderer *renderer)
bool SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
bool SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h)
bool SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect)
bool SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
bool SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a)
void SDL_UnlockTexture(SDL_Texture *texture)
bool SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
bool SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str)
bool SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
bool SDL_SetRenderTextureAddressMode(SDL_Renderer *renderer, SDL_TextureAddressMode u_mode, SDL_TextureAddressMode v_mode)
SDL_Surface * SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetNumRenderDrivers(void)
bool SDL_SetGPURenderStateFragmentUniforms(SDL_GPURenderState *state, Uint32 slot_index, const void *data, Uint32 length)
bool SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
bool SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
SDL_GPURenderState * SDL_CreateGPURenderState(SDL_Renderer *renderer, SDL_GPURenderStateDesc *desc)
SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props)
bool SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_GetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode *scale_mode)
bool SDL_RenderTexture9GridTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect, float tileScale)
bool SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
SDL_TextureAddressMode
Definition SDL_render.h:109
@ SDL_TEXTURE_ADDRESS_INVALID
Definition SDL_render.h:110
@ SDL_TEXTURE_ADDRESS_WRAP
Definition SDL_render.h:113
@ SDL_TEXTURE_ADDRESS_CLAMP
Definition SDL_render.h:112
@ SDL_TEXTURE_ADDRESS_AUTO
Definition SDL_render.h:111
bool SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b)
bool SDL_GetRenderTextureAddressMode(SDL_Renderer *renderer, SDL_TextureAddressMode *u_mode, SDL_TextureAddressMode *v_mode)
bool SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
bool SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha)
bool SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, SDL_TextureAccess access, int w, int h)
bool SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
bool SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
bool SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
SDL_Renderer * SDL_GetRendererFromTexture(SDL_Texture *texture)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name)
SDL_TextureAccess
Definition SDL_render.h:95
@ SDL_TEXTUREACCESS_STATIC
Definition SDL_render.h:96
@ SDL_TEXTUREACCESS_STREAMING
Definition SDL_render.h:97
@ SDL_TEXTUREACCESS_TARGET
Definition SDL_render.h:98
bool SDL_FlushRenderer(SDL_Renderer *renderer)
bool SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
bool SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
bool SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
bool SDL_SetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode scale_mode)
bool SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_RenderClear(SDL_Renderer *renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
bool SDL_RenderViewportSet(SDL_Renderer *renderer)
bool SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode)
bool SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
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
SDL_Renderer * SDL_CreateGPURenderer(SDL_Window *window, SDL_GPUShaderFormat format_flags, SDL_GPUDevice **device)
bool SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
bool SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
const char * SDL_GetRenderDriver(int index)
void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer)
struct SDL_Renderer SDL_Renderer
Definition SDL_render.h:135
bool SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
bool SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect)
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
bool SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
bool SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
bool SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
bool SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
bool SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
bool SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha)
bool SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
bool SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
bool SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)
bool SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale)
bool SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
bool SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a)
bool SDL_SetRenderGPUState(SDL_Renderer *renderer, SDL_GPURenderState *state)
struct SDL_GPURenderState SDL_GPURenderState
bool SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale)
bool SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b)
void SDL_DestroyGPURenderState(SDL_GPURenderState *state)
bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, double angle, const SDL_FPoint *center, SDL_FlipMode flip)
const char * SDL_GetRendererName(SDL_Renderer *renderer)
bool SDL_RenderDebugTextFormat(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(4)
bool SDL_RenderGeometryRaw(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
bool SDL_RenderTextureAffine(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FPoint *origin, const SDL_FPoint *right, const SDL_FPoint *down)
bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
uint8_t Uint8
Definition SDL_stdinc.h:425
int64_t Sint64
Definition SDL_stdinc.h:472
int32_t Sint32
Definition SDL_stdinc.h:452
#define SDL_PRINTF_FORMAT_STRING
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
#define SDL_COMPILE_TIME_ASSERT(name, x)
Definition SDL_stdinc.h:209
uint32_t Uint32
Definition SDL_stdinc.h:461
SDL_ScaleMode
Definition SDL_surface.h:85
SDL_FlipMode
Definition SDL_surface.h:98
struct SDL_Window SDL_Window
Definition SDL_video.h:173
Uint64 SDL_WindowFlags
Definition SDL_video.h:193
static SDL_Renderer * renderer
Definition hello.c:17
static SDL_Window * window
Definition hello.c:16
const SDL_GPUTextureSamplerBinding * sampler_bindings
SDL_GPUShader * fragment_shader
SDL_GPUTexture *const * storage_textures
SDL_GPUBuffer *const * storage_buffers
SDL_PixelFormat format
Definition SDL_render.h:151
SDL_FPoint tex_coord
Definition SDL_render.h:86
SDL_FPoint position
Definition SDL_render.h:84
SDL_FColor color
Definition SDL_render.h:85