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