Skip to main content

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