sdl3_sys/generated/
render.rs

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