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_NUMBER`]\: the GLuint texture
1170    ///   associated with the texture, if you want to wrap an existing texture.
1171    /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`]\: the GLuint texture
1172    ///   associated with the UV plane of an NV12 texture, if you want to wrap an
1173    ///   existing texture.
1174    /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`]\: the GLuint texture
1175    ///   associated with the U plane of a YUV texture, if you want to wrap an
1176    ///   existing texture.
1177    /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`]\: the GLuint texture
1178    ///   associated with the V plane of a YUV texture, if you want to wrap an
1179    ///   existing texture.
1180    ///
1181    /// With the vulkan renderer:
1182    ///
1183    /// - [`SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`]\: the VkImage associated
1184    ///   with the texture, if you want to wrap an existing texture.
1185    /// - [`SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER`]\: the VkImageLayout for the
1186    ///   VkImage, defaults to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
1187    ///
1188    /// With the GPU renderer:
1189    ///
1190    /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER`]\: the [`SDL_GPUTexture`]
1191    ///   associated with the texture, if you want to wrap an existing texture.
1192    /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_NUMBER`]\: the [`SDL_GPUTexture`]
1193    ///   associated with the UV plane of an NV12 texture, if you want to wrap an
1194    ///   existing texture.
1195    /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_NUMBER`]\: the [`SDL_GPUTexture`]
1196    ///   associated with the U plane of a YUV texture, if you want to wrap an
1197    ///   existing texture.
1198    /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_NUMBER`]\: the [`SDL_GPUTexture`]
1199    ///   associated with the V plane of a YUV texture, if you want to wrap an
1200    ///   existing texture.
1201    ///
1202    /// ## Parameters
1203    /// - `renderer`: the rendering context.
1204    /// - `props`: the properties to use.
1205    ///
1206    /// ## Return value
1207    /// Returns the created texture or NULL on failure; call [`SDL_GetError()`] for
1208    ///   more information.
1209    ///
1210    /// ## Thread safety
1211    /// This function should only be called on the main thread.
1212    ///
1213    /// ## Availability
1214    /// This function is available since SDL 3.2.0.
1215    ///
1216    /// ## See also
1217    /// - [`SDL_CreateProperties`]
1218    /// - [`SDL_CreateTexture`]
1219    /// - [`SDL_CreateTextureFromSurface`]
1220    /// - [`SDL_DestroyTexture`]
1221    /// - [`SDL_GetTextureSize`]
1222    /// - [`SDL_UpdateTexture`]
1223    pub fn SDL_CreateTextureWithProperties(
1224        renderer: *mut SDL_Renderer,
1225        props: SDL_PropertiesID,
1226    ) -> *mut SDL_Texture;
1227}
1228
1229pub const SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER: *const ::core::ffi::c_char =
1230    c"SDL.texture.create.colorspace".as_ptr();
1231
1232pub const SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER: *const ::core::ffi::c_char =
1233    c"SDL.texture.create.format".as_ptr();
1234
1235pub const SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER: *const ::core::ffi::c_char =
1236    c"SDL.texture.create.access".as_ptr();
1237
1238pub const SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER: *const ::core::ffi::c_char =
1239    c"SDL.texture.create.width".as_ptr();
1240
1241pub const SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER: *const ::core::ffi::c_char =
1242    c"SDL.texture.create.height".as_ptr();
1243
1244pub const SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER: *const ::core::ffi::c_char =
1245    c"SDL.texture.create.palette".as_ptr();
1246
1247pub const SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char =
1248    c"SDL.texture.create.SDR_white_point".as_ptr();
1249
1250pub const SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char =
1251    c"SDL.texture.create.HDR_headroom".as_ptr();
1252
1253pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER: *const ::core::ffi::c_char =
1254    c"SDL.texture.create.d3d11.texture".as_ptr();
1255
1256pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1257    c"SDL.texture.create.d3d11.texture_u".as_ptr();
1258
1259pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1260    c"SDL.texture.create.d3d11.texture_v".as_ptr();
1261
1262pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER: *const ::core::ffi::c_char =
1263    c"SDL.texture.create.d3d12.texture".as_ptr();
1264
1265pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1266    c"SDL.texture.create.d3d12.texture_u".as_ptr();
1267
1268pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1269    c"SDL.texture.create.d3d12.texture_v".as_ptr();
1270
1271pub const SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER: *const ::core::ffi::c_char =
1272    c"SDL.texture.create.metal.pixelbuffer".as_ptr();
1273
1274pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1275    c"SDL.texture.create.opengl.texture".as_ptr();
1276
1277pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char =
1278    c"SDL.texture.create.opengl.texture_uv".as_ptr();
1279
1280pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER: *const ::core::ffi::c_char =
1281    c"SDL.texture.create.opengl.texture_u".as_ptr();
1282
1283pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER: *const ::core::ffi::c_char =
1284    c"SDL.texture.create.opengl.texture_v".as_ptr();
1285
1286pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1287    c"SDL.texture.create.opengles2.texture".as_ptr();
1288
1289pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char =
1290    c"SDL.texture.create.opengles2.texture_uv".as_ptr();
1291
1292pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER: *const ::core::ffi::c_char =
1293    c"SDL.texture.create.opengles2.texture_u".as_ptr();
1294
1295pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER: *const ::core::ffi::c_char =
1296    c"SDL.texture.create.opengles2.texture_v".as_ptr();
1297
1298pub const SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1299    c"SDL.texture.create.vulkan.texture".as_ptr();
1300
1301pub const SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER: *const ::core::ffi::c_char =
1302    c"SDL.texture.create.vulkan.layout".as_ptr();
1303
1304pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER: *const ::core::ffi::c_char =
1305    c"SDL.texture.create.gpu.texture".as_ptr();
1306
1307pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER: *const ::core::ffi::c_char =
1308    c"SDL.texture.create.gpu.texture_uv".as_ptr();
1309
1310pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1311    c"SDL.texture.create.gpu.texture_u".as_ptr();
1312
1313pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1314    c"SDL.texture.create.gpu.texture_v".as_ptr();
1315
1316unsafe extern "C" {
1317    /// Get the properties associated with a texture.
1318    ///
1319    /// The following read-only properties are provided by SDL:
1320    ///
1321    /// - [`SDL_PROP_TEXTURE_COLORSPACE_NUMBER`]\: an [`SDL_Colorspace`] value describing
1322    ///   the texture colorspace.
1323    /// - [`SDL_PROP_TEXTURE_FORMAT_NUMBER`]\: one of the enumerated values in
1324    ///   [`SDL_PixelFormat`].
1325    /// - [`SDL_PROP_TEXTURE_ACCESS_NUMBER`]\: one of the enumerated values in
1326    ///   [`SDL_TextureAccess`].
1327    /// - [`SDL_PROP_TEXTURE_WIDTH_NUMBER`]\: the width of the texture in pixels.
1328    /// - [`SDL_PROP_TEXTURE_HEIGHT_NUMBER`]\: the height of the texture in pixels.
1329    /// - [`SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`]\: for HDR10 and floating point
1330    ///   textures, this defines the value of 100% diffuse white, with higher
1331    ///   values being displayed in the High Dynamic Range headroom. This defaults
1332    ///   to 100 for HDR10 textures and 1.0 for other textures.
1333    /// - [`SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`]\: for HDR10 and floating point
1334    ///   textures, this defines the maximum dynamic range used by the content, in
1335    ///   terms of the SDR white point. If this is defined, any values outside the
1336    ///   range supported by the display will be scaled into the available HDR
1337    ///   headroom, otherwise they are clipped. This defaults to 1.0 for SDR
1338    ///   textures, 4.0 for HDR10 textures, and no default for floating point
1339    ///   textures.
1340    ///
1341    /// With the direct3d11 renderer:
1342    ///
1343    /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`]\: the ID3D11Texture2D associated
1344    ///   with the texture
1345    /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`]\: the ID3D11Texture2D
1346    ///   associated with the U plane of a YUV texture
1347    /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`]\: the ID3D11Texture2D
1348    ///   associated with the V plane of a YUV texture
1349    ///
1350    /// With the direct3d12 renderer:
1351    ///
1352    /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`]\: the ID3D12Resource associated
1353    ///   with the texture
1354    /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`]\: the ID3D12Resource associated
1355    ///   with the U plane of a YUV texture
1356    /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`]\: the ID3D12Resource associated
1357    ///   with the V plane of a YUV texture
1358    ///
1359    /// With the vulkan renderer:
1360    ///
1361    /// - [`SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`]\: the VkImage associated with the
1362    ///   texture
1363    ///
1364    /// With the opengl renderer:
1365    ///
1366    /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`]\: the GLuint texture associated
1367    ///   with the texture
1368    /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`]\: the GLuint texture
1369    ///   associated with the UV plane of an NV12 texture
1370    /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`]\: the GLuint texture associated
1371    ///   with the U plane of a YUV texture
1372    /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`]\: the GLuint texture associated
1373    ///   with the V plane of a YUV texture
1374    /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`]\: the GLenum for the
1375    ///   texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc)
1376    /// - [`SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`]\: the texture coordinate width of
1377    ///   the texture (0.0 - 1.0)
1378    /// - [`SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`]\: the texture coordinate height of
1379    ///   the texture (0.0 - 1.0)
1380    ///
1381    /// With the opengles2 renderer:
1382    ///
1383    /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`]\: the GLuint texture
1384    ///   associated with the texture
1385    /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`]\: the GLuint texture
1386    ///   associated with the UV plane of an NV12 texture
1387    /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`]\: the GLuint texture
1388    ///   associated with the U plane of a YUV texture
1389    /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`]\: the GLuint texture
1390    ///   associated with the V plane of a YUV texture
1391    /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`]\: the GLenum for the
1392    ///   texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
1393    ///
1394    /// With the gpu renderer:
1395    ///
1396    /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER`]\: the [`SDL_GPUTexture`] associated
1397    ///   with the texture
1398    /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER`]\: the [`SDL_GPUTexture`] associated
1399    ///   with the UV plane of an NV12 texture
1400    /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER`]\: the [`SDL_GPUTexture`] associated
1401    ///   with the U plane of a YUV texture
1402    /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER`]\: the [`SDL_GPUTexture`] associated
1403    ///   with the V plane of a YUV texture
1404    ///
1405    /// ## Parameters
1406    /// - `texture`: the texture to query.
1407    ///
1408    /// ## Return value
1409    /// Returns a valid property ID on success or 0 on failure; call
1410    ///   [`SDL_GetError()`] for more information.
1411    ///
1412    /// ## Thread safety
1413    /// It is safe to call this function from any thread.
1414    ///
1415    /// ## Availability
1416    /// This function is available since SDL 3.2.0.
1417    pub fn SDL_GetTextureProperties(texture: *mut SDL_Texture) -> SDL_PropertiesID;
1418}
1419
1420pub const SDL_PROP_TEXTURE_COLORSPACE_NUMBER: *const ::core::ffi::c_char =
1421    c"SDL.texture.colorspace".as_ptr();
1422
1423pub const SDL_PROP_TEXTURE_FORMAT_NUMBER: *const ::core::ffi::c_char =
1424    c"SDL.texture.format".as_ptr();
1425
1426pub const SDL_PROP_TEXTURE_ACCESS_NUMBER: *const ::core::ffi::c_char =
1427    c"SDL.texture.access".as_ptr();
1428
1429pub const SDL_PROP_TEXTURE_WIDTH_NUMBER: *const ::core::ffi::c_char = c"SDL.texture.width".as_ptr();
1430
1431pub const SDL_PROP_TEXTURE_HEIGHT_NUMBER: *const ::core::ffi::c_char =
1432    c"SDL.texture.height".as_ptr();
1433
1434pub const SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char =
1435    c"SDL.texture.SDR_white_point".as_ptr();
1436
1437pub const SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char =
1438    c"SDL.texture.HDR_headroom".as_ptr();
1439
1440pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER: *const ::core::ffi::c_char =
1441    c"SDL.texture.d3d11.texture".as_ptr();
1442
1443pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1444    c"SDL.texture.d3d11.texture_u".as_ptr();
1445
1446pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1447    c"SDL.texture.d3d11.texture_v".as_ptr();
1448
1449pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER: *const ::core::ffi::c_char =
1450    c"SDL.texture.d3d12.texture".as_ptr();
1451
1452pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1453    c"SDL.texture.d3d12.texture_u".as_ptr();
1454
1455pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1456    c"SDL.texture.d3d12.texture_v".as_ptr();
1457
1458pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1459    c"SDL.texture.opengl.texture".as_ptr();
1460
1461pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char =
1462    c"SDL.texture.opengl.texture_uv".as_ptr();
1463
1464pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER: *const ::core::ffi::c_char =
1465    c"SDL.texture.opengl.texture_u".as_ptr();
1466
1467pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER: *const ::core::ffi::c_char =
1468    c"SDL.texture.opengl.texture_v".as_ptr();
1469
1470pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER: *const ::core::ffi::c_char =
1471    c"SDL.texture.opengl.target".as_ptr();
1472
1473pub const SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT: *const ::core::ffi::c_char =
1474    c"SDL.texture.opengl.tex_w".as_ptr();
1475
1476pub const SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT: *const ::core::ffi::c_char =
1477    c"SDL.texture.opengl.tex_h".as_ptr();
1478
1479pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1480    c"SDL.texture.opengles2.texture".as_ptr();
1481
1482pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char =
1483    c"SDL.texture.opengles2.texture_uv".as_ptr();
1484
1485pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER: *const ::core::ffi::c_char =
1486    c"SDL.texture.opengles2.texture_u".as_ptr();
1487
1488pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER: *const ::core::ffi::c_char =
1489    c"SDL.texture.opengles2.texture_v".as_ptr();
1490
1491pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER: *const ::core::ffi::c_char =
1492    c"SDL.texture.opengles2.target".as_ptr();
1493
1494pub const SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER: *const ::core::ffi::c_char =
1495    c"SDL.texture.vulkan.texture".as_ptr();
1496
1497pub const SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER: *const ::core::ffi::c_char =
1498    c"SDL.texture.gpu.texture".as_ptr();
1499
1500pub const SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER: *const ::core::ffi::c_char =
1501    c"SDL.texture.gpu.texture_uv".as_ptr();
1502
1503pub const SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER: *const ::core::ffi::c_char =
1504    c"SDL.texture.gpu.texture_u".as_ptr();
1505
1506pub const SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER: *const ::core::ffi::c_char =
1507    c"SDL.texture.gpu.texture_v".as_ptr();
1508
1509unsafe extern "C" {
1510    /// Get the renderer that created an [`SDL_Texture`].
1511    ///
1512    /// ## Parameters
1513    /// - `texture`: the texture to query.
1514    ///
1515    /// ## Return value
1516    /// Returns a pointer to the [`SDL_Renderer`] that created the texture, or NULL on
1517    ///   failure; call [`SDL_GetError()`] for more information.
1518    ///
1519    /// ## Thread safety
1520    /// It is safe to call this function from any thread.
1521    ///
1522    /// ## Availability
1523    /// This function is available since SDL 3.2.0.
1524    pub fn SDL_GetRendererFromTexture(texture: *mut SDL_Texture) -> *mut SDL_Renderer;
1525}
1526
1527unsafe extern "C" {
1528    /// Get the size of a texture, as floating point values.
1529    ///
1530    /// ## Parameters
1531    /// - `texture`: the texture to query.
1532    /// - `w`: a pointer filled in with the width of the texture in pixels. This
1533    ///   argument can be NULL if you don't need this information.
1534    /// - `h`: a pointer filled in with the height of the texture in pixels. This
1535    ///   argument can be NULL if you don't need this information.
1536    ///
1537    /// ## Return value
1538    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1539    ///   information.
1540    ///
1541    /// ## Thread safety
1542    /// This function should only be called on the main thread.
1543    ///
1544    /// ## Availability
1545    /// This function is available since SDL 3.2.0.
1546    pub fn SDL_GetTextureSize(
1547        texture: *mut SDL_Texture,
1548        w: *mut ::core::ffi::c_float,
1549        h: *mut ::core::ffi::c_float,
1550    ) -> ::core::primitive::bool;
1551}
1552
1553unsafe extern "C" {
1554    /// Set the palette used by a texture.
1555    ///
1556    /// Setting the palette keeps an internal reference to the palette, which can
1557    /// be safely destroyed afterwards.
1558    ///
1559    /// A single palette can be shared with many textures.
1560    ///
1561    /// ## Parameters
1562    /// - `texture`: the texture to update.
1563    /// - `palette`: the [`SDL_Palette`] structure to use.
1564    ///
1565    /// ## Return value
1566    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1567    ///   information.
1568    ///
1569    /// ## Thread safety
1570    /// This function should only be called on the main thread.
1571    ///
1572    /// ## Availability
1573    /// This function is available since SDL 3.4.0.
1574    ///
1575    /// ## See also
1576    /// - [`SDL_CreatePalette`]
1577    /// - [`SDL_GetTexturePalette`]
1578    pub fn SDL_SetTexturePalette(
1579        texture: *mut SDL_Texture,
1580        palette: *mut SDL_Palette,
1581    ) -> ::core::primitive::bool;
1582}
1583
1584unsafe extern "C" {
1585    /// Get the palette used by a texture.
1586    ///
1587    /// ## Parameters
1588    /// - `texture`: the texture to query.
1589    ///
1590    /// ## Return value
1591    /// Returns a pointer to the palette used by the texture, or NULL if there is
1592    ///   no palette used.
1593    ///
1594    /// ## Thread safety
1595    /// This function should only be called on the main thread.
1596    ///
1597    /// ## Availability
1598    /// This function is available since SDL 3.4.0.
1599    ///
1600    /// ## See also
1601    /// - [`SDL_SetTexturePalette`]
1602    pub fn SDL_GetTexturePalette(texture: *mut SDL_Texture) -> *mut SDL_Palette;
1603}
1604
1605unsafe extern "C" {
1606    /// Set an additional color value multiplied into render copy operations.
1607    ///
1608    /// When this texture is rendered, during the copy operation each source color
1609    /// channel is modulated by the appropriate color value according to the
1610    /// following formula:
1611    ///
1612    /// `srcC = srcC * (color / 255)`
1613    ///
1614    /// Color modulation is not always supported by the renderer; it will return
1615    /// false if color modulation is not supported.
1616    ///
1617    /// ## Parameters
1618    /// - `texture`: the texture to update.
1619    /// - `r`: the red color value multiplied into copy operations.
1620    /// - `g`: the green color value multiplied into copy operations.
1621    /// - `b`: the blue color value multiplied into copy operations.
1622    ///
1623    /// ## Return value
1624    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1625    ///   information.
1626    ///
1627    /// ## Thread safety
1628    /// This function should only be called on the main thread.
1629    ///
1630    /// ## Availability
1631    /// This function is available since SDL 3.2.0.
1632    ///
1633    /// ## See also
1634    /// - [`SDL_GetTextureColorMod`]
1635    /// - [`SDL_SetTextureAlphaMod`]
1636    /// - [`SDL_SetTextureColorModFloat`]
1637    pub fn SDL_SetTextureColorMod(
1638        texture: *mut SDL_Texture,
1639        r: Uint8,
1640        g: Uint8,
1641        b: Uint8,
1642    ) -> ::core::primitive::bool;
1643}
1644
1645unsafe extern "C" {
1646    /// Set an additional color value multiplied into render copy operations.
1647    ///
1648    /// When this texture is rendered, during the copy operation each source color
1649    /// channel is modulated by the appropriate color value according to the
1650    /// following formula:
1651    ///
1652    /// `srcC = srcC * color`
1653    ///
1654    /// Color modulation is not always supported by the renderer; it will return
1655    /// false if color modulation is not supported.
1656    ///
1657    /// ## Parameters
1658    /// - `texture`: the texture to update.
1659    /// - `r`: the red color value multiplied into copy operations.
1660    /// - `g`: the green color value multiplied into copy operations.
1661    /// - `b`: the blue color value multiplied into copy operations.
1662    ///
1663    /// ## Return value
1664    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1665    ///   information.
1666    ///
1667    /// ## Thread safety
1668    /// This function should only be called on the main thread.
1669    ///
1670    /// ## Availability
1671    /// This function is available since SDL 3.2.0.
1672    ///
1673    /// ## See also
1674    /// - [`SDL_GetTextureColorModFloat`]
1675    /// - [`SDL_SetTextureAlphaModFloat`]
1676    /// - [`SDL_SetTextureColorMod`]
1677    pub fn SDL_SetTextureColorModFloat(
1678        texture: *mut SDL_Texture,
1679        r: ::core::ffi::c_float,
1680        g: ::core::ffi::c_float,
1681        b: ::core::ffi::c_float,
1682    ) -> ::core::primitive::bool;
1683}
1684
1685unsafe extern "C" {
1686    /// Get the additional color value multiplied into render copy operations.
1687    ///
1688    /// ## Parameters
1689    /// - `texture`: the texture to query.
1690    /// - `r`: a pointer filled in with the current red color value.
1691    /// - `g`: a pointer filled in with the current green color value.
1692    /// - `b`: a pointer filled in with the current blue color value.
1693    ///
1694    /// ## Return value
1695    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1696    ///   information.
1697    ///
1698    /// ## Thread safety
1699    /// This function should only be called on the main thread.
1700    ///
1701    /// ## Availability
1702    /// This function is available since SDL 3.2.0.
1703    ///
1704    /// ## See also
1705    /// - [`SDL_GetTextureAlphaMod`]
1706    /// - [`SDL_GetTextureColorModFloat`]
1707    /// - [`SDL_SetTextureColorMod`]
1708    pub fn SDL_GetTextureColorMod(
1709        texture: *mut SDL_Texture,
1710        r: *mut Uint8,
1711        g: *mut Uint8,
1712        b: *mut Uint8,
1713    ) -> ::core::primitive::bool;
1714}
1715
1716unsafe extern "C" {
1717    /// Get the additional color value multiplied into render copy operations.
1718    ///
1719    /// ## Parameters
1720    /// - `texture`: the texture to query.
1721    /// - `r`: a pointer filled in with the current red color value.
1722    /// - `g`: a pointer filled in with the current green color value.
1723    /// - `b`: a pointer filled in with the current blue color value.
1724    ///
1725    /// ## Return value
1726    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1727    ///   information.
1728    ///
1729    /// ## Thread safety
1730    /// This function should only be called on the main thread.
1731    ///
1732    /// ## Availability
1733    /// This function is available since SDL 3.2.0.
1734    ///
1735    /// ## See also
1736    /// - [`SDL_GetTextureAlphaModFloat`]
1737    /// - [`SDL_GetTextureColorMod`]
1738    /// - [`SDL_SetTextureColorModFloat`]
1739    pub fn SDL_GetTextureColorModFloat(
1740        texture: *mut SDL_Texture,
1741        r: *mut ::core::ffi::c_float,
1742        g: *mut ::core::ffi::c_float,
1743        b: *mut ::core::ffi::c_float,
1744    ) -> ::core::primitive::bool;
1745}
1746
1747unsafe extern "C" {
1748    /// Set an additional alpha value multiplied into render copy operations.
1749    ///
1750    /// When this texture is rendered, during the copy operation the source alpha
1751    /// value is modulated by this alpha value according to the following formula:
1752    ///
1753    /// `srcA = srcA * (alpha / 255)`
1754    ///
1755    /// Alpha modulation is not always supported by the renderer; it will return
1756    /// false if alpha modulation is not supported.
1757    ///
1758    /// ## Parameters
1759    /// - `texture`: the texture to update.
1760    /// - `alpha`: the source alpha value multiplied into copy operations.
1761    ///
1762    /// ## Return value
1763    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1764    ///   information.
1765    ///
1766    /// ## Thread safety
1767    /// This function should only be called on the main thread.
1768    ///
1769    /// ## Availability
1770    /// This function is available since SDL 3.2.0.
1771    ///
1772    /// ## See also
1773    /// - [`SDL_GetTextureAlphaMod`]
1774    /// - [`SDL_SetTextureAlphaModFloat`]
1775    /// - [`SDL_SetTextureColorMod`]
1776    pub fn SDL_SetTextureAlphaMod(
1777        texture: *mut SDL_Texture,
1778        alpha: Uint8,
1779    ) -> ::core::primitive::bool;
1780}
1781
1782unsafe extern "C" {
1783    /// Set an additional alpha value multiplied into render copy operations.
1784    ///
1785    /// When this texture is rendered, during the copy operation the source alpha
1786    /// value is modulated by this alpha value according to the following formula:
1787    ///
1788    /// `srcA = srcA * alpha`
1789    ///
1790    /// Alpha modulation is not always supported by the renderer; it will return
1791    /// false if alpha modulation is not supported.
1792    ///
1793    /// ## Parameters
1794    /// - `texture`: the texture to update.
1795    /// - `alpha`: the source alpha value multiplied into copy operations.
1796    ///
1797    /// ## Return value
1798    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1799    ///   information.
1800    ///
1801    /// ## Thread safety
1802    /// This function should only be called on the main thread.
1803    ///
1804    /// ## Availability
1805    /// This function is available since SDL 3.2.0.
1806    ///
1807    /// ## See also
1808    /// - [`SDL_GetTextureAlphaModFloat`]
1809    /// - [`SDL_SetTextureAlphaMod`]
1810    /// - [`SDL_SetTextureColorModFloat`]
1811    pub fn SDL_SetTextureAlphaModFloat(
1812        texture: *mut SDL_Texture,
1813        alpha: ::core::ffi::c_float,
1814    ) -> ::core::primitive::bool;
1815}
1816
1817unsafe extern "C" {
1818    /// Get the additional alpha value multiplied into render copy operations.
1819    ///
1820    /// ## Parameters
1821    /// - `texture`: the texture to query.
1822    /// - `alpha`: a pointer filled in with the current alpha value.
1823    ///
1824    /// ## Return value
1825    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1826    ///   information.
1827    ///
1828    /// ## Thread safety
1829    /// This function should only be called on the main thread.
1830    ///
1831    /// ## Availability
1832    /// This function is available since SDL 3.2.0.
1833    ///
1834    /// ## See also
1835    /// - [`SDL_GetTextureAlphaModFloat`]
1836    /// - [`SDL_GetTextureColorMod`]
1837    /// - [`SDL_SetTextureAlphaMod`]
1838    pub fn SDL_GetTextureAlphaMod(
1839        texture: *mut SDL_Texture,
1840        alpha: *mut Uint8,
1841    ) -> ::core::primitive::bool;
1842}
1843
1844unsafe extern "C" {
1845    /// Get the additional alpha value multiplied into render copy operations.
1846    ///
1847    /// ## Parameters
1848    /// - `texture`: the texture to query.
1849    /// - `alpha`: a pointer filled in with the current alpha value.
1850    ///
1851    /// ## Return value
1852    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1853    ///   information.
1854    ///
1855    /// ## Thread safety
1856    /// This function should only be called on the main thread.
1857    ///
1858    /// ## Availability
1859    /// This function is available since SDL 3.2.0.
1860    ///
1861    /// ## See also
1862    /// - [`SDL_GetTextureAlphaMod`]
1863    /// - [`SDL_GetTextureColorModFloat`]
1864    /// - [`SDL_SetTextureAlphaModFloat`]
1865    pub fn SDL_GetTextureAlphaModFloat(
1866        texture: *mut SDL_Texture,
1867        alpha: *mut ::core::ffi::c_float,
1868    ) -> ::core::primitive::bool;
1869}
1870
1871unsafe extern "C" {
1872    /// Set the blend mode for a texture, used by [`SDL_RenderTexture()`].
1873    ///
1874    /// If the blend mode is not supported, the closest supported mode is chosen
1875    /// and this function returns false.
1876    ///
1877    /// ## Parameters
1878    /// - `texture`: the texture to update.
1879    /// - `blendMode`: the [`SDL_BlendMode`] to use for texture blending.
1880    ///
1881    /// ## Return value
1882    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1883    ///   information.
1884    ///
1885    /// ## Thread safety
1886    /// This function should only be called on the main thread.
1887    ///
1888    /// ## Availability
1889    /// This function is available since SDL 3.2.0.
1890    ///
1891    /// ## See also
1892    /// - [`SDL_GetTextureBlendMode`]
1893    pub fn SDL_SetTextureBlendMode(
1894        texture: *mut SDL_Texture,
1895        blendMode: SDL_BlendMode,
1896    ) -> ::core::primitive::bool;
1897}
1898
1899unsafe extern "C" {
1900    /// Get the blend mode used for texture copy operations.
1901    ///
1902    /// ## Parameters
1903    /// - `texture`: the texture to query.
1904    /// - `blendMode`: a pointer filled in with the current [`SDL_BlendMode`].
1905    ///
1906    /// ## Return value
1907    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1908    ///   information.
1909    ///
1910    /// ## Thread safety
1911    /// This function should only be called on the main thread.
1912    ///
1913    /// ## Availability
1914    /// This function is available since SDL 3.2.0.
1915    ///
1916    /// ## See also
1917    /// - [`SDL_SetTextureBlendMode`]
1918    pub fn SDL_GetTextureBlendMode(
1919        texture: *mut SDL_Texture,
1920        blendMode: *mut SDL_BlendMode,
1921    ) -> ::core::primitive::bool;
1922}
1923
1924unsafe extern "C" {
1925    /// Set the scale mode used for texture scale operations.
1926    ///
1927    /// The default texture scale mode is [`SDL_SCALEMODE_LINEAR`].
1928    ///
1929    /// If the scale mode is not supported, the closest supported mode is chosen.
1930    ///
1931    /// ## Parameters
1932    /// - `texture`: the texture to update.
1933    /// - `scaleMode`: the [`SDL_ScaleMode`] to use for texture scaling.
1934    ///
1935    /// ## Return value
1936    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1937    ///   information.
1938    ///
1939    /// ## Thread safety
1940    /// This function should only be called on the main thread.
1941    ///
1942    /// ## Availability
1943    /// This function is available since SDL 3.2.0.
1944    ///
1945    /// ## See also
1946    /// - [`SDL_GetTextureScaleMode`]
1947    pub fn SDL_SetTextureScaleMode(
1948        texture: *mut SDL_Texture,
1949        scaleMode: SDL_ScaleMode,
1950    ) -> ::core::primitive::bool;
1951}
1952
1953unsafe extern "C" {
1954    /// Get the scale mode used for texture scale operations.
1955    ///
1956    /// ## Parameters
1957    /// - `texture`: the texture to query.
1958    /// - `scaleMode`: a pointer filled in with the current scale mode.
1959    ///
1960    /// ## Return value
1961    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1962    ///   information.
1963    ///
1964    /// ## Thread safety
1965    /// This function should only be called on the main thread.
1966    ///
1967    /// ## Availability
1968    /// This function is available since SDL 3.2.0.
1969    ///
1970    /// ## See also
1971    /// - [`SDL_SetTextureScaleMode`]
1972    pub fn SDL_GetTextureScaleMode(
1973        texture: *mut SDL_Texture,
1974        scaleMode: *mut SDL_ScaleMode,
1975    ) -> ::core::primitive::bool;
1976}
1977
1978unsafe extern "C" {
1979    /// Update the given texture rectangle with new pixel data.
1980    ///
1981    /// The pixel data must be in the pixel format of the texture, which can be
1982    /// queried using the [`SDL_PROP_TEXTURE_FORMAT_NUMBER`] property.
1983    ///
1984    /// This is a fairly slow function, intended for use with static textures that
1985    /// do not change often.
1986    ///
1987    /// If the texture is intended to be updated often, it is preferred to create
1988    /// the texture as streaming and use the locking functions referenced below.
1989    /// While this function will work with streaming textures, for optimization
1990    /// reasons you may not get the pixels back if you lock the texture afterward.
1991    ///
1992    /// ## Parameters
1993    /// - `texture`: the texture to update.
1994    /// - `rect`: an [`SDL_Rect`] structure representing the area to update, or NULL
1995    ///   to update the entire texture.
1996    /// - `pixels`: the raw pixel data in the format of the texture.
1997    /// - `pitch`: the number of bytes in a row of pixel data, including padding
1998    ///   between lines.
1999    ///
2000    /// ## Return value
2001    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2002    ///   information.
2003    ///
2004    /// ## Thread safety
2005    /// This function should only be called on the main thread.
2006    ///
2007    /// ## Availability
2008    /// This function is available since SDL 3.2.0.
2009    ///
2010    /// ## See also
2011    /// - [`SDL_LockTexture`]
2012    /// - [`SDL_UnlockTexture`]
2013    /// - [`SDL_UpdateNVTexture`]
2014    /// - [`SDL_UpdateYUVTexture`]
2015    pub fn SDL_UpdateTexture(
2016        texture: *mut SDL_Texture,
2017        rect: *const SDL_Rect,
2018        pixels: *const ::core::ffi::c_void,
2019        pitch: ::core::ffi::c_int,
2020    ) -> ::core::primitive::bool;
2021}
2022
2023unsafe extern "C" {
2024    /// Update a rectangle within a planar YV12 or IYUV texture with new pixel
2025    /// data.
2026    ///
2027    /// You can use [`SDL_UpdateTexture()`] as long as your pixel data is a contiguous
2028    /// block of Y and U/V planes in the proper order, but this function is
2029    /// available if your pixel data is not contiguous.
2030    ///
2031    /// ## Parameters
2032    /// - `texture`: the texture to update.
2033    /// - `rect`: a pointer to the rectangle of pixels to update, or NULL to
2034    ///   update the entire texture.
2035    /// - `Yplane`: the raw pixel data for the Y plane.
2036    /// - `Ypitch`: the number of bytes between rows of pixel data for the Y
2037    ///   plane.
2038    /// - `Uplane`: the raw pixel data for the U plane.
2039    /// - `Upitch`: the number of bytes between rows of pixel data for the U
2040    ///   plane.
2041    /// - `Vplane`: the raw pixel data for the V plane.
2042    /// - `Vpitch`: the number of bytes between rows of pixel data for the V
2043    ///   plane.
2044    ///
2045    /// ## Return value
2046    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2047    ///   information.
2048    ///
2049    /// ## Thread safety
2050    /// This function should only be called on the main thread.
2051    ///
2052    /// ## Availability
2053    /// This function is available since SDL 3.2.0.
2054    ///
2055    /// ## See also
2056    /// - [`SDL_UpdateNVTexture`]
2057    /// - [`SDL_UpdateTexture`]
2058    pub fn SDL_UpdateYUVTexture(
2059        texture: *mut SDL_Texture,
2060        rect: *const SDL_Rect,
2061        Yplane: *const Uint8,
2062        Ypitch: ::core::ffi::c_int,
2063        Uplane: *const Uint8,
2064        Upitch: ::core::ffi::c_int,
2065        Vplane: *const Uint8,
2066        Vpitch: ::core::ffi::c_int,
2067    ) -> ::core::primitive::bool;
2068}
2069
2070unsafe extern "C" {
2071    /// Update a rectangle within a planar NV12 or NV21 texture with new pixels.
2072    ///
2073    /// You can use [`SDL_UpdateTexture()`] as long as your pixel data is a contiguous
2074    /// block of NV12/21 planes in the proper order, but this function is available
2075    /// if your pixel data is not contiguous.
2076    ///
2077    /// ## Parameters
2078    /// - `texture`: the texture to update.
2079    /// - `rect`: a pointer to the rectangle of pixels to update, or NULL to
2080    ///   update the entire texture.
2081    /// - `Yplane`: the raw pixel data for the Y plane.
2082    /// - `Ypitch`: the number of bytes between rows of pixel data for the Y
2083    ///   plane.
2084    /// - `UVplane`: the raw pixel data for the UV plane.
2085    /// - `UVpitch`: the number of bytes between rows of pixel data for the UV
2086    ///   plane.
2087    ///
2088    /// ## Return value
2089    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2090    ///   information.
2091    ///
2092    /// ## Thread safety
2093    /// This function should only be called on the main thread.
2094    ///
2095    /// ## Availability
2096    /// This function is available since SDL 3.2.0.
2097    ///
2098    /// ## See also
2099    /// - [`SDL_UpdateTexture`]
2100    /// - [`SDL_UpdateYUVTexture`]
2101    pub fn SDL_UpdateNVTexture(
2102        texture: *mut SDL_Texture,
2103        rect: *const SDL_Rect,
2104        Yplane: *const Uint8,
2105        Ypitch: ::core::ffi::c_int,
2106        UVplane: *const Uint8,
2107        UVpitch: ::core::ffi::c_int,
2108    ) -> ::core::primitive::bool;
2109}
2110
2111unsafe extern "C" {
2112    /// Lock a portion of the texture for **write-only** pixel access.
2113    ///
2114    /// As an optimization, the pixels made available for editing don't necessarily
2115    /// contain the old texture data. This is a write-only operation, and if you
2116    /// need to keep a copy of the texture data you should do that at the
2117    /// application level.
2118    ///
2119    /// You must use [`SDL_UnlockTexture()`] to unlock the pixels and apply any
2120    /// changes.
2121    ///
2122    /// ## Parameters
2123    /// - `texture`: the texture to lock for access, which was created with
2124    ///   [`SDL_TEXTUREACCESS_STREAMING`].
2125    /// - `rect`: an [`SDL_Rect`] structure representing the area to lock for access;
2126    ///   NULL to lock the entire texture.
2127    /// - `pixels`: this is filled in with a pointer to the locked pixels,
2128    ///   appropriately offset by the locked area.
2129    /// - `pitch`: this is filled in with the pitch of the locked pixels; the
2130    ///   pitch is the length of one row in bytes.
2131    ///
2132    /// ## Return value
2133    /// Returns true on success or false if the texture is not valid or was not
2134    ///   created with [`SDL_TEXTUREACCESS_STREAMING`]; call [`SDL_GetError()`]
2135    ///   for more information.
2136    ///
2137    /// ## Thread safety
2138    /// This function should only be called on the main thread.
2139    ///
2140    /// ## Availability
2141    /// This function is available since SDL 3.2.0.
2142    ///
2143    /// ## See also
2144    /// - [`SDL_LockTextureToSurface`]
2145    /// - [`SDL_UnlockTexture`]
2146    pub fn SDL_LockTexture(
2147        texture: *mut SDL_Texture,
2148        rect: *const SDL_Rect,
2149        pixels: *mut *mut ::core::ffi::c_void,
2150        pitch: *mut ::core::ffi::c_int,
2151    ) -> ::core::primitive::bool;
2152}
2153
2154unsafe extern "C" {
2155    /// Lock a portion of the texture for **write-only** pixel access, and expose
2156    /// it as a SDL surface.
2157    ///
2158    /// Besides providing an [`SDL_Surface`] instead of raw pixel data, this function
2159    /// operates like [`SDL_LockTexture`].
2160    ///
2161    /// As an optimization, the pixels made available for editing don't necessarily
2162    /// contain the old texture data. This is a write-only operation, and if you
2163    /// need to keep a copy of the texture data you should do that at the
2164    /// application level.
2165    ///
2166    /// You must use [`SDL_UnlockTexture()`] to unlock the pixels and apply any
2167    /// changes.
2168    ///
2169    /// The returned surface is freed internally after calling [`SDL_UnlockTexture()`]
2170    /// or [`SDL_DestroyTexture()`]. The caller should not free it.
2171    ///
2172    /// ## Parameters
2173    /// - `texture`: the texture to lock for access, which must be created with
2174    ///   [`SDL_TEXTUREACCESS_STREAMING`].
2175    /// - `rect`: a pointer to the rectangle to lock for access. If the rect is
2176    ///   NULL, the entire texture will be locked.
2177    /// - `surface`: a pointer to an SDL surface of size **rect**. Don't assume
2178    ///   any specific pixel content.
2179    ///
2180    /// ## Return value
2181    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2182    ///   information.
2183    ///
2184    /// ## Thread safety
2185    /// This function should only be called on the main thread.
2186    ///
2187    /// ## Availability
2188    /// This function is available since SDL 3.2.0.
2189    ///
2190    /// ## See also
2191    /// - [`SDL_LockTexture`]
2192    /// - [`SDL_UnlockTexture`]
2193    pub fn SDL_LockTextureToSurface(
2194        texture: *mut SDL_Texture,
2195        rect: *const SDL_Rect,
2196        surface: *mut *mut SDL_Surface,
2197    ) -> ::core::primitive::bool;
2198}
2199
2200unsafe extern "C" {
2201    /// Unlock a texture, uploading the changes to video memory, if needed.
2202    ///
2203    /// **Warning**: Please note that [`SDL_LockTexture()`] is intended to be
2204    /// write-only; it will not guarantee the previous contents of the texture will
2205    /// be provided. You must fully initialize any area of a texture that you lock
2206    /// before unlocking it, as the pixels might otherwise be uninitialized memory.
2207    ///
2208    /// Which is to say: locking and immediately unlocking a texture can result in
2209    /// corrupted textures, depending on the renderer in use.
2210    ///
2211    /// ## Parameters
2212    /// - `texture`: a texture locked by [`SDL_LockTexture()`].
2213    ///
2214    /// ## Thread safety
2215    /// This function should only be called on the main thread.
2216    ///
2217    /// ## Availability
2218    /// This function is available since SDL 3.2.0.
2219    ///
2220    /// ## See also
2221    /// - [`SDL_LockTexture`]
2222    pub fn SDL_UnlockTexture(texture: *mut SDL_Texture);
2223}
2224
2225unsafe extern "C" {
2226    /// Set a texture as the current rendering target.
2227    ///
2228    /// The default render target is the window for which the renderer was created.
2229    /// To stop rendering to a texture and render to the window again, call this
2230    /// function with a NULL `texture`.
2231    ///
2232    /// Viewport, cliprect, scale, and logical presentation are unique to each
2233    /// render target. Get and set functions for these states apply to the current
2234    /// render target set by this function, and those states persist on each target
2235    /// when the current render target changes.
2236    ///
2237    /// ## Parameters
2238    /// - `renderer`: the rendering context.
2239    /// - `texture`: the targeted texture, which must be created with the
2240    ///   [`SDL_TEXTUREACCESS_TARGET`] flag, or NULL to render to the
2241    ///   window instead of a texture.
2242    ///
2243    /// ## Return value
2244    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2245    ///   information.
2246    ///
2247    /// ## Thread safety
2248    /// This function should only be called on the main thread.
2249    ///
2250    /// ## Availability
2251    /// This function is available since SDL 3.2.0.
2252    ///
2253    /// ## See also
2254    /// - [`SDL_GetRenderTarget`]
2255    pub fn SDL_SetRenderTarget(
2256        renderer: *mut SDL_Renderer,
2257        texture: *mut SDL_Texture,
2258    ) -> ::core::primitive::bool;
2259}
2260
2261unsafe extern "C" {
2262    /// Get the current render target.
2263    ///
2264    /// The default render target is the window for which the renderer was created,
2265    /// and is reported a NULL here.
2266    ///
2267    /// ## Parameters
2268    /// - `renderer`: the rendering context.
2269    ///
2270    /// ## Return value
2271    /// Returns the current render target or NULL for the default render target.
2272    ///
2273    /// ## Thread safety
2274    /// This function should only be called on the main thread.
2275    ///
2276    /// ## Availability
2277    /// This function is available since SDL 3.2.0.
2278    ///
2279    /// ## See also
2280    /// - [`SDL_SetRenderTarget`]
2281    pub fn SDL_GetRenderTarget(renderer: *mut SDL_Renderer) -> *mut SDL_Texture;
2282}
2283
2284unsafe extern "C" {
2285    /// Set a device-independent resolution and presentation mode for rendering.
2286    ///
2287    /// This function sets the width and height of the logical rendering output.
2288    /// The renderer will act as if the current render target is always the
2289    /// requested dimensions, scaling to the actual resolution as necessary.
2290    ///
2291    /// This can be useful for games that expect a fixed size, but would like to
2292    /// scale the output to whatever is available, regardless of how a user resizes
2293    /// a window, or if the display is high DPI.
2294    ///
2295    /// Logical presentation can be used with both render target textures and the
2296    /// renderer's window; the state is unique to each render target, and this
2297    /// function sets the state for the current render target. It might be useful
2298    /// to draw to a texture that matches the window dimensions with logical
2299    /// presentation enabled, and then draw that texture across the entire window
2300    /// with logical presentation disabled. Be careful not to render both with
2301    /// logical presentation enabled, however, as this could produce
2302    /// double-letterboxing, etc.
2303    ///
2304    /// You can disable logical coordinates by setting the mode to
2305    /// [`SDL_LOGICAL_PRESENTATION_DISABLED`], and in that case you get the full pixel
2306    /// resolution of the render target; it is safe to toggle logical presentation
2307    /// during the rendering of a frame: perhaps most of the rendering is done to
2308    /// specific dimensions but to make fonts look sharp, the app turns off logical
2309    /// presentation while drawing text, for example.
2310    ///
2311    /// You can convert coordinates in an event into rendering coordinates using
2312    /// [`SDL_ConvertEventToRenderCoordinates()`].
2313    ///
2314    /// ## Parameters
2315    /// - `renderer`: the rendering context.
2316    /// - `w`: the width of the logical resolution.
2317    /// - `h`: the height of the logical resolution.
2318    /// - `mode`: the presentation mode used.
2319    ///
2320    /// ## Return value
2321    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2322    ///   information.
2323    ///
2324    /// ## Thread safety
2325    /// This function should only be called on the main thread.
2326    ///
2327    /// ## Availability
2328    /// This function is available since SDL 3.2.0.
2329    ///
2330    /// ## See also
2331    /// - [`SDL_ConvertEventToRenderCoordinates`]
2332    /// - [`SDL_GetRenderLogicalPresentation`]
2333    /// - [`SDL_GetRenderLogicalPresentationRect`]
2334    pub fn SDL_SetRenderLogicalPresentation(
2335        renderer: *mut SDL_Renderer,
2336        w: ::core::ffi::c_int,
2337        h: ::core::ffi::c_int,
2338        mode: SDL_RendererLogicalPresentation,
2339    ) -> ::core::primitive::bool;
2340}
2341
2342unsafe extern "C" {
2343    /// Get device independent resolution and presentation mode for rendering.
2344    ///
2345    /// This function gets the width and height of the logical rendering output, or
2346    /// 0 if a logical resolution is not enabled.
2347    ///
2348    /// Each render target has its own logical presentation state. This function
2349    /// gets the state for the current render target.
2350    ///
2351    /// ## Parameters
2352    /// - `renderer`: the rendering context.
2353    /// - `w`: an int filled with the logical presentation width.
2354    /// - `h`: an int filled with the logical presentation height.
2355    /// - `mode`: a variable filled with the logical presentation mode being
2356    ///   used.
2357    ///
2358    /// ## Return value
2359    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2360    ///   information.
2361    ///
2362    /// ## Thread safety
2363    /// This function should only be called on the main thread.
2364    ///
2365    /// ## Availability
2366    /// This function is available since SDL 3.2.0.
2367    ///
2368    /// ## See also
2369    /// - [`SDL_SetRenderLogicalPresentation`]
2370    pub fn SDL_GetRenderLogicalPresentation(
2371        renderer: *mut SDL_Renderer,
2372        w: *mut ::core::ffi::c_int,
2373        h: *mut ::core::ffi::c_int,
2374        mode: *mut SDL_RendererLogicalPresentation,
2375    ) -> ::core::primitive::bool;
2376}
2377
2378unsafe extern "C" {
2379    /// Get the final presentation rectangle for rendering.
2380    ///
2381    /// This function returns the calculated rectangle used for logical
2382    /// presentation, based on the presentation mode and output size. If logical
2383    /// presentation is disabled, it will fill the rectangle with the output size,
2384    /// in pixels.
2385    ///
2386    /// Each render target has its own logical presentation state. This function
2387    /// gets the rectangle for the current render target.
2388    ///
2389    /// ## Parameters
2390    /// - `renderer`: the rendering context.
2391    /// - `rect`: a pointer filled in with the final presentation rectangle, may
2392    ///   be NULL.
2393    ///
2394    /// ## Return value
2395    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2396    ///   information.
2397    ///
2398    /// ## Thread safety
2399    /// This function should only be called on the main thread.
2400    ///
2401    /// ## Availability
2402    /// This function is available since SDL 3.2.0.
2403    ///
2404    /// ## See also
2405    /// - [`SDL_SetRenderLogicalPresentation`]
2406    pub fn SDL_GetRenderLogicalPresentationRect(
2407        renderer: *mut SDL_Renderer,
2408        rect: *mut SDL_FRect,
2409    ) -> ::core::primitive::bool;
2410}
2411
2412unsafe extern "C" {
2413    /// Get a point in render coordinates when given a point in window coordinates.
2414    ///
2415    /// This takes into account several states:
2416    ///
2417    /// - The window dimensions.
2418    /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`])
2419    /// - The scale ([`SDL_SetRenderScale`])
2420    /// - The viewport ([`SDL_SetRenderViewport`])
2421    ///
2422    /// ## Parameters
2423    /// - `renderer`: the rendering context.
2424    /// - `window_x`: the x coordinate in window coordinates.
2425    /// - `window_y`: the y coordinate in window coordinates.
2426    /// - `x`: a pointer filled with the x coordinate in render coordinates.
2427    /// - `y`: a pointer filled with the y coordinate in render coordinates.
2428    ///
2429    /// ## Return value
2430    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2431    ///   information.
2432    ///
2433    /// ## Thread safety
2434    /// This function should only be called on the main thread.
2435    ///
2436    /// ## Availability
2437    /// This function is available since SDL 3.2.0.
2438    ///
2439    /// ## See also
2440    /// - [`SDL_SetRenderLogicalPresentation`]
2441    /// - [`SDL_SetRenderScale`]
2442    pub fn SDL_RenderCoordinatesFromWindow(
2443        renderer: *mut SDL_Renderer,
2444        window_x: ::core::ffi::c_float,
2445        window_y: ::core::ffi::c_float,
2446        x: *mut ::core::ffi::c_float,
2447        y: *mut ::core::ffi::c_float,
2448    ) -> ::core::primitive::bool;
2449}
2450
2451unsafe extern "C" {
2452    /// Get a point in window coordinates when given a point in render coordinates.
2453    ///
2454    /// This takes into account several states:
2455    ///
2456    /// - The window dimensions.
2457    /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`])
2458    /// - The scale ([`SDL_SetRenderScale`])
2459    /// - The viewport ([`SDL_SetRenderViewport`])
2460    ///
2461    /// ## Parameters
2462    /// - `renderer`: the rendering context.
2463    /// - `x`: the x coordinate in render coordinates.
2464    /// - `y`: the y coordinate in render coordinates.
2465    /// - `window_x`: a pointer filled with the x coordinate in window
2466    ///   coordinates.
2467    /// - `window_y`: a pointer filled with the y coordinate in window
2468    ///   coordinates.
2469    ///
2470    /// ## Return value
2471    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2472    ///   information.
2473    ///
2474    /// ## Thread safety
2475    /// This function should only be called on the main thread.
2476    ///
2477    /// ## Availability
2478    /// This function is available since SDL 3.2.0.
2479    ///
2480    /// ## See also
2481    /// - [`SDL_SetRenderLogicalPresentation`]
2482    /// - [`SDL_SetRenderScale`]
2483    /// - [`SDL_SetRenderViewport`]
2484    pub fn SDL_RenderCoordinatesToWindow(
2485        renderer: *mut SDL_Renderer,
2486        x: ::core::ffi::c_float,
2487        y: ::core::ffi::c_float,
2488        window_x: *mut ::core::ffi::c_float,
2489        window_y: *mut ::core::ffi::c_float,
2490    ) -> ::core::primitive::bool;
2491}
2492
2493unsafe extern "C" {
2494    /// Convert the coordinates in an event to render coordinates.
2495    ///
2496    /// This takes into account several states:
2497    ///
2498    /// - The window dimensions.
2499    /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`])
2500    /// - The scale ([`SDL_SetRenderScale`])
2501    /// - The viewport ([`SDL_SetRenderViewport`])
2502    ///
2503    /// Various event types are converted with this function: mouse, touch, pen,
2504    /// etc.
2505    ///
2506    /// Touch coordinates are converted from normalized coordinates in the window
2507    /// to non-normalized rendering coordinates.
2508    ///
2509    /// Relative mouse coordinates (xrel and yrel event fields) are _also_
2510    /// converted. Applications that do not want these fields converted should use
2511    /// [`SDL_RenderCoordinatesFromWindow()`] on the specific event fields instead of
2512    /// converting the entire event structure.
2513    ///
2514    /// Once converted, coordinates may be outside the rendering area.
2515    ///
2516    /// ## Parameters
2517    /// - `renderer`: the rendering context.
2518    /// - `event`: the event to modify.
2519    ///
2520    /// ## Return value
2521    /// Returns true if the event is converted or doesn't need conversion, or
2522    ///   false on failure; call [`SDL_GetError()`] for more information.
2523    ///
2524    /// ## Thread safety
2525    /// This function should only be called on the main thread.
2526    ///
2527    /// ## Availability
2528    /// This function is available since SDL 3.2.0.
2529    ///
2530    /// ## See also
2531    /// - [`SDL_RenderCoordinatesFromWindow`]
2532    pub fn SDL_ConvertEventToRenderCoordinates(
2533        renderer: *mut SDL_Renderer,
2534        event: *mut SDL_Event,
2535    ) -> ::core::primitive::bool;
2536}
2537
2538unsafe extern "C" {
2539    /// Set the drawing area for rendering on the current target.
2540    ///
2541    /// Drawing will clip to this area (separately from any clipping done with
2542    /// [`SDL_SetRenderClipRect`]), and the top left of the area will become coordinate
2543    /// (0, 0) for future drawing commands.
2544    ///
2545    /// The area's width and height must be >= 0.
2546    ///
2547    /// Each render target has its own viewport. This function sets the viewport
2548    /// for the current render target.
2549    ///
2550    /// ## Parameters
2551    /// - `renderer`: the rendering context.
2552    /// - `rect`: the [`SDL_Rect`] structure representing the drawing area, or NULL
2553    ///   to set the viewport to the entire target.
2554    ///
2555    /// ## Return value
2556    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2557    ///   information.
2558    ///
2559    /// ## Thread safety
2560    /// This function should only be called on the main thread.
2561    ///
2562    /// ## Availability
2563    /// This function is available since SDL 3.2.0.
2564    ///
2565    /// ## See also
2566    /// - [`SDL_GetRenderViewport`]
2567    /// - [`SDL_RenderViewportSet`]
2568    pub fn SDL_SetRenderViewport(
2569        renderer: *mut SDL_Renderer,
2570        rect: *const SDL_Rect,
2571    ) -> ::core::primitive::bool;
2572}
2573
2574unsafe extern "C" {
2575    /// Get the drawing area for the current target.
2576    ///
2577    /// Each render target has its own viewport. This function gets the viewport
2578    /// for the current render target.
2579    ///
2580    /// ## Parameters
2581    /// - `renderer`: the rendering context.
2582    /// - `rect`: an [`SDL_Rect`] structure filled in with the current drawing area.
2583    ///
2584    /// ## Return value
2585    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2586    ///   information.
2587    ///
2588    /// ## Thread safety
2589    /// This function should only be called on the main thread.
2590    ///
2591    /// ## Availability
2592    /// This function is available since SDL 3.2.0.
2593    ///
2594    /// ## See also
2595    /// - [`SDL_RenderViewportSet`]
2596    /// - [`SDL_SetRenderViewport`]
2597    pub fn SDL_GetRenderViewport(
2598        renderer: *mut SDL_Renderer,
2599        rect: *mut SDL_Rect,
2600    ) -> ::core::primitive::bool;
2601}
2602
2603unsafe extern "C" {
2604    /// Return whether an explicit rectangle was set as the viewport.
2605    ///
2606    /// This is useful if you're saving and restoring the viewport and want to know
2607    /// whether you should restore a specific rectangle or NULL.
2608    ///
2609    /// Each render target has its own viewport. This function checks the viewport
2610    /// for the current render target.
2611    ///
2612    /// ## Parameters
2613    /// - `renderer`: the rendering context.
2614    ///
2615    /// ## Return value
2616    /// Returns true if the viewport was set to a specific rectangle, or false if
2617    ///   it was set to NULL (the entire target).
2618    ///
2619    /// ## Thread safety
2620    /// This function should only be called on the main thread.
2621    ///
2622    /// ## Availability
2623    /// This function is available since SDL 3.2.0.
2624    ///
2625    /// ## See also
2626    /// - [`SDL_GetRenderViewport`]
2627    /// - [`SDL_SetRenderViewport`]
2628    pub fn SDL_RenderViewportSet(renderer: *mut SDL_Renderer) -> ::core::primitive::bool;
2629}
2630
2631unsafe extern "C" {
2632    /// Get the safe area for rendering within the current viewport.
2633    ///
2634    /// Some devices have portions of the screen which are partially obscured or
2635    /// not interactive, possibly due to on-screen controls, curved edges, camera
2636    /// notches, TV overscan, etc. This function provides the area of the current
2637    /// viewport which is safe to have interactible content. You should continue
2638    /// rendering into the rest of the render target, but it should not contain
2639    /// visually important or interactible content.
2640    ///
2641    /// ## Parameters
2642    /// - `renderer`: the rendering context.
2643    /// - `rect`: a pointer filled in with the area that is safe for interactive
2644    ///   content.
2645    ///
2646    /// ## Return value
2647    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2648    ///   information.
2649    ///
2650    /// ## Thread safety
2651    /// This function should only be called on the main thread.
2652    ///
2653    /// ## Availability
2654    /// This function is available since SDL 3.2.0.
2655    pub fn SDL_GetRenderSafeArea(
2656        renderer: *mut SDL_Renderer,
2657        rect: *mut SDL_Rect,
2658    ) -> ::core::primitive::bool;
2659}
2660
2661unsafe extern "C" {
2662    /// Set the clip rectangle for rendering on the specified target.
2663    ///
2664    /// Each render target has its own clip rectangle. This function sets the
2665    /// cliprect for the current render target.
2666    ///
2667    /// ## Parameters
2668    /// - `renderer`: the rendering context.
2669    /// - `rect`: an [`SDL_Rect`] structure representing the clip area, relative to
2670    ///   the viewport, or NULL to disable clipping.
2671    ///
2672    /// ## Return value
2673    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2674    ///   information.
2675    ///
2676    /// ## Thread safety
2677    /// This function should only be called on the main thread.
2678    ///
2679    /// ## Availability
2680    /// This function is available since SDL 3.2.0.
2681    ///
2682    /// ## See also
2683    /// - [`SDL_GetRenderClipRect`]
2684    /// - [`SDL_RenderClipEnabled`]
2685    pub fn SDL_SetRenderClipRect(
2686        renderer: *mut SDL_Renderer,
2687        rect: *const SDL_Rect,
2688    ) -> ::core::primitive::bool;
2689}
2690
2691unsafe extern "C" {
2692    /// Get the clip rectangle for the current target.
2693    ///
2694    /// Each render target has its own clip rectangle. This function gets the
2695    /// cliprect for the current render target.
2696    ///
2697    /// ## Parameters
2698    /// - `renderer`: the rendering context.
2699    /// - `rect`: an [`SDL_Rect`] structure filled in with the current clipping area
2700    ///   or an empty rectangle if clipping is disabled.
2701    ///
2702    /// ## Return value
2703    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2704    ///   information.
2705    ///
2706    /// ## Thread safety
2707    /// This function should only be called on the main thread.
2708    ///
2709    /// ## Availability
2710    /// This function is available since SDL 3.2.0.
2711    ///
2712    /// ## See also
2713    /// - [`SDL_RenderClipEnabled`]
2714    /// - [`SDL_SetRenderClipRect`]
2715    pub fn SDL_GetRenderClipRect(
2716        renderer: *mut SDL_Renderer,
2717        rect: *mut SDL_Rect,
2718    ) -> ::core::primitive::bool;
2719}
2720
2721unsafe extern "C" {
2722    /// Get whether clipping is enabled on the given render target.
2723    ///
2724    /// Each render target has its own clip rectangle. This function checks the
2725    /// cliprect for the current render target.
2726    ///
2727    /// ## Parameters
2728    /// - `renderer`: the rendering context.
2729    ///
2730    /// ## Return value
2731    /// Returns true if clipping is enabled or false if not; call [`SDL_GetError()`]
2732    ///   for more information.
2733    ///
2734    /// ## Thread safety
2735    /// This function should only be called on the main thread.
2736    ///
2737    /// ## Availability
2738    /// This function is available since SDL 3.2.0.
2739    ///
2740    /// ## See also
2741    /// - [`SDL_GetRenderClipRect`]
2742    /// - [`SDL_SetRenderClipRect`]
2743    pub fn SDL_RenderClipEnabled(renderer: *mut SDL_Renderer) -> ::core::primitive::bool;
2744}
2745
2746unsafe extern "C" {
2747    /// Set the drawing scale for rendering on the current target.
2748    ///
2749    /// The drawing coordinates are scaled by the x/y scaling factors before they
2750    /// are used by the renderer. This allows resolution independent drawing with a
2751    /// single coordinate system.
2752    ///
2753    /// If this results in scaling or subpixel drawing by the rendering backend, it
2754    /// will be handled using the appropriate quality hints. For best results use
2755    /// integer scaling factors.
2756    ///
2757    /// Each render target has its own scale. This function sets the scale for the
2758    /// current render target.
2759    ///
2760    /// ## Parameters
2761    /// - `renderer`: the rendering context.
2762    /// - `scaleX`: the horizontal scaling factor.
2763    /// - `scaleY`: the vertical scaling factor.
2764    ///
2765    /// ## Return value
2766    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2767    ///   information.
2768    ///
2769    /// ## Thread safety
2770    /// This function should only be called on the main thread.
2771    ///
2772    /// ## Availability
2773    /// This function is available since SDL 3.2.0.
2774    ///
2775    /// ## See also
2776    /// - [`SDL_GetRenderScale`]
2777    pub fn SDL_SetRenderScale(
2778        renderer: *mut SDL_Renderer,
2779        scaleX: ::core::ffi::c_float,
2780        scaleY: ::core::ffi::c_float,
2781    ) -> ::core::primitive::bool;
2782}
2783
2784unsafe extern "C" {
2785    /// Get the drawing scale for the current target.
2786    ///
2787    /// Each render target has its own scale. This function gets the scale for the
2788    /// current render target.
2789    ///
2790    /// ## Parameters
2791    /// - `renderer`: the rendering context.
2792    /// - `scaleX`: a pointer filled in with the horizontal scaling factor.
2793    /// - `scaleY`: a pointer filled in with the vertical scaling factor.
2794    ///
2795    /// ## Return value
2796    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2797    ///   information.
2798    ///
2799    /// ## Thread safety
2800    /// This function should only be called on the main thread.
2801    ///
2802    /// ## Availability
2803    /// This function is available since SDL 3.2.0.
2804    ///
2805    /// ## See also
2806    /// - [`SDL_SetRenderScale`]
2807    pub fn SDL_GetRenderScale(
2808        renderer: *mut SDL_Renderer,
2809        scaleX: *mut ::core::ffi::c_float,
2810        scaleY: *mut ::core::ffi::c_float,
2811    ) -> ::core::primitive::bool;
2812}
2813
2814unsafe extern "C" {
2815    /// Set the color used for drawing operations.
2816    ///
2817    /// Set the color for drawing or filling rectangles, lines, and points, and for
2818    /// [`SDL_RenderClear()`].
2819    ///
2820    /// ## Parameters
2821    /// - `renderer`: the rendering context.
2822    /// - `r`: the red value used to draw on the rendering target.
2823    /// - `g`: the green value used to draw on the rendering target.
2824    /// - `b`: the blue value used to draw on the rendering target.
2825    /// - `a`: the alpha value used to draw on the rendering target; usually
2826    ///   [`SDL_ALPHA_OPAQUE`] (255). Use [`SDL_SetRenderDrawBlendMode`] to
2827    ///   specify how the alpha channel is used.
2828    ///
2829    /// ## Return value
2830    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2831    ///   information.
2832    ///
2833    /// ## Thread safety
2834    /// This function should only be called on the main thread.
2835    ///
2836    /// ## Availability
2837    /// This function is available since SDL 3.2.0.
2838    ///
2839    /// ## See also
2840    /// - [`SDL_GetRenderDrawColor`]
2841    /// - [`SDL_SetRenderDrawColorFloat`]
2842    pub fn SDL_SetRenderDrawColor(
2843        renderer: *mut SDL_Renderer,
2844        r: Uint8,
2845        g: Uint8,
2846        b: Uint8,
2847        a: Uint8,
2848    ) -> ::core::primitive::bool;
2849}
2850
2851unsafe extern "C" {
2852    /// Set the color used for drawing operations (Rect, Line and Clear).
2853    ///
2854    /// Set the color for drawing or filling rectangles, lines, and points, and for
2855    /// [`SDL_RenderClear()`].
2856    ///
2857    /// ## Parameters
2858    /// - `renderer`: the rendering context.
2859    /// - `r`: the red value used to draw on the rendering target.
2860    /// - `g`: the green value used to draw on the rendering target.
2861    /// - `b`: the blue value used to draw on the rendering target.
2862    /// - `a`: the alpha value used to draw on the rendering target. Use
2863    ///   [`SDL_SetRenderDrawBlendMode`] to specify how the alpha channel is
2864    ///   used.
2865    ///
2866    /// ## Return value
2867    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2868    ///   information.
2869    ///
2870    /// ## Thread safety
2871    /// This function should only be called on the main thread.
2872    ///
2873    /// ## Availability
2874    /// This function is available since SDL 3.2.0.
2875    ///
2876    /// ## See also
2877    /// - [`SDL_GetRenderDrawColorFloat`]
2878    /// - [`SDL_SetRenderDrawColor`]
2879    pub fn SDL_SetRenderDrawColorFloat(
2880        renderer: *mut SDL_Renderer,
2881        r: ::core::ffi::c_float,
2882        g: ::core::ffi::c_float,
2883        b: ::core::ffi::c_float,
2884        a: ::core::ffi::c_float,
2885    ) -> ::core::primitive::bool;
2886}
2887
2888unsafe extern "C" {
2889    /// Get the color used for drawing operations (Rect, Line and Clear).
2890    ///
2891    /// ## Parameters
2892    /// - `renderer`: the rendering context.
2893    /// - `r`: a pointer filled in with the red value used to draw on the
2894    ///   rendering target.
2895    /// - `g`: a pointer filled in with the green value used to draw on the
2896    ///   rendering target.
2897    /// - `b`: a pointer filled in with the blue value used to draw on the
2898    ///   rendering target.
2899    /// - `a`: a pointer filled in with the alpha value used to draw on the
2900    ///   rendering target; usually [`SDL_ALPHA_OPAQUE`] (255).
2901    ///
2902    /// ## Return value
2903    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2904    ///   information.
2905    ///
2906    /// ## Thread safety
2907    /// This function should only be called on the main thread.
2908    ///
2909    /// ## Availability
2910    /// This function is available since SDL 3.2.0.
2911    ///
2912    /// ## See also
2913    /// - [`SDL_GetRenderDrawColorFloat`]
2914    /// - [`SDL_SetRenderDrawColor`]
2915    pub fn SDL_GetRenderDrawColor(
2916        renderer: *mut SDL_Renderer,
2917        r: *mut Uint8,
2918        g: *mut Uint8,
2919        b: *mut Uint8,
2920        a: *mut Uint8,
2921    ) -> ::core::primitive::bool;
2922}
2923
2924unsafe extern "C" {
2925    /// Get the color used for drawing operations (Rect, Line and Clear).
2926    ///
2927    /// ## Parameters
2928    /// - `renderer`: the rendering context.
2929    /// - `r`: a pointer filled in with the red value used to draw on the
2930    ///   rendering target.
2931    /// - `g`: a pointer filled in with the green value used to draw on the
2932    ///   rendering target.
2933    /// - `b`: a pointer filled in with the blue value used to draw on the
2934    ///   rendering target.
2935    /// - `a`: a pointer filled in with the alpha value used to draw on the
2936    ///   rendering target.
2937    ///
2938    /// ## Return value
2939    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2940    ///   information.
2941    ///
2942    /// ## Thread safety
2943    /// This function should only be called on the main thread.
2944    ///
2945    /// ## Availability
2946    /// This function is available since SDL 3.2.0.
2947    ///
2948    /// ## See also
2949    /// - [`SDL_SetRenderDrawColorFloat`]
2950    /// - [`SDL_GetRenderDrawColor`]
2951    pub fn SDL_GetRenderDrawColorFloat(
2952        renderer: *mut SDL_Renderer,
2953        r: *mut ::core::ffi::c_float,
2954        g: *mut ::core::ffi::c_float,
2955        b: *mut ::core::ffi::c_float,
2956        a: *mut ::core::ffi::c_float,
2957    ) -> ::core::primitive::bool;
2958}
2959
2960unsafe extern "C" {
2961    /// Set the color scale used for render operations.
2962    ///
2963    /// The color scale is an additional scale multiplied into the pixel color
2964    /// value while rendering. This can be used to adjust the brightness of colors
2965    /// during HDR rendering, or changing HDR video brightness when playing on an
2966    /// SDR display.
2967    ///
2968    /// The color scale does not affect the alpha channel, only the color
2969    /// brightness.
2970    ///
2971    /// ## Parameters
2972    /// - `renderer`: the rendering context.
2973    /// - `scale`: the color scale value.
2974    ///
2975    /// ## Return value
2976    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2977    ///   information.
2978    ///
2979    /// ## Thread safety
2980    /// This function should only be called on the main thread.
2981    ///
2982    /// ## Availability
2983    /// This function is available since SDL 3.2.0.
2984    ///
2985    /// ## See also
2986    /// - [`SDL_GetRenderColorScale`]
2987    pub fn SDL_SetRenderColorScale(
2988        renderer: *mut SDL_Renderer,
2989        scale: ::core::ffi::c_float,
2990    ) -> ::core::primitive::bool;
2991}
2992
2993unsafe extern "C" {
2994    /// Get the color scale used for render operations.
2995    ///
2996    /// ## Parameters
2997    /// - `renderer`: the rendering context.
2998    /// - `scale`: a pointer filled in with the current color scale value.
2999    ///
3000    /// ## Return value
3001    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3002    ///   information.
3003    ///
3004    /// ## Thread safety
3005    /// This function should only be called on the main thread.
3006    ///
3007    /// ## Availability
3008    /// This function is available since SDL 3.2.0.
3009    ///
3010    /// ## See also
3011    /// - [`SDL_SetRenderColorScale`]
3012    pub fn SDL_GetRenderColorScale(
3013        renderer: *mut SDL_Renderer,
3014        scale: *mut ::core::ffi::c_float,
3015    ) -> ::core::primitive::bool;
3016}
3017
3018unsafe extern "C" {
3019    /// Set the blend mode used for drawing operations (Fill and Line).
3020    ///
3021    /// If the blend mode is not supported, the closest supported mode is chosen.
3022    ///
3023    /// ## Parameters
3024    /// - `renderer`: the rendering context.
3025    /// - `blendMode`: the [`SDL_BlendMode`] to use for blending.
3026    ///
3027    /// ## Return value
3028    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3029    ///   information.
3030    ///
3031    /// ## Thread safety
3032    /// This function should only be called on the main thread.
3033    ///
3034    /// ## Availability
3035    /// This function is available since SDL 3.2.0.
3036    ///
3037    /// ## See also
3038    /// - [`SDL_GetRenderDrawBlendMode`]
3039    pub fn SDL_SetRenderDrawBlendMode(
3040        renderer: *mut SDL_Renderer,
3041        blendMode: SDL_BlendMode,
3042    ) -> ::core::primitive::bool;
3043}
3044
3045unsafe extern "C" {
3046    /// Get the blend mode used for drawing operations.
3047    ///
3048    /// ## Parameters
3049    /// - `renderer`: the rendering context.
3050    /// - `blendMode`: a pointer filled in with the current [`SDL_BlendMode`].
3051    ///
3052    /// ## Return value
3053    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3054    ///   information.
3055    ///
3056    /// ## Thread safety
3057    /// This function should only be called on the main thread.
3058    ///
3059    /// ## Availability
3060    /// This function is available since SDL 3.2.0.
3061    ///
3062    /// ## See also
3063    /// - [`SDL_SetRenderDrawBlendMode`]
3064    pub fn SDL_GetRenderDrawBlendMode(
3065        renderer: *mut SDL_Renderer,
3066        blendMode: *mut SDL_BlendMode,
3067    ) -> ::core::primitive::bool;
3068}
3069
3070unsafe extern "C" {
3071    /// Clear the current rendering target with the drawing color.
3072    ///
3073    /// This function clears the entire rendering target, ignoring the viewport and
3074    /// the clip rectangle. Note, that clearing will also set/fill all pixels of
3075    /// the rendering target to current renderer draw color, so make sure to invoke
3076    /// [`SDL_SetRenderDrawColor()`] when needed.
3077    ///
3078    /// ## Parameters
3079    /// - `renderer`: the rendering context.
3080    ///
3081    /// ## Return value
3082    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3083    ///   information.
3084    ///
3085    /// ## Thread safety
3086    /// This function should only be called on the main thread.
3087    ///
3088    /// ## Availability
3089    /// This function is available since SDL 3.2.0.
3090    ///
3091    /// ## See also
3092    /// - [`SDL_SetRenderDrawColor`]
3093    pub fn SDL_RenderClear(renderer: *mut SDL_Renderer) -> ::core::primitive::bool;
3094}
3095
3096unsafe extern "C" {
3097    /// Draw a point on the current rendering target at subpixel precision.
3098    ///
3099    /// ## Parameters
3100    /// - `renderer`: the renderer which should draw a point.
3101    /// - `x`: the x coordinate of the point.
3102    /// - `y`: the y coordinate of the point.
3103    ///
3104    /// ## Return value
3105    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3106    ///   information.
3107    ///
3108    /// ## Thread safety
3109    /// This function should only be called on the main thread.
3110    ///
3111    /// ## Availability
3112    /// This function is available since SDL 3.2.0.
3113    ///
3114    /// ## See also
3115    /// - [`SDL_RenderPoints`]
3116    pub fn SDL_RenderPoint(
3117        renderer: *mut SDL_Renderer,
3118        x: ::core::ffi::c_float,
3119        y: ::core::ffi::c_float,
3120    ) -> ::core::primitive::bool;
3121}
3122
3123unsafe extern "C" {
3124    /// Draw multiple points on the current rendering target at subpixel precision.
3125    ///
3126    /// ## Parameters
3127    /// - `renderer`: the renderer which should draw multiple points.
3128    /// - `points`: the points to draw.
3129    /// - `count`: the number of points to draw.
3130    ///
3131    /// ## Return value
3132    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3133    ///   information.
3134    ///
3135    /// ## Thread safety
3136    /// This function should only be called on the main thread.
3137    ///
3138    /// ## Availability
3139    /// This function is available since SDL 3.2.0.
3140    ///
3141    /// ## See also
3142    /// - [`SDL_RenderPoint`]
3143    pub fn SDL_RenderPoints(
3144        renderer: *mut SDL_Renderer,
3145        points: *const SDL_FPoint,
3146        count: ::core::ffi::c_int,
3147    ) -> ::core::primitive::bool;
3148}
3149
3150unsafe extern "C" {
3151    /// Draw a line on the current rendering target at subpixel precision.
3152    ///
3153    /// ## Parameters
3154    /// - `renderer`: the renderer which should draw a line.
3155    /// - `x1`: the x coordinate of the start point.
3156    /// - `y1`: the y coordinate of the start point.
3157    /// - `x2`: the x coordinate of the end point.
3158    /// - `y2`: the y coordinate of the end point.
3159    ///
3160    /// ## Return value
3161    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3162    ///   information.
3163    ///
3164    /// ## Thread safety
3165    /// This function should only be called on the main thread.
3166    ///
3167    /// ## Availability
3168    /// This function is available since SDL 3.2.0.
3169    ///
3170    /// ## See also
3171    /// - [`SDL_RenderLines`]
3172    pub fn SDL_RenderLine(
3173        renderer: *mut SDL_Renderer,
3174        x1: ::core::ffi::c_float,
3175        y1: ::core::ffi::c_float,
3176        x2: ::core::ffi::c_float,
3177        y2: ::core::ffi::c_float,
3178    ) -> ::core::primitive::bool;
3179}
3180
3181unsafe extern "C" {
3182    /// Draw a series of connected lines on the current rendering target at
3183    /// subpixel precision.
3184    ///
3185    /// ## Parameters
3186    /// - `renderer`: the renderer which should draw multiple lines.
3187    /// - `points`: the points along the lines.
3188    /// - `count`: the number of points, drawing count-1 lines.
3189    ///
3190    /// ## Return value
3191    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3192    ///   information.
3193    ///
3194    /// ## Thread safety
3195    /// This function should only be called on the main thread.
3196    ///
3197    /// ## Availability
3198    /// This function is available since SDL 3.2.0.
3199    ///
3200    /// ## See also
3201    /// - [`SDL_RenderLine`]
3202    pub fn SDL_RenderLines(
3203        renderer: *mut SDL_Renderer,
3204        points: *const SDL_FPoint,
3205        count: ::core::ffi::c_int,
3206    ) -> ::core::primitive::bool;
3207}
3208
3209unsafe extern "C" {
3210    /// Draw a rectangle on the current rendering target at subpixel precision.
3211    ///
3212    /// ## Parameters
3213    /// - `renderer`: the renderer which should draw a rectangle.
3214    /// - `rect`: a pointer to the destination rectangle, or NULL to outline the
3215    ///   entire rendering target.
3216    ///
3217    /// ## Return value
3218    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3219    ///   information.
3220    ///
3221    /// ## Thread safety
3222    /// This function should only be called on the main thread.
3223    ///
3224    /// ## Availability
3225    /// This function is available since SDL 3.2.0.
3226    ///
3227    /// ## See also
3228    /// - [`SDL_RenderRects`]
3229    pub fn SDL_RenderRect(
3230        renderer: *mut SDL_Renderer,
3231        rect: *const SDL_FRect,
3232    ) -> ::core::primitive::bool;
3233}
3234
3235unsafe extern "C" {
3236    /// Draw some number of rectangles on the current rendering target at subpixel
3237    /// precision.
3238    ///
3239    /// ## Parameters
3240    /// - `renderer`: the renderer which should draw multiple rectangles.
3241    /// - `rects`: a pointer to an array of destination rectangles.
3242    /// - `count`: the number of rectangles.
3243    ///
3244    /// ## Return value
3245    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3246    ///   information.
3247    ///
3248    /// ## Thread safety
3249    /// This function should only be called on the main thread.
3250    ///
3251    /// ## Availability
3252    /// This function is available since SDL 3.2.0.
3253    ///
3254    /// ## See also
3255    /// - [`SDL_RenderRect`]
3256    pub fn SDL_RenderRects(
3257        renderer: *mut SDL_Renderer,
3258        rects: *const SDL_FRect,
3259        count: ::core::ffi::c_int,
3260    ) -> ::core::primitive::bool;
3261}
3262
3263unsafe extern "C" {
3264    /// Fill a rectangle on the current rendering target with the drawing color at
3265    /// subpixel precision.
3266    ///
3267    /// ## Parameters
3268    /// - `renderer`: the renderer which should fill a rectangle.
3269    /// - `rect`: a pointer to the destination rectangle, or NULL for the entire
3270    ///   rendering target.
3271    ///
3272    /// ## Return value
3273    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3274    ///   information.
3275    ///
3276    /// ## Thread safety
3277    /// This function should only be called on the main thread.
3278    ///
3279    /// ## Availability
3280    /// This function is available since SDL 3.2.0.
3281    ///
3282    /// ## See also
3283    /// - [`SDL_RenderFillRects`]
3284    pub fn SDL_RenderFillRect(
3285        renderer: *mut SDL_Renderer,
3286        rect: *const SDL_FRect,
3287    ) -> ::core::primitive::bool;
3288}
3289
3290unsafe extern "C" {
3291    /// Fill some number of rectangles on the current rendering target with the
3292    /// drawing color at subpixel precision.
3293    ///
3294    /// ## Parameters
3295    /// - `renderer`: the renderer which should fill multiple rectangles.
3296    /// - `rects`: a pointer to an array of destination rectangles.
3297    /// - `count`: the number of rectangles.
3298    ///
3299    /// ## Return value
3300    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3301    ///   information.
3302    ///
3303    /// ## Thread safety
3304    /// This function should only be called on the main thread.
3305    ///
3306    /// ## Availability
3307    /// This function is available since SDL 3.2.0.
3308    ///
3309    /// ## See also
3310    /// - [`SDL_RenderFillRect`]
3311    pub fn SDL_RenderFillRects(
3312        renderer: *mut SDL_Renderer,
3313        rects: *const SDL_FRect,
3314        count: ::core::ffi::c_int,
3315    ) -> ::core::primitive::bool;
3316}
3317
3318unsafe extern "C" {
3319    /// Copy a portion of the texture to the current rendering target at subpixel
3320    /// precision.
3321    ///
3322    /// ## Parameters
3323    /// - `renderer`: the renderer which should copy parts of a texture.
3324    /// - `texture`: the source texture.
3325    /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire
3326    ///   texture.
3327    /// - `dstrect`: a pointer to the destination rectangle, or NULL for the
3328    ///   entire rendering target.
3329    ///
3330    /// ## Return value
3331    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3332    ///   information.
3333    ///
3334    /// ## Thread safety
3335    /// This function should only be called on the main thread.
3336    ///
3337    /// ## Availability
3338    /// This function is available since SDL 3.2.0.
3339    ///
3340    /// ## See also
3341    /// - [`SDL_RenderTextureRotated`]
3342    /// - [`SDL_RenderTextureTiled`]
3343    pub fn SDL_RenderTexture(
3344        renderer: *mut SDL_Renderer,
3345        texture: *mut SDL_Texture,
3346        srcrect: *const SDL_FRect,
3347        dstrect: *const SDL_FRect,
3348    ) -> ::core::primitive::bool;
3349}
3350
3351unsafe extern "C" {
3352    /// Copy a portion of the source texture to the current rendering target, with
3353    /// rotation and flipping, at subpixel precision.
3354    ///
3355    /// ## Parameters
3356    /// - `renderer`: the renderer which should copy parts of a texture.
3357    /// - `texture`: the source texture.
3358    /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire
3359    ///   texture.
3360    /// - `dstrect`: a pointer to the destination rectangle, or NULL for the
3361    ///   entire rendering target.
3362    /// - `angle`: an angle in degrees that indicates the rotation that will be
3363    ///   applied to dstrect, rotating it in a clockwise direction.
3364    /// - `center`: a pointer to a point indicating the point around which
3365    ///   dstrect will be rotated (if NULL, rotation will be done
3366    ///   around dstrect.w/2, dstrect.h/2).
3367    /// - `flip`: an [`SDL_FlipMode`] value stating which flipping actions should be
3368    ///   performed on the texture.
3369    ///
3370    /// ## Return value
3371    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3372    ///   information.
3373    ///
3374    /// ## Thread safety
3375    /// This function should only be called on the main thread.
3376    ///
3377    /// ## Availability
3378    /// This function is available since SDL 3.2.0.
3379    ///
3380    /// ## See also
3381    /// - [`SDL_RenderTexture`]
3382    pub fn SDL_RenderTextureRotated(
3383        renderer: *mut SDL_Renderer,
3384        texture: *mut SDL_Texture,
3385        srcrect: *const SDL_FRect,
3386        dstrect: *const SDL_FRect,
3387        angle: ::core::ffi::c_double,
3388        center: *const SDL_FPoint,
3389        flip: SDL_FlipMode,
3390    ) -> ::core::primitive::bool;
3391}
3392
3393unsafe extern "C" {
3394    /// Copy a portion of the source texture to the current rendering target, with
3395    /// affine transform, at subpixel precision.
3396    ///
3397    /// ## Parameters
3398    /// - `renderer`: the renderer which should copy parts of a texture.
3399    /// - `texture`: the source texture.
3400    /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire
3401    ///   texture.
3402    /// - `origin`: a pointer to a point indicating where the top-left corner of
3403    ///   srcrect should be mapped to, or NULL for the rendering
3404    ///   target's origin.
3405    /// - `right`: a pointer to a point indicating where the top-right corner of
3406    ///   srcrect should be mapped to, or NULL for the rendering
3407    ///   target's top-right corner.
3408    /// - `down`: a pointer to a point indicating where the bottom-left corner of
3409    ///   srcrect should be mapped to, or NULL for the rendering target's
3410    ///   bottom-left corner.
3411    ///
3412    /// ## Return value
3413    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3414    ///   information.
3415    ///
3416    /// ## Thread safety
3417    /// You may only call this function from the main thread.
3418    ///
3419    /// ## Availability
3420    /// This function is available since SDL 3.2.0.
3421    ///
3422    /// ## See also
3423    /// - [`SDL_RenderTexture`]
3424    pub fn SDL_RenderTextureAffine(
3425        renderer: *mut SDL_Renderer,
3426        texture: *mut SDL_Texture,
3427        srcrect: *const SDL_FRect,
3428        origin: *const SDL_FPoint,
3429        right: *const SDL_FPoint,
3430        down: *const SDL_FPoint,
3431    ) -> ::core::primitive::bool;
3432}
3433
3434unsafe extern "C" {
3435    /// Tile a portion of the texture to the current rendering target at subpixel
3436    /// precision.
3437    ///
3438    /// The pixels in `srcrect` will be repeated as many times as needed to
3439    /// completely fill `dstrect`.
3440    ///
3441    /// ## Parameters
3442    /// - `renderer`: the renderer which should copy parts of a texture.
3443    /// - `texture`: the source texture.
3444    /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire
3445    ///   texture.
3446    /// - `scale`: the scale used to transform srcrect into the destination
3447    ///   rectangle, e.g. a 32x32 texture with a scale of 2 would fill
3448    ///   64x64 tiles.
3449    /// - `dstrect`: a pointer to the destination rectangle, or NULL for the
3450    ///   entire rendering target.
3451    ///
3452    /// ## Return value
3453    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3454    ///   information.
3455    ///
3456    /// ## Thread safety
3457    /// This function should only be called on the main thread.
3458    ///
3459    /// ## Availability
3460    /// This function is available since SDL 3.2.0.
3461    ///
3462    /// ## See also
3463    /// - [`SDL_RenderTexture`]
3464    pub fn SDL_RenderTextureTiled(
3465        renderer: *mut SDL_Renderer,
3466        texture: *mut SDL_Texture,
3467        srcrect: *const SDL_FRect,
3468        scale: ::core::ffi::c_float,
3469        dstrect: *const SDL_FRect,
3470    ) -> ::core::primitive::bool;
3471}
3472
3473unsafe extern "C" {
3474    /// Perform a scaled copy using the 9-grid algorithm to the current rendering
3475    /// target at subpixel precision.
3476    ///
3477    /// The pixels in the texture are split into a 3x3 grid, using the different
3478    /// corner sizes for each corner, and the sides and center making up the
3479    /// remaining pixels. The corners are then scaled using `scale` and fit into
3480    /// the corners of the destination rectangle. The sides and center are then
3481    /// stretched into place to cover the remaining destination rectangle.
3482    ///
3483    /// ## Parameters
3484    /// - `renderer`: the renderer which should copy parts of a texture.
3485    /// - `texture`: the source texture.
3486    /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be used
3487    ///   for the 9-grid, or NULL to use the entire texture.
3488    /// - `left_width`: the width, in pixels, of the left corners in `srcrect`.
3489    /// - `right_width`: the width, in pixels, of the right corners in `srcrect`.
3490    /// - `top_height`: the height, in pixels, of the top corners in `srcrect`.
3491    /// - `bottom_height`: the height, in pixels, of the bottom corners in
3492    ///   `srcrect`.
3493    /// - `scale`: the scale used to transform the corner of `srcrect` into the
3494    ///   corner of `dstrect`, or 0.0f for an unscaled copy.
3495    /// - `dstrect`: a pointer to the destination rectangle, or NULL for the
3496    ///   entire rendering target.
3497    ///
3498    /// ## Return value
3499    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3500    ///   information.
3501    ///
3502    /// ## Thread safety
3503    /// This function should only be called on the main thread.
3504    ///
3505    /// ## Availability
3506    /// This function is available since SDL 3.2.0.
3507    ///
3508    /// ## See also
3509    /// - [`SDL_RenderTexture`]
3510    /// - [`SDL_RenderTexture9GridTiled`]
3511    pub fn SDL_RenderTexture9Grid(
3512        renderer: *mut SDL_Renderer,
3513        texture: *mut SDL_Texture,
3514        srcrect: *const SDL_FRect,
3515        left_width: ::core::ffi::c_float,
3516        right_width: ::core::ffi::c_float,
3517        top_height: ::core::ffi::c_float,
3518        bottom_height: ::core::ffi::c_float,
3519        scale: ::core::ffi::c_float,
3520        dstrect: *const SDL_FRect,
3521    ) -> ::core::primitive::bool;
3522}
3523
3524unsafe extern "C" {
3525    /// Perform a scaled copy using the 9-grid algorithm to the current rendering
3526    /// target at subpixel precision.
3527    ///
3528    /// The pixels in the texture are split into a 3x3 grid, using the different
3529    /// corner sizes for each corner, and the sides and center making up the
3530    /// remaining pixels. The corners are then scaled using `scale` and fit into
3531    /// the corners of the destination rectangle. The sides and center are then
3532    /// tiled into place to cover the remaining destination rectangle.
3533    ///
3534    /// ## Parameters
3535    /// - `renderer`: the renderer which should copy parts of a texture.
3536    /// - `texture`: the source texture.
3537    /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be used
3538    ///   for the 9-grid, or NULL to use the entire texture.
3539    /// - `left_width`: the width, in pixels, of the left corners in `srcrect`.
3540    /// - `right_width`: the width, in pixels, of the right corners in `srcrect`.
3541    /// - `top_height`: the height, in pixels, of the top corners in `srcrect`.
3542    /// - `bottom_height`: the height, in pixels, of the bottom corners in
3543    ///   `srcrect`.
3544    /// - `scale`: the scale used to transform the corner of `srcrect` into the
3545    ///   corner of `dstrect`, or 0.0f for an unscaled copy.
3546    /// - `dstrect`: a pointer to the destination rectangle, or NULL for the
3547    ///   entire rendering target.
3548    /// - `tileScale`: the scale used to transform the borders and center of
3549    ///   `srcrect` into the borders and middle of `dstrect`, or
3550    ///   1.0f for an unscaled copy.
3551    ///
3552    /// ## Return value
3553    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3554    ///   information.
3555    ///
3556    /// ## Thread safety
3557    /// This function should only be called on the main thread.
3558    ///
3559    /// ## Availability
3560    /// This function is available since SDL 3.4.0.
3561    ///
3562    /// ## See also
3563    /// - [`SDL_RenderTexture`]
3564    /// - [`SDL_RenderTexture9Grid`]
3565    pub fn SDL_RenderTexture9GridTiled(
3566        renderer: *mut SDL_Renderer,
3567        texture: *mut SDL_Texture,
3568        srcrect: *const SDL_FRect,
3569        left_width: ::core::ffi::c_float,
3570        right_width: ::core::ffi::c_float,
3571        top_height: ::core::ffi::c_float,
3572        bottom_height: ::core::ffi::c_float,
3573        scale: ::core::ffi::c_float,
3574        dstrect: *const SDL_FRect,
3575        tileScale: ::core::ffi::c_float,
3576    ) -> ::core::primitive::bool;
3577}
3578
3579unsafe extern "C" {
3580    /// Render a list of triangles, optionally using a texture and indices into the
3581    /// vertex array Color and alpha modulation is done per vertex
3582    /// ([`SDL_SetTextureColorMod`] and [`SDL_SetTextureAlphaMod`] are ignored).
3583    ///
3584    /// ## Parameters
3585    /// - `renderer`: the rendering context.
3586    /// - `texture`: (optional) The SDL texture to use.
3587    /// - `vertices`: vertices.
3588    /// - `num_vertices`: number of vertices.
3589    /// - `indices`: (optional) An array of integer indices into the 'vertices'
3590    ///   array, if NULL all vertices will be rendered in sequential
3591    ///   order.
3592    /// - `num_indices`: number of indices.
3593    ///
3594    /// ## Return value
3595    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3596    ///   information.
3597    ///
3598    /// ## Thread safety
3599    /// This function should only be called on the main thread.
3600    ///
3601    /// ## Availability
3602    /// This function is available since SDL 3.2.0.
3603    ///
3604    /// ## See also
3605    /// - [`SDL_RenderGeometryRaw`]
3606    /// - [`SDL_SetRenderTextureAddressMode`]
3607    pub fn SDL_RenderGeometry(
3608        renderer: *mut SDL_Renderer,
3609        texture: *mut SDL_Texture,
3610        vertices: *const SDL_Vertex,
3611        num_vertices: ::core::ffi::c_int,
3612        indices: *const ::core::ffi::c_int,
3613        num_indices: ::core::ffi::c_int,
3614    ) -> ::core::primitive::bool;
3615}
3616
3617unsafe extern "C" {
3618    /// Render a list of triangles, optionally using a texture and indices into the
3619    /// vertex arrays Color and alpha modulation is done per vertex
3620    /// ([`SDL_SetTextureColorMod`] and [`SDL_SetTextureAlphaMod`] are ignored).
3621    ///
3622    /// ## Parameters
3623    /// - `renderer`: the rendering context.
3624    /// - `texture`: (optional) The SDL texture to use.
3625    /// - `xy`: vertex positions.
3626    /// - `xy_stride`: byte size to move from one element to the next element.
3627    /// - `color`: vertex colors (as [`SDL_FColor`]).
3628    /// - `color_stride`: byte size to move from one element to the next element.
3629    /// - `uv`: vertex normalized texture coordinates.
3630    /// - `uv_stride`: byte size to move from one element to the next element.
3631    /// - `num_vertices`: number of vertices.
3632    /// - `indices`: (optional) An array of indices into the 'vertices' arrays,
3633    ///   if NULL all vertices will be rendered in sequential order.
3634    /// - `num_indices`: number of indices.
3635    /// - `size_indices`: index size: 1 (byte), 2 (short), 4 (int).
3636    ///
3637    /// ## Return value
3638    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3639    ///   information.
3640    ///
3641    /// ## Thread safety
3642    /// This function should only be called on the main thread.
3643    ///
3644    /// ## Availability
3645    /// This function is available since SDL 3.2.0.
3646    ///
3647    /// ## See also
3648    /// - [`SDL_RenderGeometry`]
3649    /// - [`SDL_SetRenderTextureAddressMode`]
3650    pub fn SDL_RenderGeometryRaw(
3651        renderer: *mut SDL_Renderer,
3652        texture: *mut SDL_Texture,
3653        xy: *const ::core::ffi::c_float,
3654        xy_stride: ::core::ffi::c_int,
3655        color: *const SDL_FColor,
3656        color_stride: ::core::ffi::c_int,
3657        uv: *const ::core::ffi::c_float,
3658        uv_stride: ::core::ffi::c_int,
3659        num_vertices: ::core::ffi::c_int,
3660        indices: *const ::core::ffi::c_void,
3661        num_indices: ::core::ffi::c_int,
3662        size_indices: ::core::ffi::c_int,
3663    ) -> ::core::primitive::bool;
3664}
3665
3666unsafe extern "C" {
3667    /// Set the texture addressing mode used in [`SDL_RenderGeometry()`].
3668    ///
3669    /// ## Parameters
3670    /// - `renderer`: the rendering context.
3671    /// - `u_mode`: the [`SDL_TextureAddressMode`] to use for horizontal texture
3672    ///   coordinates in [`SDL_RenderGeometry()`].
3673    /// - `v_mode`: the [`SDL_TextureAddressMode`] to use for vertical texture
3674    ///   coordinates in [`SDL_RenderGeometry()`].
3675    ///
3676    /// ## Return value
3677    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3678    ///   information.
3679    ///
3680    /// ## Thread safety
3681    /// This function should only be called on the main thread.
3682    ///
3683    /// ## Availability
3684    /// This function is available since SDL 3.4.0.
3685    ///
3686    /// ## See also
3687    /// - [`SDL_RenderGeometry`]
3688    /// - [`SDL_RenderGeometryRaw`]
3689    /// - [`SDL_GetRenderTextureAddressMode`]
3690    pub fn SDL_SetRenderTextureAddressMode(
3691        renderer: *mut SDL_Renderer,
3692        u_mode: SDL_TextureAddressMode,
3693        v_mode: SDL_TextureAddressMode,
3694    ) -> ::core::primitive::bool;
3695}
3696
3697unsafe extern "C" {
3698    /// Get the texture addressing mode used in [`SDL_RenderGeometry()`].
3699    ///
3700    /// ## Parameters
3701    /// - `renderer`: the rendering context.
3702    /// - `u_mode`: a pointer filled in with the [`SDL_TextureAddressMode`] to use
3703    ///   for horizontal texture coordinates in [`SDL_RenderGeometry()`],
3704    ///   may be NULL.
3705    /// - `v_mode`: a pointer filled in with the [`SDL_TextureAddressMode`] to use
3706    ///   for vertical texture coordinates in [`SDL_RenderGeometry()`], may
3707    ///   be NULL.
3708    ///
3709    /// ## Return value
3710    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3711    ///   information.
3712    ///
3713    /// ## Thread safety
3714    /// This function should only be called on the main thread.
3715    ///
3716    /// ## Availability
3717    /// This function is available since SDL 3.4.0.
3718    ///
3719    /// ## See also
3720    /// - [`SDL_SetRenderTextureAddressMode`]
3721    pub fn SDL_GetRenderTextureAddressMode(
3722        renderer: *mut SDL_Renderer,
3723        u_mode: *mut SDL_TextureAddressMode,
3724        v_mode: *mut SDL_TextureAddressMode,
3725    ) -> ::core::primitive::bool;
3726}
3727
3728unsafe extern "C" {
3729    /// Read pixels from the current rendering target.
3730    ///
3731    /// The returned surface contains pixels inside the desired area clipped to the
3732    /// current viewport, and should be freed with [`SDL_DestroySurface()`].
3733    ///
3734    /// Note that this returns the actual pixels on the screen, so if you are using
3735    /// logical presentation you should use [`SDL_GetRenderLogicalPresentationRect()`]
3736    /// to get the area containing your content.
3737    ///
3738    /// **WARNING**: This is a very slow operation, and should not be used
3739    /// frequently. If you're using this on the main rendering target, it should be
3740    /// called after rendering and before [`SDL_RenderPresent()`].
3741    ///
3742    /// ## Parameters
3743    /// - `renderer`: the rendering context.
3744    /// - `rect`: an [`SDL_Rect`] structure representing the area to read, which will
3745    ///   be clipped to the current viewport, or NULL for the entire
3746    ///   viewport.
3747    ///
3748    /// ## Return value
3749    /// Returns a new [`SDL_Surface`] on success or NULL on failure; call
3750    ///   [`SDL_GetError()`] for more information.
3751    ///
3752    /// ## Thread safety
3753    /// This function should only be called on the main thread.
3754    ///
3755    /// ## Availability
3756    /// This function is available since SDL 3.2.0.
3757    pub fn SDL_RenderReadPixels(
3758        renderer: *mut SDL_Renderer,
3759        rect: *const SDL_Rect,
3760    ) -> *mut SDL_Surface;
3761}
3762
3763unsafe extern "C" {
3764    /// Update the screen with any rendering performed since the previous call.
3765    ///
3766    /// SDL's rendering functions operate on a backbuffer; that is, calling a
3767    /// rendering function such as [`SDL_RenderLine()`] does not directly put a line on
3768    /// the screen, but rather updates the backbuffer. As such, you compose your
3769    /// entire scene and *present* the composed backbuffer to the screen as a
3770    /// complete picture.
3771    ///
3772    /// Therefore, when using SDL's rendering API, one does all drawing intended
3773    /// for the frame, and then calls this function once per frame to present the
3774    /// final drawing to the user.
3775    ///
3776    /// The backbuffer should be considered invalidated after each present; do not
3777    /// assume that previous contents will exist between frames. You are strongly
3778    /// encouraged to call [`SDL_RenderClear()`] to initialize the backbuffer before
3779    /// starting each new frame's drawing, even if you plan to overwrite every
3780    /// pixel.
3781    ///
3782    /// Please note, that in case of rendering to a texture - there is **no need**
3783    /// to call [`SDL_RenderPresent`] after drawing needed objects to a texture, and
3784    /// should not be done; you are only required to change back the rendering
3785    /// target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as
3786    /// textures by themselves do not have a concept of backbuffers. Calling
3787    /// [`SDL_RenderPresent`] while rendering to a texture will fail.
3788    ///
3789    /// ## Parameters
3790    /// - `renderer`: the rendering context.
3791    ///
3792    /// ## Return value
3793    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3794    ///   information.
3795    ///
3796    /// ## Thread safety
3797    /// This function should only be called on the main thread.
3798    ///
3799    /// ## Availability
3800    /// This function is available since SDL 3.2.0.
3801    ///
3802    /// ## See also
3803    /// - [`SDL_CreateRenderer`]
3804    /// - [`SDL_RenderClear`]
3805    /// - [`SDL_RenderFillRect`]
3806    /// - [`SDL_RenderFillRects`]
3807    /// - [`SDL_RenderLine`]
3808    /// - [`SDL_RenderLines`]
3809    /// - [`SDL_RenderPoint`]
3810    /// - [`SDL_RenderPoints`]
3811    /// - [`SDL_RenderRect`]
3812    /// - [`SDL_RenderRects`]
3813    /// - [`SDL_SetRenderDrawBlendMode`]
3814    /// - [`SDL_SetRenderDrawColor`]
3815    pub fn SDL_RenderPresent(renderer: *mut SDL_Renderer) -> ::core::primitive::bool;
3816}
3817
3818unsafe extern "C" {
3819    /// Destroy the specified texture.
3820    ///
3821    /// Passing NULL or an otherwise invalid texture will set the SDL error message
3822    /// to "Invalid texture".
3823    ///
3824    /// ## Parameters
3825    /// - `texture`: the texture to destroy.
3826    ///
3827    /// ## Thread safety
3828    /// This function should only be called on the main thread.
3829    ///
3830    /// ## Availability
3831    /// This function is available since SDL 3.2.0.
3832    ///
3833    /// ## See also
3834    /// - [`SDL_CreateTexture`]
3835    /// - [`SDL_CreateTextureFromSurface`]
3836    pub fn SDL_DestroyTexture(texture: *mut SDL_Texture);
3837}
3838
3839unsafe extern "C" {
3840    /// Destroy the rendering context for a window and free all associated
3841    /// textures.
3842    ///
3843    /// This should be called before destroying the associated window.
3844    ///
3845    /// ## Parameters
3846    /// - `renderer`: the rendering context.
3847    ///
3848    /// ## Thread safety
3849    /// This function should only be called on the main thread.
3850    ///
3851    /// ## Availability
3852    /// This function is available since SDL 3.2.0.
3853    ///
3854    /// ## See also
3855    /// - [`SDL_CreateRenderer`]
3856    pub fn SDL_DestroyRenderer(renderer: *mut SDL_Renderer);
3857}
3858
3859unsafe extern "C" {
3860    /// Force the rendering context to flush any pending commands and state.
3861    ///
3862    /// You do not need to (and in fact, shouldn't) call this function unless you
3863    /// are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
3864    /// addition to using an [`SDL_Renderer`].
3865    ///
3866    /// This is for a very-specific case: if you are using SDL's render API, and
3867    /// you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
3868    /// calls. If this applies, you should call this function between calls to
3869    /// SDL's render API and the low-level API you're using in cooperation.
3870    ///
3871    /// In all other cases, you can ignore this function.
3872    ///
3873    /// This call makes SDL flush any pending rendering work it was queueing up to
3874    /// do later in a single batch, and marks any internal cached state as invalid,
3875    /// so it'll prepare all its state again later, from scratch.
3876    ///
3877    /// This means you do not need to save state in your rendering code to protect
3878    /// the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
3879    /// OpenGL state that can confuse things; you should use your best judgment and
3880    /// be prepared to make changes if specific state needs to be protected.
3881    ///
3882    /// ## Parameters
3883    /// - `renderer`: the rendering context.
3884    ///
3885    /// ## Return value
3886    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3887    ///   information.
3888    ///
3889    /// ## Thread safety
3890    /// This function should only be called on the main thread.
3891    ///
3892    /// ## Availability
3893    /// This function is available since SDL 3.2.0.
3894    pub fn SDL_FlushRenderer(renderer: *mut SDL_Renderer) -> ::core::primitive::bool;
3895}
3896
3897unsafe extern "C" {
3898    /// Get the CAMetalLayer associated with the given Metal renderer.
3899    ///
3900    /// This function returns `void *`, so SDL doesn't have to include Metal's
3901    /// headers, but it can be safely cast to a `CAMetalLayer *`.
3902    ///
3903    /// ## Parameters
3904    /// - `renderer`: the renderer to query.
3905    ///
3906    /// ## Return value
3907    /// Returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
3908    ///   Metal renderer.
3909    ///
3910    /// ## Thread safety
3911    /// This function should only be called on the main thread.
3912    ///
3913    /// ## Availability
3914    /// This function is available since SDL 3.2.0.
3915    ///
3916    /// ## See also
3917    /// - [`SDL_GetRenderMetalCommandEncoder`]
3918    pub fn SDL_GetRenderMetalLayer(renderer: *mut SDL_Renderer) -> *mut ::core::ffi::c_void;
3919}
3920
3921unsafe extern "C" {
3922    /// Get the Metal command encoder for the current frame.
3923    ///
3924    /// This function returns `void *`, so SDL doesn't have to include Metal's
3925    /// headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
3926    ///
3927    /// This will return NULL if Metal refuses to give SDL a drawable to render to,
3928    /// which might happen if the window is hidden/minimized/offscreen. This
3929    /// doesn't apply to command encoders for render targets, just the window's
3930    /// backbuffer. Check your return values!
3931    ///
3932    /// ## Parameters
3933    /// - `renderer`: the renderer to query.
3934    ///
3935    /// ## Return value
3936    /// Returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
3937    ///   renderer isn't a Metal renderer or there was an error.
3938    ///
3939    /// ## Thread safety
3940    /// This function should only be called on the main thread.
3941    ///
3942    /// ## Availability
3943    /// This function is available since SDL 3.2.0.
3944    ///
3945    /// ## See also
3946    /// - [`SDL_GetRenderMetalLayer`]
3947    pub fn SDL_GetRenderMetalCommandEncoder(
3948        renderer: *mut SDL_Renderer,
3949    ) -> *mut ::core::ffi::c_void;
3950}
3951
3952unsafe extern "C" {
3953    /// Add a set of synchronization semaphores for the current frame.
3954    ///
3955    /// The Vulkan renderer will wait for `wait_semaphore` before submitting
3956    /// rendering commands and signal `signal_semaphore` after rendering commands
3957    /// are complete for this frame.
3958    ///
3959    /// This should be called each frame that you want semaphore synchronization.
3960    /// The Vulkan renderer may have multiple frames in flight on the GPU, so you
3961    /// should have multiple semaphores that are used for synchronization. Querying
3962    /// [`SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`] will give you the
3963    /// maximum number of semaphores you'll need.
3964    ///
3965    /// ## Parameters
3966    /// - `renderer`: the rendering context.
3967    /// - `wait_stage_mask`: the VkPipelineStageFlags for the wait.
3968    /// - `wait_semaphore`: a VkSempahore to wait on before rendering the current
3969    ///   frame, or 0 if not needed.
3970    /// - `signal_semaphore`: a VkSempahore that SDL will signal when rendering
3971    ///   for the current frame is complete, or 0 if not
3972    ///   needed.
3973    ///
3974    /// ## Return value
3975    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3976    ///   information.
3977    ///
3978    /// ## Thread safety
3979    /// It is **NOT** safe to call this function from two threads at
3980    ///   once.
3981    ///
3982    /// ## Availability
3983    /// This function is available since SDL 3.2.0.
3984    pub fn SDL_AddVulkanRenderSemaphores(
3985        renderer: *mut SDL_Renderer,
3986        wait_stage_mask: Uint32,
3987        wait_semaphore: Sint64,
3988        signal_semaphore: Sint64,
3989    ) -> ::core::primitive::bool;
3990}
3991
3992unsafe extern "C" {
3993    /// Toggle VSync of the given renderer.
3994    ///
3995    /// When a renderer is created, vsync defaults to [`SDL_RENDERER_VSYNC_DISABLED`].
3996    ///
3997    /// The `vsync` parameter can be 1 to synchronize present with every vertical
3998    /// refresh, 2 to synchronize present with every second vertical refresh, etc.,
3999    /// [`SDL_RENDERER_VSYNC_ADAPTIVE`] for late swap tearing (adaptive vsync), or
4000    /// [`SDL_RENDERER_VSYNC_DISABLED`] to disable. Not every value is supported by
4001    /// every driver, so you should check the return value to see whether the
4002    /// requested setting is supported.
4003    ///
4004    /// ## Parameters
4005    /// - `renderer`: the renderer to toggle.
4006    /// - `vsync`: the vertical refresh sync interval.
4007    ///
4008    /// ## Return value
4009    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4010    ///   information.
4011    ///
4012    /// ## Thread safety
4013    /// This function should only be called on the main thread.
4014    ///
4015    /// ## Availability
4016    /// This function is available since SDL 3.2.0.
4017    ///
4018    /// ## See also
4019    /// - [`SDL_GetRenderVSync`]
4020    pub fn SDL_SetRenderVSync(
4021        renderer: *mut SDL_Renderer,
4022        vsync: ::core::ffi::c_int,
4023    ) -> ::core::primitive::bool;
4024}
4025
4026pub const SDL_RENDERER_VSYNC_DISABLED: ::core::ffi::c_int = (0 as ::core::ffi::c_int);
4027
4028pub const SDL_RENDERER_VSYNC_ADAPTIVE: ::core::ffi::c_int = (-1_i32 as ::core::ffi::c_int);
4029
4030unsafe extern "C" {
4031    /// Get VSync of the given renderer.
4032    ///
4033    /// ## Parameters
4034    /// - `renderer`: the renderer to toggle.
4035    /// - `vsync`: an int filled with the current vertical refresh sync interval.
4036    ///   See [`SDL_SetRenderVSync()`] for the meaning of the value.
4037    ///
4038    /// ## Return value
4039    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4040    ///   information.
4041    ///
4042    /// ## Thread safety
4043    /// This function should only be called on the main thread.
4044    ///
4045    /// ## Availability
4046    /// This function is available since SDL 3.2.0.
4047    ///
4048    /// ## See also
4049    /// - [`SDL_SetRenderVSync`]
4050    pub fn SDL_GetRenderVSync(
4051        renderer: *mut SDL_Renderer,
4052        vsync: *mut ::core::ffi::c_int,
4053    ) -> ::core::primitive::bool;
4054}
4055
4056/// The size, in pixels, of a single [`SDL_RenderDebugText()`] character.
4057///
4058/// The font is monospaced and square, so this applies to all characters.
4059///
4060/// ## Availability
4061/// This macro is available since SDL 3.2.0.
4062///
4063/// ## See also
4064/// - [`SDL_RenderDebugText`]
4065pub const SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE: ::core::primitive::i32 = 8;
4066
4067unsafe extern "C" {
4068    /// Draw debug text to an [`SDL_Renderer`].
4069    ///
4070    /// This function will render a string of text to an [`SDL_Renderer`]. Note that
4071    /// this is a convenience function for debugging, with severe limitations, and
4072    /// not intended to be used for production apps and games.
4073    ///
4074    /// Among these limitations:
4075    ///
4076    /// - It accepts UTF-8 strings, but will only renders ASCII characters.
4077    /// - It has a single, tiny size (8x8 pixels). You can use logical presentation
4078    ///   or [`SDL_SetRenderScale()`] to adjust it.
4079    /// - It uses a simple, hardcoded bitmap font. It does not allow different font
4080    ///   selections and it does not support truetype, for proper scaling.
4081    /// - It does no word-wrapping and does not treat newline characters as a line
4082    ///   break. If the text goes out of the window, it's gone.
4083    ///
4084    /// For serious text rendering, there are several good options, such as
4085    /// SDL_ttf, stb_truetype, or other external libraries.
4086    ///
4087    /// On first use, this will create an internal texture for rendering glyphs.
4088    /// This texture will live until the renderer is destroyed.
4089    ///
4090    /// The text is drawn in the color specified by [`SDL_SetRenderDrawColor()`].
4091    ///
4092    /// ## Parameters
4093    /// - `renderer`: the renderer which should draw a line of text.
4094    /// - `x`: the x coordinate where the top-left corner of the text will draw.
4095    /// - `y`: the y coordinate where the top-left corner of the text will draw.
4096    /// - `str`: the string to render.
4097    ///
4098    /// ## Return value
4099    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4100    ///   information.
4101    ///
4102    /// ## Thread safety
4103    /// This function should only be called on the main thread.
4104    ///
4105    /// ## Availability
4106    /// This function is available since SDL 3.2.0.
4107    ///
4108    /// ## See also
4109    /// - [`SDL_RenderDebugTextFormat`]
4110    /// - [`SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE`]
4111    pub fn SDL_RenderDebugText(
4112        renderer: *mut SDL_Renderer,
4113        x: ::core::ffi::c_float,
4114        y: ::core::ffi::c_float,
4115        str: *const ::core::ffi::c_char,
4116    ) -> ::core::primitive::bool;
4117}
4118
4119unsafe extern "C" {
4120    /// Draw debug text to an [`SDL_Renderer`].
4121    ///
4122    /// This function will render a printf()-style format string to a renderer.
4123    /// Note that this is a convenience function for debugging, with severe
4124    /// limitations, and is not intended to be used for production apps and games.
4125    ///
4126    /// For the full list of limitations and other useful information, see
4127    /// [`SDL_RenderDebugText`].
4128    ///
4129    /// ## Parameters
4130    /// - `renderer`: the renderer which should draw the text.
4131    /// - `x`: the x coordinate where the top-left corner of the text will draw.
4132    /// - `y`: the y coordinate where the top-left corner of the text will draw.
4133    /// - `fmt`: the format string to draw.
4134    /// - `...`: additional parameters matching % tokens in the `fmt` string, if
4135    ///   any.
4136    ///
4137    /// ## Return value
4138    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4139    ///   information.
4140    ///
4141    /// ## Thread safety
4142    /// This function should only be called on the main thread.
4143    ///
4144    /// ## Availability
4145    /// This function is available since SDL 3.2.0.
4146    ///
4147    /// ## See also
4148    /// - [`SDL_RenderDebugText`]
4149    /// - [`SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE`]
4150    pub fn SDL_RenderDebugTextFormat(
4151        renderer: *mut SDL_Renderer,
4152        x: ::core::ffi::c_float,
4153        y: ::core::ffi::c_float,
4154        fmt: *const ::core::ffi::c_char,
4155        ...
4156    ) -> ::core::primitive::bool;
4157}
4158
4159unsafe extern "C" {
4160    /// Set default scale mode for new textures for given renderer.
4161    ///
4162    /// When a renderer is created, scale_mode defaults to [`SDL_SCALEMODE_LINEAR`].
4163    ///
4164    /// ## Parameters
4165    /// - `renderer`: the renderer to update.
4166    /// - `scale_mode`: the scale mode to change to for new textures.
4167    ///
4168    /// ## Return value
4169    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4170    ///   information.
4171    ///
4172    /// ## Thread safety
4173    /// This function should only be called on the main thread.
4174    ///
4175    /// ## Availability
4176    /// This function is available since SDL 3.4.0.
4177    ///
4178    /// ## See also
4179    /// - [`SDL_GetDefaultTextureScaleMode`]
4180    pub fn SDL_SetDefaultTextureScaleMode(
4181        renderer: *mut SDL_Renderer,
4182        scale_mode: SDL_ScaleMode,
4183    ) -> ::core::primitive::bool;
4184}
4185
4186unsafe extern "C" {
4187    /// Get default texture scale mode of the given renderer.
4188    ///
4189    /// ## Parameters
4190    /// - `renderer`: the renderer to get data from.
4191    /// - `scale_mode`: a [`SDL_ScaleMode`] filled with current default scale mode.
4192    ///   See [`SDL_SetDefaultTextureScaleMode()`] for the meaning of
4193    ///   the value.
4194    ///
4195    /// ## Return value
4196    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4197    ///   information.
4198    ///
4199    /// ## Thread safety
4200    /// This function should only be called on the main thread.
4201    ///
4202    /// ## Availability
4203    /// This function is available since SDL 3.4.0.
4204    ///
4205    /// ## See also
4206    /// - [`SDL_SetDefaultTextureScaleMode`]
4207    pub fn SDL_GetDefaultTextureScaleMode(
4208        renderer: *mut SDL_Renderer,
4209        scale_mode: *mut SDL_ScaleMode,
4210    ) -> ::core::primitive::bool;
4211}
4212
4213/// A structure specifying the parameters of a GPU render state.
4214///
4215/// ## Availability
4216/// This struct is available since SDL 3.4.0.
4217///
4218/// ## See also
4219/// - [`SDL_CreateGPURenderState`]
4220#[repr(C)]
4221#[cfg_attr(feature = "debug-impls", derive(Debug))]
4222pub struct SDL_GPURenderStateCreateInfo {
4223    /// The fragment shader to use when this render state is active
4224    pub fragment_shader: *mut SDL_GPUShader,
4225    /// The number of additional fragment samplers to bind when this render state is active
4226    pub num_sampler_bindings: Sint32,
4227    /// Additional fragment samplers to bind when this render state is active
4228    pub sampler_bindings: *const SDL_GPUTextureSamplerBinding,
4229    /// The number of storage textures to bind when this render state is active
4230    pub num_storage_textures: Sint32,
4231    /// Storage textures to bind when this render state is active
4232    pub storage_textures: *const *mut SDL_GPUTexture,
4233    /// The number of storage buffers to bind when this render state is active
4234    pub num_storage_buffers: Sint32,
4235    /// Storage buffers to bind when this render state is active
4236    pub storage_buffers: *const *mut SDL_GPUBuffer,
4237    /// A properties ID for extensions. Should be 0 if no extensions are needed.
4238    pub props: SDL_PropertiesID,
4239}
4240
4241impl ::core::default::Default for SDL_GPURenderStateCreateInfo {
4242    /// Initialize all fields to zero
4243    #[inline(always)]
4244    fn default() -> Self {
4245        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4246    }
4247}
4248
4249unsafe extern "C" {
4250    /// Create custom GPU render state.
4251    ///
4252    /// ## Parameters
4253    /// - `renderer`: the renderer to use.
4254    /// - `createinfo`: a struct describing the GPU render state to create.
4255    ///
4256    /// ## Return value
4257    /// Returns a custom GPU render state or NULL on failure; call [`SDL_GetError()`]
4258    ///   for more information.
4259    ///
4260    /// ## Thread safety
4261    /// This function should be called on the thread that created the
4262    ///   renderer.
4263    ///
4264    /// ## Availability
4265    /// This function is available since SDL 3.4.0.
4266    ///
4267    /// ## See also
4268    /// - [`SDL_SetGPURenderStateFragmentUniforms`]
4269    /// - [`SDL_SetGPURenderState`]
4270    /// - [`SDL_DestroyGPURenderState`]
4271    pub fn SDL_CreateGPURenderState(
4272        renderer: *mut SDL_Renderer,
4273        createinfo: *const SDL_GPURenderStateCreateInfo,
4274    ) -> *mut SDL_GPURenderState;
4275}
4276
4277unsafe extern "C" {
4278    /// Set fragment shader uniform variables in a custom GPU render state.
4279    ///
4280    /// The data is copied and will be pushed using
4281    /// [`SDL_PushGPUFragmentUniformData()`] during draw call execution.
4282    ///
4283    /// ## Parameters
4284    /// - `state`: the state to modify.
4285    /// - `slot_index`: the fragment uniform slot to push data to.
4286    /// - `data`: client data to write.
4287    /// - `length`: the length of the data to write.
4288    ///
4289    /// ## Return value
4290    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4291    ///   information.
4292    ///
4293    /// ## Thread safety
4294    /// This function should be called on the thread that created the
4295    ///   renderer.
4296    ///
4297    /// ## Availability
4298    /// This function is available since SDL 3.4.0.
4299    pub fn SDL_SetGPURenderStateFragmentUniforms(
4300        state: *mut SDL_GPURenderState,
4301        slot_index: Uint32,
4302        data: *const ::core::ffi::c_void,
4303        length: Uint32,
4304    ) -> ::core::primitive::bool;
4305}
4306
4307unsafe extern "C" {
4308    /// Set custom GPU render state.
4309    ///
4310    /// This function sets custom GPU render state for subsequent draw calls. This
4311    /// allows using custom shaders with the GPU renderer.
4312    ///
4313    /// ## Parameters
4314    /// - `renderer`: the renderer to use.
4315    /// - `state`: the state to to use, or NULL to clear custom GPU render state.
4316    ///
4317    /// ## Return value
4318    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4319    ///   information.
4320    ///
4321    /// ## Thread safety
4322    /// This function should be called on the thread that created the
4323    ///   renderer.
4324    ///
4325    /// ## Availability
4326    /// This function is available since SDL 3.4.0.
4327    pub fn SDL_SetGPURenderState(
4328        renderer: *mut SDL_Renderer,
4329        state: *mut SDL_GPURenderState,
4330    ) -> ::core::primitive::bool;
4331}
4332
4333unsafe extern "C" {
4334    /// Destroy custom GPU render state.
4335    ///
4336    /// ## Parameters
4337    /// - `state`: the state to destroy.
4338    ///
4339    /// ## Thread safety
4340    /// This function should be called on the thread that created the
4341    ///   renderer.
4342    ///
4343    /// ## Availability
4344    /// This function is available since SDL 3.4.0.
4345    ///
4346    /// ## See also
4347    /// - [`SDL_CreateGPURenderState`]
4348    pub fn SDL_DestroyGPURenderState(state: *mut SDL_GPURenderState);
4349}
4350
4351/// A custom GPU render state.
4352///
4353/// ## Availability
4354/// This struct is available since SDL 3.4.0.
4355///
4356/// ## See also
4357/// - [`SDL_CreateGPURenderState`]
4358/// - [`SDL_SetGPURenderStateFragmentUniforms`]
4359/// - [`SDL_SetGPURenderState`]
4360/// - [`SDL_DestroyGPURenderState`]
4361#[repr(C)]
4362pub struct SDL_GPURenderState {
4363    _opaque: [::core::primitive::u8; 0],
4364}
4365
4366/// A structure representing rendering state
4367///
4368/// ## Availability
4369/// This struct is available since SDL 3.2.0.
4370#[repr(C)]
4371pub struct SDL_Renderer {
4372    _opaque: [::core::primitive::u8; 0],
4373}
4374
4375#[cfg(doc)]
4376use crate::everything::*;