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