sdl3_sys/generated/
pixels.rs

1//! SDL offers facilities for pixel management.
2//!
3//! Largely these facilities deal with pixel _format_: what does this set of
4//! bits represent?
5//!
6//! If you mostly want to think of a pixel as some combination of red, green,
7//! blue, and maybe alpha intensities, this is all pretty straightforward, and
8//! in many cases, is enough information to build a perfectly fine game.
9//!
10//! However, the actual definition of a pixel is more complex than that:
11//!
12//! Pixels are a representation of a color in a particular color space.
13//!
14//! The first characteristic of a color space is the color type. SDL
15//! understands two different color types, RGB and YCbCr, or in SDL also
16//! referred to as YUV.
17//!
18//! RGB colors consist of red, green, and blue channels of color that are added
19//! together to represent the colors we see on the screen.
20//!
21//! <https://en.wikipedia.org/wiki/RGB_color_model>
22//!
23//! YCbCr colors represent colors as a Y luma brightness component and red and
24//! blue chroma color offsets. This color representation takes advantage of the
25//! fact that the human eye is more sensitive to brightness than the color in
26//! an image. The Cb and Cr components are often compressed and have lower
27//! resolution than the luma component.
28//!
29//! <https://en.wikipedia.org/wiki/YCbCr>
30//!
31//! When the color information in YCbCr is compressed, the Y pixels are left at
32//! full resolution and each Cr and Cb pixel represents an average of the color
33//! information in a block of Y pixels. The chroma location determines where in
34//! that block of pixels the color information is coming from.
35//!
36//! The color range defines how much of the pixel to use when converting a
37//! pixel into a color on the display. When the full color range is used, the
38//! entire numeric range of the pixel bits is significant. When narrow color
39//! range is used, for historical reasons, the pixel uses only a portion of the
40//! numeric range to represent colors.
41//!
42//! The color primaries and white point are a definition of the colors in the
43//! color space relative to the standard XYZ color space.
44//!
45//! <https://en.wikipedia.org/wiki/CIE_1931_color_space>
46//!
47//! The transfer characteristic, or opto-electrical transfer function (OETF),
48//! is the way a color is converted from mathematically linear space into a
49//! non-linear output signals.
50//!
51//! <https://en.wikipedia.org/wiki/Rec._709#Transfer_characteristics>
52//!
53//! The matrix coefficients are used to convert between YCbCr and RGB colors.
54
55use super::stdinc::*;
56
57use super::error::*;
58
59/// A fully opaque 8-bit alpha value.
60///
61/// ## Availability
62/// This macro is available since SDL 3.2.0.
63///
64/// ## See also
65/// - [`SDL_ALPHA_TRANSPARENT`]
66pub const SDL_ALPHA_OPAQUE: Uint8 = (255 as Uint8);
67
68/// A fully opaque floating point alpha value.
69///
70/// ## Availability
71/// This macro is available since SDL 3.2.0.
72///
73/// ## See also
74/// - [`SDL_ALPHA_TRANSPARENT_FLOAT`]
75pub const SDL_ALPHA_OPAQUE_FLOAT: ::core::ffi::c_float = 1.0_f32;
76
77/// A fully transparent 8-bit alpha value.
78///
79/// ## Availability
80/// This macro is available since SDL 3.2.0.
81///
82/// ## See also
83/// - [`SDL_ALPHA_OPAQUE`]
84pub const SDL_ALPHA_TRANSPARENT: Uint8 = (0 as Uint8);
85
86/// A fully transparent floating point alpha value.
87///
88/// ## Availability
89/// This macro is available since SDL 3.2.0.
90///
91/// ## See also
92/// - [`SDL_ALPHA_OPAQUE_FLOAT`]
93pub const SDL_ALPHA_TRANSPARENT_FLOAT: ::core::ffi::c_float = 0.0_f32;
94
95/// Pixel type.
96///
97/// ## Availability
98/// This enum is available since SDL 3.2.0.
99///
100/// ## Known values (`sdl3-sys`)
101/// | Associated constant | Global constant | Description |
102/// | ------------------- | --------------- | ----------- |
103/// | [`UNKNOWN`](SDL_PixelType::UNKNOWN) | [`SDL_PIXELTYPE_UNKNOWN`] | |
104/// | [`INDEX1`](SDL_PixelType::INDEX1) | [`SDL_PIXELTYPE_INDEX1`] | |
105/// | [`INDEX4`](SDL_PixelType::INDEX4) | [`SDL_PIXELTYPE_INDEX4`] | |
106/// | [`INDEX8`](SDL_PixelType::INDEX8) | [`SDL_PIXELTYPE_INDEX8`] | |
107/// | [`PACKED8`](SDL_PixelType::PACKED8) | [`SDL_PIXELTYPE_PACKED8`] | |
108/// | [`PACKED16`](SDL_PixelType::PACKED16) | [`SDL_PIXELTYPE_PACKED16`] | |
109/// | [`PACKED32`](SDL_PixelType::PACKED32) | [`SDL_PIXELTYPE_PACKED32`] | |
110/// | [`ARRAYU8`](SDL_PixelType::ARRAYU8) | [`SDL_PIXELTYPE_ARRAYU8`] | |
111/// | [`ARRAYU16`](SDL_PixelType::ARRAYU16) | [`SDL_PIXELTYPE_ARRAYU16`] | |
112/// | [`ARRAYU32`](SDL_PixelType::ARRAYU32) | [`SDL_PIXELTYPE_ARRAYU32`] | |
113/// | [`ARRAYF16`](SDL_PixelType::ARRAYF16) | [`SDL_PIXELTYPE_ARRAYF16`] | |
114/// | [`ARRAYF32`](SDL_PixelType::ARRAYF32) | [`SDL_PIXELTYPE_ARRAYF32`] | |
115/// | [`INDEX2`](SDL_PixelType::INDEX2) | [`SDL_PIXELTYPE_INDEX2`] | |
116#[repr(transparent)]
117#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
118pub struct SDL_PixelType(pub ::core::ffi::c_int);
119
120impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PixelType {
121    #[inline(always)]
122    fn eq(&self, other: &::core::ffi::c_int) -> bool {
123        &self.0 == other
124    }
125}
126
127impl ::core::cmp::PartialEq<SDL_PixelType> for ::core::ffi::c_int {
128    #[inline(always)]
129    fn eq(&self, other: &SDL_PixelType) -> bool {
130        self == &other.0
131    }
132}
133
134impl From<SDL_PixelType> for ::core::ffi::c_int {
135    #[inline(always)]
136    fn from(value: SDL_PixelType) -> Self {
137        value.0
138    }
139}
140
141#[cfg(feature = "debug-impls")]
142impl ::core::fmt::Debug for SDL_PixelType {
143    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
144        #[allow(unreachable_patterns)]
145        f.write_str(match *self {
146            Self::UNKNOWN => "SDL_PIXELTYPE_UNKNOWN",
147            Self::INDEX1 => "SDL_PIXELTYPE_INDEX1",
148            Self::INDEX4 => "SDL_PIXELTYPE_INDEX4",
149            Self::INDEX8 => "SDL_PIXELTYPE_INDEX8",
150            Self::PACKED8 => "SDL_PIXELTYPE_PACKED8",
151            Self::PACKED16 => "SDL_PIXELTYPE_PACKED16",
152            Self::PACKED32 => "SDL_PIXELTYPE_PACKED32",
153            Self::ARRAYU8 => "SDL_PIXELTYPE_ARRAYU8",
154            Self::ARRAYU16 => "SDL_PIXELTYPE_ARRAYU16",
155            Self::ARRAYU32 => "SDL_PIXELTYPE_ARRAYU32",
156            Self::ARRAYF16 => "SDL_PIXELTYPE_ARRAYF16",
157            Self::ARRAYF32 => "SDL_PIXELTYPE_ARRAYF32",
158            Self::INDEX2 => "SDL_PIXELTYPE_INDEX2",
159
160            _ => return write!(f, "SDL_PixelType({})", self.0),
161        })
162    }
163}
164
165impl SDL_PixelType {
166    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
167    pub const INDEX1: Self = Self((1 as ::core::ffi::c_int));
168    pub const INDEX4: Self = Self((2 as ::core::ffi::c_int));
169    pub const INDEX8: Self = Self((3 as ::core::ffi::c_int));
170    pub const PACKED8: Self = Self((4 as ::core::ffi::c_int));
171    pub const PACKED16: Self = Self((5 as ::core::ffi::c_int));
172    pub const PACKED32: Self = Self((6 as ::core::ffi::c_int));
173    pub const ARRAYU8: Self = Self((7 as ::core::ffi::c_int));
174    pub const ARRAYU16: Self = Self((8 as ::core::ffi::c_int));
175    pub const ARRAYU32: Self = Self((9 as ::core::ffi::c_int));
176    pub const ARRAYF16: Self = Self((10 as ::core::ffi::c_int));
177    pub const ARRAYF32: Self = Self((11 as ::core::ffi::c_int));
178    pub const INDEX2: Self = Self((12 as ::core::ffi::c_int));
179}
180
181pub const SDL_PIXELTYPE_UNKNOWN: SDL_PixelType = SDL_PixelType::UNKNOWN;
182pub const SDL_PIXELTYPE_INDEX1: SDL_PixelType = SDL_PixelType::INDEX1;
183pub const SDL_PIXELTYPE_INDEX4: SDL_PixelType = SDL_PixelType::INDEX4;
184pub const SDL_PIXELTYPE_INDEX8: SDL_PixelType = SDL_PixelType::INDEX8;
185pub const SDL_PIXELTYPE_PACKED8: SDL_PixelType = SDL_PixelType::PACKED8;
186pub const SDL_PIXELTYPE_PACKED16: SDL_PixelType = SDL_PixelType::PACKED16;
187pub const SDL_PIXELTYPE_PACKED32: SDL_PixelType = SDL_PixelType::PACKED32;
188pub const SDL_PIXELTYPE_ARRAYU8: SDL_PixelType = SDL_PixelType::ARRAYU8;
189pub const SDL_PIXELTYPE_ARRAYU16: SDL_PixelType = SDL_PixelType::ARRAYU16;
190pub const SDL_PIXELTYPE_ARRAYU32: SDL_PixelType = SDL_PixelType::ARRAYU32;
191pub const SDL_PIXELTYPE_ARRAYF16: SDL_PixelType = SDL_PixelType::ARRAYF16;
192pub const SDL_PIXELTYPE_ARRAYF32: SDL_PixelType = SDL_PixelType::ARRAYF32;
193pub const SDL_PIXELTYPE_INDEX2: SDL_PixelType = SDL_PixelType::INDEX2;
194
195#[cfg(feature = "metadata")]
196impl sdl3_sys::metadata::GroupMetadata for SDL_PixelType {
197    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
198        &crate::metadata::pixels::METADATA_SDL_PixelType;
199}
200
201/// Bitmap pixel order, high bit -> low bit.
202///
203/// ## Availability
204/// This enum is available since SDL 3.2.0.
205///
206/// ## Known values (`sdl3-sys`)
207/// | Associated constant | Global constant | Description |
208/// | ------------------- | --------------- | ----------- |
209/// | [`NONE`](SDL_BitmapOrder::NONE) | [`SDL_BITMAPORDER_NONE`] | |
210/// | [`_4321`](SDL_BitmapOrder::_4321) | [`SDL_BITMAPORDER_4321`] | |
211/// | [`_1234`](SDL_BitmapOrder::_1234) | [`SDL_BITMAPORDER_1234`] | |
212#[repr(transparent)]
213#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
214pub struct SDL_BitmapOrder(pub ::core::ffi::c_int);
215
216impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_BitmapOrder {
217    #[inline(always)]
218    fn eq(&self, other: &::core::ffi::c_int) -> bool {
219        &self.0 == other
220    }
221}
222
223impl ::core::cmp::PartialEq<SDL_BitmapOrder> for ::core::ffi::c_int {
224    #[inline(always)]
225    fn eq(&self, other: &SDL_BitmapOrder) -> bool {
226        self == &other.0
227    }
228}
229
230impl From<SDL_BitmapOrder> for ::core::ffi::c_int {
231    #[inline(always)]
232    fn from(value: SDL_BitmapOrder) -> Self {
233        value.0
234    }
235}
236
237#[cfg(feature = "debug-impls")]
238impl ::core::fmt::Debug for SDL_BitmapOrder {
239    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
240        #[allow(unreachable_patterns)]
241        f.write_str(match *self {
242            Self::NONE => "SDL_BITMAPORDER_NONE",
243            Self::_4321 => "SDL_BITMAPORDER_4321",
244            Self::_1234 => "SDL_BITMAPORDER_1234",
245
246            _ => return write!(f, "SDL_BitmapOrder({})", self.0),
247        })
248    }
249}
250
251impl SDL_BitmapOrder {
252    pub const NONE: Self = Self((0 as ::core::ffi::c_int));
253    pub const _4321: Self = Self((1 as ::core::ffi::c_int));
254    pub const _1234: Self = Self((2 as ::core::ffi::c_int));
255}
256
257pub const SDL_BITMAPORDER_NONE: SDL_BitmapOrder = SDL_BitmapOrder::NONE;
258pub const SDL_BITMAPORDER_4321: SDL_BitmapOrder = SDL_BitmapOrder::_4321;
259pub const SDL_BITMAPORDER_1234: SDL_BitmapOrder = SDL_BitmapOrder::_1234;
260
261#[cfg(feature = "metadata")]
262impl sdl3_sys::metadata::GroupMetadata for SDL_BitmapOrder {
263    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
264        &crate::metadata::pixels::METADATA_SDL_BitmapOrder;
265}
266
267/// Packed component order, high bit -> low bit.
268///
269/// ## Availability
270/// This enum is available since SDL 3.2.0.
271///
272/// ## Known values (`sdl3-sys`)
273/// | Associated constant | Global constant | Description |
274/// | ------------------- | --------------- | ----------- |
275/// | [`NONE`](SDL_PackedOrder::NONE) | [`SDL_PACKEDORDER_NONE`] | |
276/// | [`XRGB`](SDL_PackedOrder::XRGB) | [`SDL_PACKEDORDER_XRGB`] | |
277/// | [`RGBX`](SDL_PackedOrder::RGBX) | [`SDL_PACKEDORDER_RGBX`] | |
278/// | [`ARGB`](SDL_PackedOrder::ARGB) | [`SDL_PACKEDORDER_ARGB`] | |
279/// | [`RGBA`](SDL_PackedOrder::RGBA) | [`SDL_PACKEDORDER_RGBA`] | |
280/// | [`XBGR`](SDL_PackedOrder::XBGR) | [`SDL_PACKEDORDER_XBGR`] | |
281/// | [`BGRX`](SDL_PackedOrder::BGRX) | [`SDL_PACKEDORDER_BGRX`] | |
282/// | [`ABGR`](SDL_PackedOrder::ABGR) | [`SDL_PACKEDORDER_ABGR`] | |
283/// | [`BGRA`](SDL_PackedOrder::BGRA) | [`SDL_PACKEDORDER_BGRA`] | |
284#[repr(transparent)]
285#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
286pub struct SDL_PackedOrder(pub ::core::ffi::c_int);
287
288impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PackedOrder {
289    #[inline(always)]
290    fn eq(&self, other: &::core::ffi::c_int) -> bool {
291        &self.0 == other
292    }
293}
294
295impl ::core::cmp::PartialEq<SDL_PackedOrder> for ::core::ffi::c_int {
296    #[inline(always)]
297    fn eq(&self, other: &SDL_PackedOrder) -> bool {
298        self == &other.0
299    }
300}
301
302impl From<SDL_PackedOrder> for ::core::ffi::c_int {
303    #[inline(always)]
304    fn from(value: SDL_PackedOrder) -> Self {
305        value.0
306    }
307}
308
309#[cfg(feature = "debug-impls")]
310impl ::core::fmt::Debug for SDL_PackedOrder {
311    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
312        #[allow(unreachable_patterns)]
313        f.write_str(match *self {
314            Self::NONE => "SDL_PACKEDORDER_NONE",
315            Self::XRGB => "SDL_PACKEDORDER_XRGB",
316            Self::RGBX => "SDL_PACKEDORDER_RGBX",
317            Self::ARGB => "SDL_PACKEDORDER_ARGB",
318            Self::RGBA => "SDL_PACKEDORDER_RGBA",
319            Self::XBGR => "SDL_PACKEDORDER_XBGR",
320            Self::BGRX => "SDL_PACKEDORDER_BGRX",
321            Self::ABGR => "SDL_PACKEDORDER_ABGR",
322            Self::BGRA => "SDL_PACKEDORDER_BGRA",
323
324            _ => return write!(f, "SDL_PackedOrder({})", self.0),
325        })
326    }
327}
328
329impl SDL_PackedOrder {
330    pub const NONE: Self = Self((0 as ::core::ffi::c_int));
331    pub const XRGB: Self = Self((1 as ::core::ffi::c_int));
332    pub const RGBX: Self = Self((2 as ::core::ffi::c_int));
333    pub const ARGB: Self = Self((3 as ::core::ffi::c_int));
334    pub const RGBA: Self = Self((4 as ::core::ffi::c_int));
335    pub const XBGR: Self = Self((5 as ::core::ffi::c_int));
336    pub const BGRX: Self = Self((6 as ::core::ffi::c_int));
337    pub const ABGR: Self = Self((7 as ::core::ffi::c_int));
338    pub const BGRA: Self = Self((8 as ::core::ffi::c_int));
339}
340
341pub const SDL_PACKEDORDER_NONE: SDL_PackedOrder = SDL_PackedOrder::NONE;
342pub const SDL_PACKEDORDER_XRGB: SDL_PackedOrder = SDL_PackedOrder::XRGB;
343pub const SDL_PACKEDORDER_RGBX: SDL_PackedOrder = SDL_PackedOrder::RGBX;
344pub const SDL_PACKEDORDER_ARGB: SDL_PackedOrder = SDL_PackedOrder::ARGB;
345pub const SDL_PACKEDORDER_RGBA: SDL_PackedOrder = SDL_PackedOrder::RGBA;
346pub const SDL_PACKEDORDER_XBGR: SDL_PackedOrder = SDL_PackedOrder::XBGR;
347pub const SDL_PACKEDORDER_BGRX: SDL_PackedOrder = SDL_PackedOrder::BGRX;
348pub const SDL_PACKEDORDER_ABGR: SDL_PackedOrder = SDL_PackedOrder::ABGR;
349pub const SDL_PACKEDORDER_BGRA: SDL_PackedOrder = SDL_PackedOrder::BGRA;
350
351#[cfg(feature = "metadata")]
352impl sdl3_sys::metadata::GroupMetadata for SDL_PackedOrder {
353    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
354        &crate::metadata::pixels::METADATA_SDL_PackedOrder;
355}
356
357/// Array component order, low byte -> high byte.
358///
359/// ## Availability
360/// This enum is available since SDL 3.2.0.
361///
362/// ## Known values (`sdl3-sys`)
363/// | Associated constant | Global constant | Description |
364/// | ------------------- | --------------- | ----------- |
365/// | [`NONE`](SDL_ArrayOrder::NONE) | [`SDL_ARRAYORDER_NONE`] | |
366/// | [`RGB`](SDL_ArrayOrder::RGB) | [`SDL_ARRAYORDER_RGB`] | |
367/// | [`RGBA`](SDL_ArrayOrder::RGBA) | [`SDL_ARRAYORDER_RGBA`] | |
368/// | [`ARGB`](SDL_ArrayOrder::ARGB) | [`SDL_ARRAYORDER_ARGB`] | |
369/// | [`BGR`](SDL_ArrayOrder::BGR) | [`SDL_ARRAYORDER_BGR`] | |
370/// | [`BGRA`](SDL_ArrayOrder::BGRA) | [`SDL_ARRAYORDER_BGRA`] | |
371/// | [`ABGR`](SDL_ArrayOrder::ABGR) | [`SDL_ARRAYORDER_ABGR`] | |
372#[repr(transparent)]
373#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
374pub struct SDL_ArrayOrder(pub ::core::ffi::c_int);
375
376impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ArrayOrder {
377    #[inline(always)]
378    fn eq(&self, other: &::core::ffi::c_int) -> bool {
379        &self.0 == other
380    }
381}
382
383impl ::core::cmp::PartialEq<SDL_ArrayOrder> for ::core::ffi::c_int {
384    #[inline(always)]
385    fn eq(&self, other: &SDL_ArrayOrder) -> bool {
386        self == &other.0
387    }
388}
389
390impl From<SDL_ArrayOrder> for ::core::ffi::c_int {
391    #[inline(always)]
392    fn from(value: SDL_ArrayOrder) -> Self {
393        value.0
394    }
395}
396
397#[cfg(feature = "debug-impls")]
398impl ::core::fmt::Debug for SDL_ArrayOrder {
399    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
400        #[allow(unreachable_patterns)]
401        f.write_str(match *self {
402            Self::NONE => "SDL_ARRAYORDER_NONE",
403            Self::RGB => "SDL_ARRAYORDER_RGB",
404            Self::RGBA => "SDL_ARRAYORDER_RGBA",
405            Self::ARGB => "SDL_ARRAYORDER_ARGB",
406            Self::BGR => "SDL_ARRAYORDER_BGR",
407            Self::BGRA => "SDL_ARRAYORDER_BGRA",
408            Self::ABGR => "SDL_ARRAYORDER_ABGR",
409
410            _ => return write!(f, "SDL_ArrayOrder({})", self.0),
411        })
412    }
413}
414
415impl SDL_ArrayOrder {
416    pub const NONE: Self = Self((0 as ::core::ffi::c_int));
417    pub const RGB: Self = Self((1 as ::core::ffi::c_int));
418    pub const RGBA: Self = Self((2 as ::core::ffi::c_int));
419    pub const ARGB: Self = Self((3 as ::core::ffi::c_int));
420    pub const BGR: Self = Self((4 as ::core::ffi::c_int));
421    pub const BGRA: Self = Self((5 as ::core::ffi::c_int));
422    pub const ABGR: Self = Self((6 as ::core::ffi::c_int));
423}
424
425pub const SDL_ARRAYORDER_NONE: SDL_ArrayOrder = SDL_ArrayOrder::NONE;
426pub const SDL_ARRAYORDER_RGB: SDL_ArrayOrder = SDL_ArrayOrder::RGB;
427pub const SDL_ARRAYORDER_RGBA: SDL_ArrayOrder = SDL_ArrayOrder::RGBA;
428pub const SDL_ARRAYORDER_ARGB: SDL_ArrayOrder = SDL_ArrayOrder::ARGB;
429pub const SDL_ARRAYORDER_BGR: SDL_ArrayOrder = SDL_ArrayOrder::BGR;
430pub const SDL_ARRAYORDER_BGRA: SDL_ArrayOrder = SDL_ArrayOrder::BGRA;
431pub const SDL_ARRAYORDER_ABGR: SDL_ArrayOrder = SDL_ArrayOrder::ABGR;
432
433#[cfg(feature = "metadata")]
434impl sdl3_sys::metadata::GroupMetadata for SDL_ArrayOrder {
435    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
436        &crate::metadata::pixels::METADATA_SDL_ArrayOrder;
437}
438
439/// Packed component layout.
440///
441/// ## Availability
442/// This enum is available since SDL 3.2.0.
443///
444/// ## Known values (`sdl3-sys`)
445/// | Associated constant | Global constant | Description |
446/// | ------------------- | --------------- | ----------- |
447/// | [`NONE`](SDL_PackedLayout::NONE) | [`SDL_PACKEDLAYOUT_NONE`] | |
448/// | [`_332`](SDL_PackedLayout::_332) | [`SDL_PACKEDLAYOUT_332`] | |
449/// | [`_4444`](SDL_PackedLayout::_4444) | [`SDL_PACKEDLAYOUT_4444`] | |
450/// | [`_1555`](SDL_PackedLayout::_1555) | [`SDL_PACKEDLAYOUT_1555`] | |
451/// | [`_5551`](SDL_PackedLayout::_5551) | [`SDL_PACKEDLAYOUT_5551`] | |
452/// | [`_565`](SDL_PackedLayout::_565) | [`SDL_PACKEDLAYOUT_565`] | |
453/// | [`_8888`](SDL_PackedLayout::_8888) | [`SDL_PACKEDLAYOUT_8888`] | |
454/// | [`_2101010`](SDL_PackedLayout::_2101010) | [`SDL_PACKEDLAYOUT_2101010`] | |
455/// | [`_1010102`](SDL_PackedLayout::_1010102) | [`SDL_PACKEDLAYOUT_1010102`] | |
456#[repr(transparent)]
457#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
458pub struct SDL_PackedLayout(pub ::core::ffi::c_int);
459
460impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PackedLayout {
461    #[inline(always)]
462    fn eq(&self, other: &::core::ffi::c_int) -> bool {
463        &self.0 == other
464    }
465}
466
467impl ::core::cmp::PartialEq<SDL_PackedLayout> for ::core::ffi::c_int {
468    #[inline(always)]
469    fn eq(&self, other: &SDL_PackedLayout) -> bool {
470        self == &other.0
471    }
472}
473
474impl From<SDL_PackedLayout> for ::core::ffi::c_int {
475    #[inline(always)]
476    fn from(value: SDL_PackedLayout) -> Self {
477        value.0
478    }
479}
480
481#[cfg(feature = "debug-impls")]
482impl ::core::fmt::Debug for SDL_PackedLayout {
483    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
484        #[allow(unreachable_patterns)]
485        f.write_str(match *self {
486            Self::NONE => "SDL_PACKEDLAYOUT_NONE",
487            Self::_332 => "SDL_PACKEDLAYOUT_332",
488            Self::_4444 => "SDL_PACKEDLAYOUT_4444",
489            Self::_1555 => "SDL_PACKEDLAYOUT_1555",
490            Self::_5551 => "SDL_PACKEDLAYOUT_5551",
491            Self::_565 => "SDL_PACKEDLAYOUT_565",
492            Self::_8888 => "SDL_PACKEDLAYOUT_8888",
493            Self::_2101010 => "SDL_PACKEDLAYOUT_2101010",
494            Self::_1010102 => "SDL_PACKEDLAYOUT_1010102",
495
496            _ => return write!(f, "SDL_PackedLayout({})", self.0),
497        })
498    }
499}
500
501impl SDL_PackedLayout {
502    pub const NONE: Self = Self((0 as ::core::ffi::c_int));
503    pub const _332: Self = Self((1 as ::core::ffi::c_int));
504    pub const _4444: Self = Self((2 as ::core::ffi::c_int));
505    pub const _1555: Self = Self((3 as ::core::ffi::c_int));
506    pub const _5551: Self = Self((4 as ::core::ffi::c_int));
507    pub const _565: Self = Self((5 as ::core::ffi::c_int));
508    pub const _8888: Self = Self((6 as ::core::ffi::c_int));
509    pub const _2101010: Self = Self((7 as ::core::ffi::c_int));
510    pub const _1010102: Self = Self((8 as ::core::ffi::c_int));
511}
512
513pub const SDL_PACKEDLAYOUT_NONE: SDL_PackedLayout = SDL_PackedLayout::NONE;
514pub const SDL_PACKEDLAYOUT_332: SDL_PackedLayout = SDL_PackedLayout::_332;
515pub const SDL_PACKEDLAYOUT_4444: SDL_PackedLayout = SDL_PackedLayout::_4444;
516pub const SDL_PACKEDLAYOUT_1555: SDL_PackedLayout = SDL_PackedLayout::_1555;
517pub const SDL_PACKEDLAYOUT_5551: SDL_PackedLayout = SDL_PackedLayout::_5551;
518pub const SDL_PACKEDLAYOUT_565: SDL_PackedLayout = SDL_PackedLayout::_565;
519pub const SDL_PACKEDLAYOUT_8888: SDL_PackedLayout = SDL_PackedLayout::_8888;
520pub const SDL_PACKEDLAYOUT_2101010: SDL_PackedLayout = SDL_PackedLayout::_2101010;
521pub const SDL_PACKEDLAYOUT_1010102: SDL_PackedLayout = SDL_PackedLayout::_1010102;
522
523#[cfg(feature = "metadata")]
524impl sdl3_sys::metadata::GroupMetadata for SDL_PackedLayout {
525    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
526        &crate::metadata::pixels::METADATA_SDL_PackedLayout;
527}
528
529/// A macro for defining custom FourCC pixel formats.
530///
531/// For example, defining [`SDL_PIXELFORMAT_YV12`] looks like this:
532///
533/// ```c
534/// SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2')
535/// ```
536///
537/// ## Parameters
538/// - `A`: the first character of the FourCC code.
539/// - `B`: the second character of the FourCC code.
540/// - `C`: the third character of the FourCC code.
541/// - `D`: the fourth character of the FourCC code.
542///
543/// ## Return value
544/// Returns a format value in the style of [`SDL_PixelFormat`].
545///
546/// ## Thread safety
547/// It is safe to call this macro from any thread.
548///
549/// ## Availability
550/// This macro is available since SDL 3.2.0.
551#[inline(always)]
552pub const fn SDL_DEFINE_PIXELFOURCC(A: Uint8, B: Uint8, C: Uint8, D: Uint8) -> Uint32 {
553    SDL_FOURCC(A, B, C, D)
554}
555
556/// Pixel format.
557///
558/// SDL's pixel formats have the following naming convention:
559///
560/// - Names with a list of components and a single bit count, such as RGB24 and
561///   ABGR32, define a platform-independent encoding into bytes in the order
562///   specified. For example, in RGB24 data, each pixel is encoded in 3 bytes
563///   (red, green, blue) in that order, and in ABGR32 data, each pixel is
564///   encoded in 4 bytes (alpha, blue, green, red) in that order. Use these
565///   names if the property of a format that is important to you is the order
566///   of the bytes in memory or on disk.
567/// - Names with a bit count per component, such as ARGB8888 and XRGB1555, are
568///   "packed" into an appropriately-sized integer in the platform's native
569///   endianness. For example, ARGB8888 is a sequence of 32-bit integers; in
570///   each integer, the most significant bits are alpha, and the least
571///   significant bits are blue. On a little-endian CPU such as x86, the least
572///   significant bits of each integer are arranged first in memory, but on a
573///   big-endian CPU such as s390x, the most significant bits are arranged
574///   first. Use these names if the property of a format that is important to
575///   you is the meaning of each bit position within a native-endianness
576///   integer.
577/// - In indexed formats such as INDEX4LSB, each pixel is represented by
578///   encoding an index into the palette into the indicated number of bits,
579///   with multiple pixels packed into each byte if appropriate. In LSB
580///   formats, the first (leftmost) pixel is stored in the least-significant
581///   bits of the byte; in MSB formats, it's stored in the most-significant
582///   bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly
583///   fills one byte.
584///
585/// The 32-bit byte-array encodings such as RGBA32 are aliases for the
586/// appropriate 8888 encoding for the current platform. For example, RGBA32 is
587/// an alias for ABGR8888 on little-endian CPUs like x86, or an alias for
588/// RGBA8888 on big-endian CPUs.
589///
590/// ## Availability
591/// This enum is available since SDL 3.2.0.
592///
593/// ## Known values (`sdl3-sys`)
594/// | Associated constant | Global constant | Description |
595/// | ------------------- | --------------- | ----------- |
596/// | [`UNKNOWN`](SDL_PixelFormat::UNKNOWN) | [`SDL_PIXELFORMAT_UNKNOWN`] | |
597/// | [`INDEX1LSB`](SDL_PixelFormat::INDEX1LSB) | [`SDL_PIXELFORMAT_INDEX1LSB`] | |
598/// | [`INDEX1MSB`](SDL_PixelFormat::INDEX1MSB) | [`SDL_PIXELFORMAT_INDEX1MSB`] | |
599/// | [`INDEX2LSB`](SDL_PixelFormat::INDEX2LSB) | [`SDL_PIXELFORMAT_INDEX2LSB`] | |
600/// | [`INDEX2MSB`](SDL_PixelFormat::INDEX2MSB) | [`SDL_PIXELFORMAT_INDEX2MSB`] | |
601/// | [`INDEX4LSB`](SDL_PixelFormat::INDEX4LSB) | [`SDL_PIXELFORMAT_INDEX4LSB`] | |
602/// | [`INDEX4MSB`](SDL_PixelFormat::INDEX4MSB) | [`SDL_PIXELFORMAT_INDEX4MSB`] | |
603/// | [`INDEX8`](SDL_PixelFormat::INDEX8) | [`SDL_PIXELFORMAT_INDEX8`] | |
604/// | [`RGB332`](SDL_PixelFormat::RGB332) | [`SDL_PIXELFORMAT_RGB332`] | |
605/// | [`XRGB4444`](SDL_PixelFormat::XRGB4444) | [`SDL_PIXELFORMAT_XRGB4444`] | |
606/// | [`XBGR4444`](SDL_PixelFormat::XBGR4444) | [`SDL_PIXELFORMAT_XBGR4444`] | |
607/// | [`XRGB1555`](SDL_PixelFormat::XRGB1555) | [`SDL_PIXELFORMAT_XRGB1555`] | |
608/// | [`XBGR1555`](SDL_PixelFormat::XBGR1555) | [`SDL_PIXELFORMAT_XBGR1555`] | |
609/// | [`ARGB4444`](SDL_PixelFormat::ARGB4444) | [`SDL_PIXELFORMAT_ARGB4444`] | |
610/// | [`RGBA4444`](SDL_PixelFormat::RGBA4444) | [`SDL_PIXELFORMAT_RGBA4444`] | |
611/// | [`ABGR4444`](SDL_PixelFormat::ABGR4444) | [`SDL_PIXELFORMAT_ABGR4444`] | |
612/// | [`BGRA4444`](SDL_PixelFormat::BGRA4444) | [`SDL_PIXELFORMAT_BGRA4444`] | |
613/// | [`ARGB1555`](SDL_PixelFormat::ARGB1555) | [`SDL_PIXELFORMAT_ARGB1555`] | |
614/// | [`RGBA5551`](SDL_PixelFormat::RGBA5551) | [`SDL_PIXELFORMAT_RGBA5551`] | |
615/// | [`ABGR1555`](SDL_PixelFormat::ABGR1555) | [`SDL_PIXELFORMAT_ABGR1555`] | |
616/// | [`BGRA5551`](SDL_PixelFormat::BGRA5551) | [`SDL_PIXELFORMAT_BGRA5551`] | |
617/// | [`RGB565`](SDL_PixelFormat::RGB565) | [`SDL_PIXELFORMAT_RGB565`] | |
618/// | [`BGR565`](SDL_PixelFormat::BGR565) | [`SDL_PIXELFORMAT_BGR565`] | |
619/// | [`RGB24`](SDL_PixelFormat::RGB24) | [`SDL_PIXELFORMAT_RGB24`] | |
620/// | [`BGR24`](SDL_PixelFormat::BGR24) | [`SDL_PIXELFORMAT_BGR24`] | |
621/// | [`XRGB8888`](SDL_PixelFormat::XRGB8888) | [`SDL_PIXELFORMAT_XRGB8888`] | |
622/// | [`RGBX8888`](SDL_PixelFormat::RGBX8888) | [`SDL_PIXELFORMAT_RGBX8888`] | |
623/// | [`XBGR8888`](SDL_PixelFormat::XBGR8888) | [`SDL_PIXELFORMAT_XBGR8888`] | |
624/// | [`BGRX8888`](SDL_PixelFormat::BGRX8888) | [`SDL_PIXELFORMAT_BGRX8888`] | |
625/// | [`ARGB8888`](SDL_PixelFormat::ARGB8888) | [`SDL_PIXELFORMAT_ARGB8888`] | |
626/// | [`RGBA8888`](SDL_PixelFormat::RGBA8888) | [`SDL_PIXELFORMAT_RGBA8888`] | |
627/// | [`ABGR8888`](SDL_PixelFormat::ABGR8888) | [`SDL_PIXELFORMAT_ABGR8888`] | |
628/// | [`BGRA8888`](SDL_PixelFormat::BGRA8888) | [`SDL_PIXELFORMAT_BGRA8888`] | |
629/// | [`XRGB2101010`](SDL_PixelFormat::XRGB2101010) | [`SDL_PIXELFORMAT_XRGB2101010`] | |
630/// | [`XBGR2101010`](SDL_PixelFormat::XBGR2101010) | [`SDL_PIXELFORMAT_XBGR2101010`] | |
631/// | [`ARGB2101010`](SDL_PixelFormat::ARGB2101010) | [`SDL_PIXELFORMAT_ARGB2101010`] | |
632/// | [`ABGR2101010`](SDL_PixelFormat::ABGR2101010) | [`SDL_PIXELFORMAT_ABGR2101010`] | |
633/// | [`RGB48`](SDL_PixelFormat::RGB48) | [`SDL_PIXELFORMAT_RGB48`] | |
634/// | [`BGR48`](SDL_PixelFormat::BGR48) | [`SDL_PIXELFORMAT_BGR48`] | |
635/// | [`RGBA64`](SDL_PixelFormat::RGBA64) | [`SDL_PIXELFORMAT_RGBA64`] | |
636/// | [`ARGB64`](SDL_PixelFormat::ARGB64) | [`SDL_PIXELFORMAT_ARGB64`] | |
637/// | [`BGRA64`](SDL_PixelFormat::BGRA64) | [`SDL_PIXELFORMAT_BGRA64`] | |
638/// | [`ABGR64`](SDL_PixelFormat::ABGR64) | [`SDL_PIXELFORMAT_ABGR64`] | |
639/// | [`RGB48_FLOAT`](SDL_PixelFormat::RGB48_FLOAT) | [`SDL_PIXELFORMAT_RGB48_FLOAT`] | |
640/// | [`BGR48_FLOAT`](SDL_PixelFormat::BGR48_FLOAT) | [`SDL_PIXELFORMAT_BGR48_FLOAT`] | |
641/// | [`RGBA64_FLOAT`](SDL_PixelFormat::RGBA64_FLOAT) | [`SDL_PIXELFORMAT_RGBA64_FLOAT`] | |
642/// | [`ARGB64_FLOAT`](SDL_PixelFormat::ARGB64_FLOAT) | [`SDL_PIXELFORMAT_ARGB64_FLOAT`] | |
643/// | [`BGRA64_FLOAT`](SDL_PixelFormat::BGRA64_FLOAT) | [`SDL_PIXELFORMAT_BGRA64_FLOAT`] | |
644/// | [`ABGR64_FLOAT`](SDL_PixelFormat::ABGR64_FLOAT) | [`SDL_PIXELFORMAT_ABGR64_FLOAT`] | |
645/// | [`RGB96_FLOAT`](SDL_PixelFormat::RGB96_FLOAT) | [`SDL_PIXELFORMAT_RGB96_FLOAT`] | |
646/// | [`BGR96_FLOAT`](SDL_PixelFormat::BGR96_FLOAT) | [`SDL_PIXELFORMAT_BGR96_FLOAT`] | |
647/// | [`RGBA128_FLOAT`](SDL_PixelFormat::RGBA128_FLOAT) | [`SDL_PIXELFORMAT_RGBA128_FLOAT`] | |
648/// | [`ARGB128_FLOAT`](SDL_PixelFormat::ARGB128_FLOAT) | [`SDL_PIXELFORMAT_ARGB128_FLOAT`] | |
649/// | [`BGRA128_FLOAT`](SDL_PixelFormat::BGRA128_FLOAT) | [`SDL_PIXELFORMAT_BGRA128_FLOAT`] | |
650/// | [`ABGR128_FLOAT`](SDL_PixelFormat::ABGR128_FLOAT) | [`SDL_PIXELFORMAT_ABGR128_FLOAT`] | |
651/// | [`YV12`](SDL_PixelFormat::YV12) | [`SDL_PIXELFORMAT_YV12`] | Planar mode: Y + V + U  (3 planes) |
652/// | [`IYUV`](SDL_PixelFormat::IYUV) | [`SDL_PIXELFORMAT_IYUV`] | Planar mode: Y + U + V  (3 planes) |
653/// | [`YUY2`](SDL_PixelFormat::YUY2) | [`SDL_PIXELFORMAT_YUY2`] | Packed mode: Y0+U0+Y1+V0 (1 plane) |
654/// | [`UYVY`](SDL_PixelFormat::UYVY) | [`SDL_PIXELFORMAT_UYVY`] | Packed mode: U0+Y0+V0+Y1 (1 plane) |
655/// | [`YVYU`](SDL_PixelFormat::YVYU) | [`SDL_PIXELFORMAT_YVYU`] | Packed mode: Y0+V0+Y1+U0 (1 plane) |
656/// | [`NV12`](SDL_PixelFormat::NV12) | [`SDL_PIXELFORMAT_NV12`] | Planar mode: Y + U/V interleaved  (2 planes) |
657/// | [`NV21`](SDL_PixelFormat::NV21) | [`SDL_PIXELFORMAT_NV21`] | Planar mode: Y + V/U interleaved  (2 planes) |
658/// | [`P010`](SDL_PixelFormat::P010) | [`SDL_PIXELFORMAT_P010`] | Planar mode: Y + U/V interleaved  (2 planes) |
659/// | [`EXTERNAL_OES`](SDL_PixelFormat::EXTERNAL_OES) | [`SDL_PIXELFORMAT_EXTERNAL_OES`] | Android video texture format |
660/// | [`MJPG`](SDL_PixelFormat::MJPG) | [`SDL_PIXELFORMAT_MJPG`] | Motion JPEG |
661/// | [`RGBA32`](SDL_PixelFormat::RGBA32) | [`SDL_PIXELFORMAT_RGBA32`] | (target dependent) |
662/// | [`ARGB32`](SDL_PixelFormat::ARGB32) | [`SDL_PIXELFORMAT_ARGB32`] | (target dependent) |
663/// | [`BGRA32`](SDL_PixelFormat::BGRA32) | [`SDL_PIXELFORMAT_BGRA32`] | (target dependent) |
664/// | [`ABGR32`](SDL_PixelFormat::ABGR32) | [`SDL_PIXELFORMAT_ABGR32`] | (target dependent) |
665/// | [`RGBX32`](SDL_PixelFormat::RGBX32) | [`SDL_PIXELFORMAT_RGBX32`] | (target dependent) |
666/// | [`XRGB32`](SDL_PixelFormat::XRGB32) | [`SDL_PIXELFORMAT_XRGB32`] | (target dependent) |
667/// | [`BGRX32`](SDL_PixelFormat::BGRX32) | [`SDL_PIXELFORMAT_BGRX32`] | (target dependent) |
668/// | [`XBGR32`](SDL_PixelFormat::XBGR32) | [`SDL_PIXELFORMAT_XBGR32`] | (target dependent) |
669#[repr(transparent)]
670#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
671pub struct SDL_PixelFormat(pub ::core::ffi::c_int);
672
673impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PixelFormat {
674    #[inline(always)]
675    fn eq(&self, other: &::core::ffi::c_int) -> bool {
676        &self.0 == other
677    }
678}
679
680impl ::core::cmp::PartialEq<SDL_PixelFormat> for ::core::ffi::c_int {
681    #[inline(always)]
682    fn eq(&self, other: &SDL_PixelFormat) -> bool {
683        self == &other.0
684    }
685}
686
687impl From<SDL_PixelFormat> for ::core::ffi::c_int {
688    #[inline(always)]
689    fn from(value: SDL_PixelFormat) -> Self {
690        value.0
691    }
692}
693
694#[cfg(feature = "debug-impls")]
695impl ::core::fmt::Debug for SDL_PixelFormat {
696    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
697        #[allow(unreachable_patterns)]
698        f.write_str(match *self {
699            Self::UNKNOWN => "SDL_PIXELFORMAT_UNKNOWN",
700            Self::INDEX1LSB => "SDL_PIXELFORMAT_INDEX1LSB",
701            Self::INDEX1MSB => "SDL_PIXELFORMAT_INDEX1MSB",
702            Self::INDEX2LSB => "SDL_PIXELFORMAT_INDEX2LSB",
703            Self::INDEX2MSB => "SDL_PIXELFORMAT_INDEX2MSB",
704            Self::INDEX4LSB => "SDL_PIXELFORMAT_INDEX4LSB",
705            Self::INDEX4MSB => "SDL_PIXELFORMAT_INDEX4MSB",
706            Self::INDEX8 => "SDL_PIXELFORMAT_INDEX8",
707            Self::RGB332 => "SDL_PIXELFORMAT_RGB332",
708            Self::XRGB4444 => "SDL_PIXELFORMAT_XRGB4444",
709            Self::XBGR4444 => "SDL_PIXELFORMAT_XBGR4444",
710            Self::XRGB1555 => "SDL_PIXELFORMAT_XRGB1555",
711            Self::XBGR1555 => "SDL_PIXELFORMAT_XBGR1555",
712            Self::ARGB4444 => "SDL_PIXELFORMAT_ARGB4444",
713            Self::RGBA4444 => "SDL_PIXELFORMAT_RGBA4444",
714            Self::ABGR4444 => "SDL_PIXELFORMAT_ABGR4444",
715            Self::BGRA4444 => "SDL_PIXELFORMAT_BGRA4444",
716            Self::ARGB1555 => "SDL_PIXELFORMAT_ARGB1555",
717            Self::RGBA5551 => "SDL_PIXELFORMAT_RGBA5551",
718            Self::ABGR1555 => "SDL_PIXELFORMAT_ABGR1555",
719            Self::BGRA5551 => "SDL_PIXELFORMAT_BGRA5551",
720            Self::RGB565 => "SDL_PIXELFORMAT_RGB565",
721            Self::BGR565 => "SDL_PIXELFORMAT_BGR565",
722            Self::RGB24 => "SDL_PIXELFORMAT_RGB24",
723            Self::BGR24 => "SDL_PIXELFORMAT_BGR24",
724            Self::XRGB8888 => "SDL_PIXELFORMAT_XRGB8888",
725            Self::RGBX8888 => "SDL_PIXELFORMAT_RGBX8888",
726            Self::XBGR8888 => "SDL_PIXELFORMAT_XBGR8888",
727            Self::BGRX8888 => "SDL_PIXELFORMAT_BGRX8888",
728            Self::ARGB8888 => "SDL_PIXELFORMAT_ARGB8888",
729            Self::RGBA8888 => "SDL_PIXELFORMAT_RGBA8888",
730            Self::ABGR8888 => "SDL_PIXELFORMAT_ABGR8888",
731            Self::BGRA8888 => "SDL_PIXELFORMAT_BGRA8888",
732            Self::XRGB2101010 => "SDL_PIXELFORMAT_XRGB2101010",
733            Self::XBGR2101010 => "SDL_PIXELFORMAT_XBGR2101010",
734            Self::ARGB2101010 => "SDL_PIXELFORMAT_ARGB2101010",
735            Self::ABGR2101010 => "SDL_PIXELFORMAT_ABGR2101010",
736            Self::RGB48 => "SDL_PIXELFORMAT_RGB48",
737            Self::BGR48 => "SDL_PIXELFORMAT_BGR48",
738            Self::RGBA64 => "SDL_PIXELFORMAT_RGBA64",
739            Self::ARGB64 => "SDL_PIXELFORMAT_ARGB64",
740            Self::BGRA64 => "SDL_PIXELFORMAT_BGRA64",
741            Self::ABGR64 => "SDL_PIXELFORMAT_ABGR64",
742            Self::RGB48_FLOAT => "SDL_PIXELFORMAT_RGB48_FLOAT",
743            Self::BGR48_FLOAT => "SDL_PIXELFORMAT_BGR48_FLOAT",
744            Self::RGBA64_FLOAT => "SDL_PIXELFORMAT_RGBA64_FLOAT",
745            Self::ARGB64_FLOAT => "SDL_PIXELFORMAT_ARGB64_FLOAT",
746            Self::BGRA64_FLOAT => "SDL_PIXELFORMAT_BGRA64_FLOAT",
747            Self::ABGR64_FLOAT => "SDL_PIXELFORMAT_ABGR64_FLOAT",
748            Self::RGB96_FLOAT => "SDL_PIXELFORMAT_RGB96_FLOAT",
749            Self::BGR96_FLOAT => "SDL_PIXELFORMAT_BGR96_FLOAT",
750            Self::RGBA128_FLOAT => "SDL_PIXELFORMAT_RGBA128_FLOAT",
751            Self::ARGB128_FLOAT => "SDL_PIXELFORMAT_ARGB128_FLOAT",
752            Self::BGRA128_FLOAT => "SDL_PIXELFORMAT_BGRA128_FLOAT",
753            Self::ABGR128_FLOAT => "SDL_PIXELFORMAT_ABGR128_FLOAT",
754            Self::YV12 => "SDL_PIXELFORMAT_YV12",
755            Self::IYUV => "SDL_PIXELFORMAT_IYUV",
756            Self::YUY2 => "SDL_PIXELFORMAT_YUY2",
757            Self::UYVY => "SDL_PIXELFORMAT_UYVY",
758            Self::YVYU => "SDL_PIXELFORMAT_YVYU",
759            Self::NV12 => "SDL_PIXELFORMAT_NV12",
760            Self::NV21 => "SDL_PIXELFORMAT_NV21",
761            Self::P010 => "SDL_PIXELFORMAT_P010",
762            Self::EXTERNAL_OES => "SDL_PIXELFORMAT_EXTERNAL_OES",
763            Self::MJPG => "SDL_PIXELFORMAT_MJPG",
764            Self::RGBA32 => "SDL_PIXELFORMAT_RGBA32",
765            Self::ARGB32 => "SDL_PIXELFORMAT_ARGB32",
766            Self::BGRA32 => "SDL_PIXELFORMAT_BGRA32",
767            Self::ABGR32 => "SDL_PIXELFORMAT_ABGR32",
768            Self::RGBX32 => "SDL_PIXELFORMAT_RGBX32",
769            Self::XRGB32 => "SDL_PIXELFORMAT_XRGB32",
770            Self::BGRX32 => "SDL_PIXELFORMAT_BGRX32",
771            Self::XBGR32 => "SDL_PIXELFORMAT_XBGR32",
772            Self::RGBA32 => "SDL_PIXELFORMAT_RGBA32",
773            Self::ARGB32 => "SDL_PIXELFORMAT_ARGB32",
774            Self::BGRA32 => "SDL_PIXELFORMAT_BGRA32",
775            Self::ABGR32 => "SDL_PIXELFORMAT_ABGR32",
776            Self::RGBX32 => "SDL_PIXELFORMAT_RGBX32",
777            Self::XRGB32 => "SDL_PIXELFORMAT_XRGB32",
778            Self::BGRX32 => "SDL_PIXELFORMAT_BGRX32",
779            Self::XBGR32 => "SDL_PIXELFORMAT_XBGR32",
780
781            _ => return write!(f, "SDL_PixelFormat({})", self.0),
782        })
783    }
784}
785
786impl SDL_PixelFormat {
787    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
788    pub const INDEX1LSB: Self = Self((0x11100100 as ::core::ffi::c_int));
789    pub const INDEX1MSB: Self = Self((0x11200100 as ::core::ffi::c_int));
790    pub const INDEX2LSB: Self = Self((0x1c100200 as ::core::ffi::c_int));
791    pub const INDEX2MSB: Self = Self((0x1c200200 as ::core::ffi::c_int));
792    pub const INDEX4LSB: Self = Self((0x12100400 as ::core::ffi::c_int));
793    pub const INDEX4MSB: Self = Self((0x12200400 as ::core::ffi::c_int));
794    pub const INDEX8: Self = Self((0x13000801 as ::core::ffi::c_int));
795    pub const RGB332: Self = Self((0x14110801 as ::core::ffi::c_int));
796    pub const XRGB4444: Self = Self((0x15120c02 as ::core::ffi::c_int));
797    pub const XBGR4444: Self = Self((0x15520c02 as ::core::ffi::c_int));
798    pub const XRGB1555: Self = Self((0x15130f02 as ::core::ffi::c_int));
799    pub const XBGR1555: Self = Self((0x15530f02 as ::core::ffi::c_int));
800    pub const ARGB4444: Self = Self((0x15321002 as ::core::ffi::c_int));
801    pub const RGBA4444: Self = Self((0x15421002 as ::core::ffi::c_int));
802    pub const ABGR4444: Self = Self((0x15721002 as ::core::ffi::c_int));
803    pub const BGRA4444: Self = Self((0x15821002 as ::core::ffi::c_int));
804    pub const ARGB1555: Self = Self((0x15331002 as ::core::ffi::c_int));
805    pub const RGBA5551: Self = Self((0x15441002 as ::core::ffi::c_int));
806    pub const ABGR1555: Self = Self((0x15731002 as ::core::ffi::c_int));
807    pub const BGRA5551: Self = Self((0x15841002 as ::core::ffi::c_int));
808    pub const RGB565: Self = Self((0x15151002 as ::core::ffi::c_int));
809    pub const BGR565: Self = Self((0x15551002 as ::core::ffi::c_int));
810    pub const RGB24: Self = Self((0x17101803 as ::core::ffi::c_int));
811    pub const BGR24: Self = Self((0x17401803 as ::core::ffi::c_int));
812    pub const XRGB8888: Self = Self((0x16161804 as ::core::ffi::c_int));
813    pub const RGBX8888: Self = Self((0x16261804 as ::core::ffi::c_int));
814    pub const XBGR8888: Self = Self((0x16561804 as ::core::ffi::c_int));
815    pub const BGRX8888: Self = Self((0x16661804 as ::core::ffi::c_int));
816    pub const ARGB8888: Self = Self((0x16362004 as ::core::ffi::c_int));
817    pub const RGBA8888: Self = Self((0x16462004 as ::core::ffi::c_int));
818    pub const ABGR8888: Self = Self((0x16762004 as ::core::ffi::c_int));
819    pub const BGRA8888: Self = Self((0x16862004 as ::core::ffi::c_int));
820    pub const XRGB2101010: Self = Self((0x16172004 as ::core::ffi::c_int));
821    pub const XBGR2101010: Self = Self((0x16572004 as ::core::ffi::c_int));
822    pub const ARGB2101010: Self = Self((0x16372004 as ::core::ffi::c_int));
823    pub const ABGR2101010: Self = Self((0x16772004 as ::core::ffi::c_int));
824    pub const RGB48: Self = Self((0x18103006 as ::core::ffi::c_int));
825    pub const BGR48: Self = Self((0x18403006 as ::core::ffi::c_int));
826    pub const RGBA64: Self = Self((0x18204008 as ::core::ffi::c_int));
827    pub const ARGB64: Self = Self((0x18304008 as ::core::ffi::c_int));
828    pub const BGRA64: Self = Self((0x18504008 as ::core::ffi::c_int));
829    pub const ABGR64: Self = Self((0x18604008 as ::core::ffi::c_int));
830    pub const RGB48_FLOAT: Self = Self((0x1a103006 as ::core::ffi::c_int));
831    pub const BGR48_FLOAT: Self = Self((0x1a403006 as ::core::ffi::c_int));
832    pub const RGBA64_FLOAT: Self = Self((0x1a204008 as ::core::ffi::c_int));
833    pub const ARGB64_FLOAT: Self = Self((0x1a304008 as ::core::ffi::c_int));
834    pub const BGRA64_FLOAT: Self = Self((0x1a504008 as ::core::ffi::c_int));
835    pub const ABGR64_FLOAT: Self = Self((0x1a604008 as ::core::ffi::c_int));
836    pub const RGB96_FLOAT: Self = Self((0x1b10600c as ::core::ffi::c_int));
837    pub const BGR96_FLOAT: Self = Self((0x1b40600c as ::core::ffi::c_int));
838    pub const RGBA128_FLOAT: Self = Self((0x1b208010 as ::core::ffi::c_int));
839    pub const ARGB128_FLOAT: Self = Self((0x1b308010 as ::core::ffi::c_int));
840    pub const BGRA128_FLOAT: Self = Self((0x1b508010 as ::core::ffi::c_int));
841    pub const ABGR128_FLOAT: Self = Self((0x1b608010 as ::core::ffi::c_int));
842    /// Planar mode: Y + V + U  (3 planes)
843    pub const YV12: Self = Self((0x32315659 as ::core::ffi::c_int));
844    /// Planar mode: Y + U + V  (3 planes)
845    pub const IYUV: Self = Self((0x56555949 as ::core::ffi::c_int));
846    /// Packed mode: Y0+U0+Y1+V0 (1 plane)
847    pub const YUY2: Self = Self((0x32595559 as ::core::ffi::c_int));
848    /// Packed mode: U0+Y0+V0+Y1 (1 plane)
849    pub const UYVY: Self = Self((0x59565955 as ::core::ffi::c_int));
850    /// Packed mode: Y0+V0+Y1+U0 (1 plane)
851    pub const YVYU: Self = Self((0x55595659 as ::core::ffi::c_int));
852    /// Planar mode: Y + U/V interleaved  (2 planes)
853    pub const NV12: Self = Self((0x3231564e as ::core::ffi::c_int));
854    /// Planar mode: Y + V/U interleaved  (2 planes)
855    pub const NV21: Self = Self((0x3132564e as ::core::ffi::c_int));
856    /// Planar mode: Y + U/V interleaved  (2 planes)
857    pub const P010: Self = Self((0x30313050 as ::core::ffi::c_int));
858    /// Android video texture format
859    pub const EXTERNAL_OES: Self = Self((0x2053454f as ::core::ffi::c_int));
860    /// Motion JPEG
861    pub const MJPG: Self = Self((0x47504a4d as ::core::ffi::c_int));
862    #[cfg(target_endian = "big")]
863    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
864    pub const RGBA32: Self = SDL_PIXELFORMAT_RGBA8888;
865    #[cfg(target_endian = "big")]
866    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
867    pub const ARGB32: Self = SDL_PIXELFORMAT_ARGB8888;
868    #[cfg(target_endian = "big")]
869    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
870    pub const BGRA32: Self = SDL_PIXELFORMAT_BGRA8888;
871    #[cfg(target_endian = "big")]
872    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
873    pub const ABGR32: Self = SDL_PIXELFORMAT_ABGR8888;
874    #[cfg(target_endian = "big")]
875    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
876    pub const RGBX32: Self = SDL_PIXELFORMAT_RGBX8888;
877    #[cfg(target_endian = "big")]
878    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
879    pub const XRGB32: Self = SDL_PIXELFORMAT_XRGB8888;
880    #[cfg(target_endian = "big")]
881    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
882    pub const BGRX32: Self = SDL_PIXELFORMAT_BGRX8888;
883    #[cfg(target_endian = "big")]
884    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
885    pub const XBGR32: Self = SDL_PIXELFORMAT_XBGR8888;
886    #[cfg(not(target_endian = "big"))]
887    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
888    pub const RGBA32: Self = SDL_PIXELFORMAT_ABGR8888;
889    #[cfg(not(target_endian = "big"))]
890    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
891    pub const ARGB32: Self = SDL_PIXELFORMAT_BGRA8888;
892    #[cfg(not(target_endian = "big"))]
893    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
894    pub const BGRA32: Self = SDL_PIXELFORMAT_ARGB8888;
895    #[cfg(not(target_endian = "big"))]
896    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
897    pub const ABGR32: Self = SDL_PIXELFORMAT_RGBA8888;
898    #[cfg(not(target_endian = "big"))]
899    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
900    pub const RGBX32: Self = SDL_PIXELFORMAT_XBGR8888;
901    #[cfg(not(target_endian = "big"))]
902    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
903    pub const XRGB32: Self = SDL_PIXELFORMAT_BGRX8888;
904    #[cfg(not(target_endian = "big"))]
905    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
906    pub const BGRX32: Self = SDL_PIXELFORMAT_XRGB8888;
907    #[cfg(not(target_endian = "big"))]
908    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
909    pub const XBGR32: Self = SDL_PIXELFORMAT_RGBX8888;
910}
911
912pub const SDL_PIXELFORMAT_UNKNOWN: SDL_PixelFormat = SDL_PixelFormat::UNKNOWN;
913pub const SDL_PIXELFORMAT_INDEX1LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX1LSB;
914pub const SDL_PIXELFORMAT_INDEX1MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX1MSB;
915pub const SDL_PIXELFORMAT_INDEX2LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX2LSB;
916pub const SDL_PIXELFORMAT_INDEX2MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX2MSB;
917pub const SDL_PIXELFORMAT_INDEX4LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX4LSB;
918pub const SDL_PIXELFORMAT_INDEX4MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX4MSB;
919pub const SDL_PIXELFORMAT_INDEX8: SDL_PixelFormat = SDL_PixelFormat::INDEX8;
920pub const SDL_PIXELFORMAT_RGB332: SDL_PixelFormat = SDL_PixelFormat::RGB332;
921pub const SDL_PIXELFORMAT_XRGB4444: SDL_PixelFormat = SDL_PixelFormat::XRGB4444;
922pub const SDL_PIXELFORMAT_XBGR4444: SDL_PixelFormat = SDL_PixelFormat::XBGR4444;
923pub const SDL_PIXELFORMAT_XRGB1555: SDL_PixelFormat = SDL_PixelFormat::XRGB1555;
924pub const SDL_PIXELFORMAT_XBGR1555: SDL_PixelFormat = SDL_PixelFormat::XBGR1555;
925pub const SDL_PIXELFORMAT_ARGB4444: SDL_PixelFormat = SDL_PixelFormat::ARGB4444;
926pub const SDL_PIXELFORMAT_RGBA4444: SDL_PixelFormat = SDL_PixelFormat::RGBA4444;
927pub const SDL_PIXELFORMAT_ABGR4444: SDL_PixelFormat = SDL_PixelFormat::ABGR4444;
928pub const SDL_PIXELFORMAT_BGRA4444: SDL_PixelFormat = SDL_PixelFormat::BGRA4444;
929pub const SDL_PIXELFORMAT_ARGB1555: SDL_PixelFormat = SDL_PixelFormat::ARGB1555;
930pub const SDL_PIXELFORMAT_RGBA5551: SDL_PixelFormat = SDL_PixelFormat::RGBA5551;
931pub const SDL_PIXELFORMAT_ABGR1555: SDL_PixelFormat = SDL_PixelFormat::ABGR1555;
932pub const SDL_PIXELFORMAT_BGRA5551: SDL_PixelFormat = SDL_PixelFormat::BGRA5551;
933pub const SDL_PIXELFORMAT_RGB565: SDL_PixelFormat = SDL_PixelFormat::RGB565;
934pub const SDL_PIXELFORMAT_BGR565: SDL_PixelFormat = SDL_PixelFormat::BGR565;
935pub const SDL_PIXELFORMAT_RGB24: SDL_PixelFormat = SDL_PixelFormat::RGB24;
936pub const SDL_PIXELFORMAT_BGR24: SDL_PixelFormat = SDL_PixelFormat::BGR24;
937pub const SDL_PIXELFORMAT_XRGB8888: SDL_PixelFormat = SDL_PixelFormat::XRGB8888;
938pub const SDL_PIXELFORMAT_RGBX8888: SDL_PixelFormat = SDL_PixelFormat::RGBX8888;
939pub const SDL_PIXELFORMAT_XBGR8888: SDL_PixelFormat = SDL_PixelFormat::XBGR8888;
940pub const SDL_PIXELFORMAT_BGRX8888: SDL_PixelFormat = SDL_PixelFormat::BGRX8888;
941pub const SDL_PIXELFORMAT_ARGB8888: SDL_PixelFormat = SDL_PixelFormat::ARGB8888;
942pub const SDL_PIXELFORMAT_RGBA8888: SDL_PixelFormat = SDL_PixelFormat::RGBA8888;
943pub const SDL_PIXELFORMAT_ABGR8888: SDL_PixelFormat = SDL_PixelFormat::ABGR8888;
944pub const SDL_PIXELFORMAT_BGRA8888: SDL_PixelFormat = SDL_PixelFormat::BGRA8888;
945pub const SDL_PIXELFORMAT_XRGB2101010: SDL_PixelFormat = SDL_PixelFormat::XRGB2101010;
946pub const SDL_PIXELFORMAT_XBGR2101010: SDL_PixelFormat = SDL_PixelFormat::XBGR2101010;
947pub const SDL_PIXELFORMAT_ARGB2101010: SDL_PixelFormat = SDL_PixelFormat::ARGB2101010;
948pub const SDL_PIXELFORMAT_ABGR2101010: SDL_PixelFormat = SDL_PixelFormat::ABGR2101010;
949pub const SDL_PIXELFORMAT_RGB48: SDL_PixelFormat = SDL_PixelFormat::RGB48;
950pub const SDL_PIXELFORMAT_BGR48: SDL_PixelFormat = SDL_PixelFormat::BGR48;
951pub const SDL_PIXELFORMAT_RGBA64: SDL_PixelFormat = SDL_PixelFormat::RGBA64;
952pub const SDL_PIXELFORMAT_ARGB64: SDL_PixelFormat = SDL_PixelFormat::ARGB64;
953pub const SDL_PIXELFORMAT_BGRA64: SDL_PixelFormat = SDL_PixelFormat::BGRA64;
954pub const SDL_PIXELFORMAT_ABGR64: SDL_PixelFormat = SDL_PixelFormat::ABGR64;
955pub const SDL_PIXELFORMAT_RGB48_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGB48_FLOAT;
956pub const SDL_PIXELFORMAT_BGR48_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGR48_FLOAT;
957pub const SDL_PIXELFORMAT_RGBA64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGBA64_FLOAT;
958pub const SDL_PIXELFORMAT_ARGB64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ARGB64_FLOAT;
959pub const SDL_PIXELFORMAT_BGRA64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGRA64_FLOAT;
960pub const SDL_PIXELFORMAT_ABGR64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ABGR64_FLOAT;
961pub const SDL_PIXELFORMAT_RGB96_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGB96_FLOAT;
962pub const SDL_PIXELFORMAT_BGR96_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGR96_FLOAT;
963pub const SDL_PIXELFORMAT_RGBA128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGBA128_FLOAT;
964pub const SDL_PIXELFORMAT_ARGB128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ARGB128_FLOAT;
965pub const SDL_PIXELFORMAT_BGRA128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGRA128_FLOAT;
966pub const SDL_PIXELFORMAT_ABGR128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ABGR128_FLOAT;
967/// Planar mode: Y + V + U  (3 planes)
968pub const SDL_PIXELFORMAT_YV12: SDL_PixelFormat = SDL_PixelFormat::YV12;
969/// Planar mode: Y + U + V  (3 planes)
970pub const SDL_PIXELFORMAT_IYUV: SDL_PixelFormat = SDL_PixelFormat::IYUV;
971/// Packed mode: Y0+U0+Y1+V0 (1 plane)
972pub const SDL_PIXELFORMAT_YUY2: SDL_PixelFormat = SDL_PixelFormat::YUY2;
973/// Packed mode: U0+Y0+V0+Y1 (1 plane)
974pub const SDL_PIXELFORMAT_UYVY: SDL_PixelFormat = SDL_PixelFormat::UYVY;
975/// Packed mode: Y0+V0+Y1+U0 (1 plane)
976pub const SDL_PIXELFORMAT_YVYU: SDL_PixelFormat = SDL_PixelFormat::YVYU;
977/// Planar mode: Y + U/V interleaved  (2 planes)
978pub const SDL_PIXELFORMAT_NV12: SDL_PixelFormat = SDL_PixelFormat::NV12;
979/// Planar mode: Y + V/U interleaved  (2 planes)
980pub const SDL_PIXELFORMAT_NV21: SDL_PixelFormat = SDL_PixelFormat::NV21;
981/// Planar mode: Y + U/V interleaved  (2 planes)
982pub const SDL_PIXELFORMAT_P010: SDL_PixelFormat = SDL_PixelFormat::P010;
983/// Android video texture format
984pub const SDL_PIXELFORMAT_EXTERNAL_OES: SDL_PixelFormat = SDL_PixelFormat::EXTERNAL_OES;
985/// Motion JPEG
986pub const SDL_PIXELFORMAT_MJPG: SDL_PixelFormat = SDL_PixelFormat::MJPG;
987#[cfg(target_endian = "big")]
988#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
989pub const SDL_PIXELFORMAT_RGBA32: SDL_PixelFormat = SDL_PixelFormat::RGBA32;
990#[cfg(target_endian = "big")]
991#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
992pub const SDL_PIXELFORMAT_ARGB32: SDL_PixelFormat = SDL_PixelFormat::ARGB32;
993#[cfg(target_endian = "big")]
994#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
995pub const SDL_PIXELFORMAT_BGRA32: SDL_PixelFormat = SDL_PixelFormat::BGRA32;
996#[cfg(target_endian = "big")]
997#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
998pub const SDL_PIXELFORMAT_ABGR32: SDL_PixelFormat = SDL_PixelFormat::ABGR32;
999#[cfg(target_endian = "big")]
1000#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1001pub const SDL_PIXELFORMAT_RGBX32: SDL_PixelFormat = SDL_PixelFormat::RGBX32;
1002#[cfg(target_endian = "big")]
1003#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1004pub const SDL_PIXELFORMAT_XRGB32: SDL_PixelFormat = SDL_PixelFormat::XRGB32;
1005#[cfg(target_endian = "big")]
1006#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1007pub const SDL_PIXELFORMAT_BGRX32: SDL_PixelFormat = SDL_PixelFormat::BGRX32;
1008#[cfg(target_endian = "big")]
1009#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1010pub const SDL_PIXELFORMAT_XBGR32: SDL_PixelFormat = SDL_PixelFormat::XBGR32;
1011#[cfg(not(target_endian = "big"))]
1012#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1013pub const SDL_PIXELFORMAT_RGBA32: SDL_PixelFormat = SDL_PixelFormat::RGBA32;
1014#[cfg(not(target_endian = "big"))]
1015#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1016pub const SDL_PIXELFORMAT_ARGB32: SDL_PixelFormat = SDL_PixelFormat::ARGB32;
1017#[cfg(not(target_endian = "big"))]
1018#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1019pub const SDL_PIXELFORMAT_BGRA32: SDL_PixelFormat = SDL_PixelFormat::BGRA32;
1020#[cfg(not(target_endian = "big"))]
1021#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1022pub const SDL_PIXELFORMAT_ABGR32: SDL_PixelFormat = SDL_PixelFormat::ABGR32;
1023#[cfg(not(target_endian = "big"))]
1024#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1025pub const SDL_PIXELFORMAT_RGBX32: SDL_PixelFormat = SDL_PixelFormat::RGBX32;
1026#[cfg(not(target_endian = "big"))]
1027#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1028pub const SDL_PIXELFORMAT_XRGB32: SDL_PixelFormat = SDL_PixelFormat::XRGB32;
1029#[cfg(not(target_endian = "big"))]
1030#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1031pub const SDL_PIXELFORMAT_BGRX32: SDL_PixelFormat = SDL_PixelFormat::BGRX32;
1032#[cfg(not(target_endian = "big"))]
1033#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
1034pub const SDL_PIXELFORMAT_XBGR32: SDL_PixelFormat = SDL_PixelFormat::XBGR32;
1035
1036#[cfg(feature = "metadata")]
1037impl sdl3_sys::metadata::GroupMetadata for SDL_PixelFormat {
1038    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1039        &crate::metadata::pixels::METADATA_SDL_PixelFormat;
1040}
1041
1042/// A macro for defining custom non-FourCC pixel formats.
1043///
1044/// For example, defining [`SDL_PIXELFORMAT_RGBA8888`] looks like this:
1045///
1046/// ```c
1047/// SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4)
1048/// ```
1049///
1050/// ## Parameters
1051/// - `type`: the type of the new format, probably a [`SDL_PixelType`] value.
1052/// - `order`: the order of the new format, probably a [`SDL_BitmapOrder`],
1053///   [`SDL_PackedOrder`], or [`SDL_ArrayOrder`] value.
1054/// - `layout`: the layout of the new format, probably an [`SDL_PackedLayout`]
1055///   value or zero.
1056/// - `bits`: the number of bits per pixel of the new format.
1057/// - `bytes`: the number of bytes per pixel of the new format.
1058///
1059/// ## Return value
1060/// Returns a format value in the style of [`SDL_PixelFormat`].
1061///
1062/// ## Thread safety
1063/// It is safe to call this macro from any thread.
1064///
1065/// ## Availability
1066/// This macro is available since SDL 3.2.0.
1067#[inline(always)]
1068pub const fn SDL_DEFINE_PIXELFORMAT(
1069    r#type: SDL_PixelType,
1070    order: ::core::ffi::c_int,
1071    layout: SDL_PackedLayout,
1072    bits: ::core::primitive::u8,
1073    bytes: ::core::primitive::u8,
1074) -> SDL_PixelFormat {
1075    SDL_PixelFormat(
1076        ((((((268435456_i32 | (r#type.0 << 24)) | (order << 20)) | (layout.0 << 16))
1077            | ((bits as ::core::ffi::c_int) << 8))
1078            | ((bytes as ::core::ffi::c_int) << 0)) as ::core::ffi::c_int),
1079    )
1080}
1081
1082/// A macro to retrieve the flags of an [`SDL_PixelFormat`].
1083///
1084/// This macro is generally not needed directly by an app, which should use
1085/// specific tests, like [`SDL_ISPIXELFORMAT_FOURCC`], instead.
1086///
1087/// ## Parameters
1088/// - `format`: an [`SDL_PixelFormat`] to check.
1089///
1090/// ## Return value
1091/// Returns the flags of `format`.
1092///
1093/// ## Thread safety
1094/// It is safe to call this macro from any thread.
1095///
1096/// ## Availability
1097/// This macro is available since SDL 3.2.0.
1098#[inline(always)]
1099pub const fn SDL_PIXELFLAG(format: SDL_PixelFormat) -> ::core::ffi::c_int {
1100    ((format.0 >> 28) & 15_i32)
1101}
1102
1103/// A macro to retrieve the type of an [`SDL_PixelFormat`].
1104///
1105/// This is usually a value from the [`SDL_PixelType`] enumeration.
1106///
1107/// ## Parameters
1108/// - `format`: an [`SDL_PixelFormat`] to check.
1109///
1110/// ## Return value
1111/// Returns the type of `format`.
1112///
1113/// ## Thread safety
1114/// It is safe to call this macro from any thread.
1115///
1116/// ## Availability
1117/// This macro is available since SDL 3.2.0.
1118#[inline(always)]
1119pub const fn SDL_PIXELTYPE(format: SDL_PixelFormat) -> SDL_PixelType {
1120    SDL_PixelType(((format.0 >> 24) & 15_i32))
1121}
1122
1123/// A macro to retrieve the order of an [`SDL_PixelFormat`].
1124///
1125/// This is usually a value from the [`SDL_BitmapOrder`], [`SDL_PackedOrder`], or
1126/// [`SDL_ArrayOrder`] enumerations, depending on the format type.
1127///
1128/// ## Parameters
1129/// - `format`: an [`SDL_PixelFormat`] to check.
1130///
1131/// ## Return value
1132/// Returns the order of `format`.
1133///
1134/// ## Thread safety
1135/// It is safe to call this macro from any thread.
1136///
1137/// ## Availability
1138/// This macro is available since SDL 3.2.0.
1139#[inline(always)]
1140pub const fn SDL_PIXELORDER(format: SDL_PixelFormat) -> ::core::ffi::c_int {
1141    ((format.0 >> 20) & 15_i32)
1142}
1143
1144/// A macro to retrieve the layout of an [`SDL_PixelFormat`].
1145///
1146/// This is usually a value from the [`SDL_PackedLayout`] enumeration, or zero if a
1147/// layout doesn't make sense for the format type.
1148///
1149/// ## Parameters
1150/// - `format`: an [`SDL_PixelFormat`] to check.
1151///
1152/// ## Return value
1153/// Returns the layout of `format`.
1154///
1155/// ## Thread safety
1156/// It is safe to call this macro from any thread.
1157///
1158/// ## Availability
1159/// This macro is available since SDL 3.2.0.
1160#[inline(always)]
1161pub const fn SDL_PIXELLAYOUT(format: SDL_PixelFormat) -> SDL_PackedLayout {
1162    SDL_PackedLayout(((format.0 >> 16) & 15_i32))
1163}
1164
1165/// A macro to determine if an [`SDL_PixelFormat`] is a "FourCC" format.
1166///
1167/// This covers custom and other unusual formats.
1168///
1169/// Note that this macro double-evaluates its parameter, so do not use
1170/// expressions with side-effects here.
1171///
1172/// ## Parameters
1173/// - `format`: an [`SDL_PixelFormat`] to check.
1174///
1175/// ## Return value
1176/// Returns true if the format has alpha, false otherwise.
1177///
1178/// ## Thread safety
1179/// It is safe to call this macro from any thread.
1180///
1181/// ## Availability
1182/// This macro is available since SDL 3.2.0.
1183#[inline(always)]
1184pub const fn SDL_ISPIXELFORMAT_FOURCC(format: SDL_PixelFormat) -> ::core::primitive::bool {
1185    ((format.0 != 0) && (SDL_PIXELFLAG(format) != 1_i32))
1186}
1187
1188/// A macro to determine an SDL_PixelFormat's bits per pixel.
1189///
1190/// Note that this macro double-evaluates its parameter, so do not use
1191/// expressions with side-effects here.
1192///
1193/// FourCC formats will report zero here, as it rarely makes sense to measure
1194/// them per-pixel.
1195///
1196/// ## Parameters
1197/// - `format`: an [`SDL_PixelFormat`] to check.
1198///
1199/// ## Return value
1200/// Returns the bits-per-pixel of `format`.
1201///
1202/// ## Thread safety
1203/// It is safe to call this macro from any thread.
1204///
1205/// ## Availability
1206/// This macro is available since SDL 3.2.0.
1207///
1208/// ## See also
1209/// - [`SDL_BYTESPERPIXEL`]
1210#[inline(always)]
1211pub const fn SDL_BITSPERPIXEL(format: SDL_PixelFormat) -> ::core::primitive::u8 {
1212    (if SDL_ISPIXELFORMAT_FOURCC(format) {
1213        0_i32
1214    } else {
1215        ((format.0 >> 8) & 255_i32)
1216    } as ::core::primitive::u8)
1217}
1218
1219/// A macro to determine if an [`SDL_PixelFormat`] is an indexed format.
1220///
1221/// Note that this macro double-evaluates its parameter, so do not use
1222/// expressions with side-effects here.
1223///
1224/// ## Parameters
1225/// - `format`: an [`SDL_PixelFormat`] to check.
1226///
1227/// ## Return value
1228/// Returns true if the format is indexed, false otherwise.
1229///
1230/// ## Thread safety
1231/// It is safe to call this macro from any thread.
1232///
1233/// ## Availability
1234/// This macro is available since SDL 3.2.0.
1235#[inline(always)]
1236pub const fn SDL_ISPIXELFORMAT_INDEXED(format: SDL_PixelFormat) -> ::core::primitive::bool {
1237    (!(SDL_ISPIXELFORMAT_FOURCC(format))
1238        && ((((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX1.0)
1239            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX2.0))
1240            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX4.0))
1241            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX8.0)))
1242}
1243
1244/// A macro to determine if an [`SDL_PixelFormat`] is a packed format.
1245///
1246/// Note that this macro double-evaluates its parameter, so do not use
1247/// expressions with side-effects here.
1248///
1249/// ## Parameters
1250/// - `format`: an [`SDL_PixelFormat`] to check.
1251///
1252/// ## Return value
1253/// Returns true if the format is packed, false otherwise.
1254///
1255/// ## Thread safety
1256/// It is safe to call this macro from any thread.
1257///
1258/// ## Availability
1259/// This macro is available since SDL 3.2.0.
1260#[inline(always)]
1261pub const fn SDL_ISPIXELFORMAT_PACKED(format: SDL_PixelFormat) -> ::core::primitive::bool {
1262    (!(SDL_ISPIXELFORMAT_FOURCC(format))
1263        && (((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED8.0)
1264            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED16.0))
1265            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED32.0)))
1266}
1267
1268/// A macro to determine if an [`SDL_PixelFormat`] is an array format.
1269///
1270/// Note that this macro double-evaluates its parameter, so do not use
1271/// expressions with side-effects here.
1272///
1273/// ## Parameters
1274/// - `format`: an [`SDL_PixelFormat`] to check.
1275///
1276/// ## Return value
1277/// Returns true if the format is an array, false otherwise.
1278///
1279/// ## Thread safety
1280/// It is safe to call this macro from any thread.
1281///
1282/// ## Availability
1283/// This macro is available since SDL 3.2.0.
1284#[inline(always)]
1285pub const fn SDL_ISPIXELFORMAT_ARRAY(format: SDL_PixelFormat) -> ::core::primitive::bool {
1286    (!(SDL_ISPIXELFORMAT_FOURCC(format))
1287        && (((((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU8.0)
1288            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU16.0))
1289            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU32.0))
1290            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF16.0))
1291            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF32.0)))
1292}
1293
1294/// A macro to determine if an [`SDL_PixelFormat`] is a floating point format.
1295///
1296/// Note that this macro double-evaluates its parameter, so do not use
1297/// expressions with side-effects here.
1298///
1299/// ## Parameters
1300/// - `format`: an [`SDL_PixelFormat`] to check.
1301///
1302/// ## Return value
1303/// Returns true if the format is a floating point, false otherwise.
1304///
1305/// ## Thread safety
1306/// It is safe to call this macro from any thread.
1307///
1308/// ## Availability
1309/// This macro is available since SDL 3.2.0.
1310#[inline(always)]
1311pub const fn SDL_ISPIXELFORMAT_FLOAT(format: SDL_PixelFormat) -> ::core::primitive::bool {
1312    (!(SDL_ISPIXELFORMAT_FOURCC(format))
1313        && ((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF16.0)
1314            || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF32.0)))
1315}
1316
1317/// A macro to determine if an [`SDL_PixelFormat`] has an alpha channel.
1318///
1319/// Note that this macro double-evaluates its parameter, so do not use
1320/// expressions with side-effects here.
1321///
1322/// ## Parameters
1323/// - `format`: an [`SDL_PixelFormat`] to check.
1324///
1325/// ## Return value
1326/// Returns true if the format has alpha, false otherwise.
1327///
1328/// ## Thread safety
1329/// It is safe to call this macro from any thread.
1330///
1331/// ## Availability
1332/// This macro is available since SDL 3.2.0.
1333#[inline(always)]
1334pub const fn SDL_ISPIXELFORMAT_ALPHA(format: SDL_PixelFormat) -> ::core::primitive::bool {
1335    ((SDL_ISPIXELFORMAT_PACKED(format)
1336        && ((((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB.0)
1337            || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA.0))
1338            || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR.0))
1339            || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA.0)))
1340        || (SDL_ISPIXELFORMAT_ARRAY(format)
1341            && ((((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB.0)
1342                || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA.0))
1343                || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR.0))
1344                || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA.0))))
1345}
1346
1347/// A macro to determine if an [`SDL_PixelFormat`] is a 10-bit format.
1348///
1349/// Note that this macro double-evaluates its parameter, so do not use
1350/// expressions with side-effects here.
1351///
1352/// ## Parameters
1353/// - `format`: an [`SDL_PixelFormat`] to check.
1354///
1355/// ## Return value
1356/// Returns true if the format is 10-bit, false otherwise.
1357///
1358/// ## Thread safety
1359/// It is safe to call this macro from any thread.
1360///
1361/// ## Availability
1362/// This macro is available since SDL 3.2.0.
1363#[inline(always)]
1364pub const fn SDL_ISPIXELFORMAT_10BIT(format: SDL_PixelFormat) -> ::core::primitive::bool {
1365    (!(SDL_ISPIXELFORMAT_FOURCC(format))
1366        && ((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED32.0)
1367            && (SDL_PIXELLAYOUT(format).0 == SDL_PACKEDLAYOUT_2101010.0)))
1368}
1369
1370/// A macro to determine an SDL_PixelFormat's bytes per pixel.
1371///
1372/// Note that this macro double-evaluates its parameter, so do not use
1373/// expressions with side-effects here.
1374///
1375/// FourCC formats do their best here, but many of them don't have a meaningful
1376/// measurement of bytes per pixel.
1377///
1378/// ## Parameters
1379/// - `format`: an [`SDL_PixelFormat`] to check.
1380///
1381/// ## Return value
1382/// Returns the bytes-per-pixel of `format`.
1383///
1384/// ## Thread safety
1385/// It is safe to call this macro from any thread.
1386///
1387/// ## Availability
1388/// This macro is available since SDL 3.2.0.
1389///
1390/// ## See also
1391/// - [`SDL_BITSPERPIXEL`]
1392#[inline(always)]
1393pub const fn SDL_BYTESPERPIXEL(format: SDL_PixelFormat) -> ::core::primitive::u8 {
1394    (if SDL_ISPIXELFORMAT_FOURCC(format) {
1395        if ((((format.0 == SDL_PIXELFORMAT_YUY2.0) || (format.0 == SDL_PIXELFORMAT_UYVY.0))
1396            || (format.0 == SDL_PIXELFORMAT_YVYU.0))
1397            || (format.0 == SDL_PIXELFORMAT_P010.0))
1398        {
1399            2
1400        } else {
1401            1
1402        }
1403    } else {
1404        ((format.0 >> 0) & 255_i32)
1405    } as ::core::primitive::u8)
1406}
1407
1408/// Colorspace color type.
1409///
1410/// ## Availability
1411/// This enum is available since SDL 3.2.0.
1412///
1413/// ## Known values (`sdl3-sys`)
1414/// | Associated constant | Global constant | Description |
1415/// | ------------------- | --------------- | ----------- |
1416/// | [`UNKNOWN`](SDL_ColorType::UNKNOWN) | [`SDL_COLOR_TYPE_UNKNOWN`] | |
1417/// | [`RGB`](SDL_ColorType::RGB) | [`SDL_COLOR_TYPE_RGB`] | |
1418/// | [`YCBCR`](SDL_ColorType::YCBCR) | [`SDL_COLOR_TYPE_YCBCR`] | |
1419#[repr(transparent)]
1420#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1421pub struct SDL_ColorType(pub ::core::ffi::c_uint);
1422
1423impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorType {
1424    #[inline(always)]
1425    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
1426        &self.0 == other
1427    }
1428}
1429
1430impl ::core::cmp::PartialEq<SDL_ColorType> for ::core::ffi::c_uint {
1431    #[inline(always)]
1432    fn eq(&self, other: &SDL_ColorType) -> bool {
1433        self == &other.0
1434    }
1435}
1436
1437impl From<SDL_ColorType> for ::core::ffi::c_uint {
1438    #[inline(always)]
1439    fn from(value: SDL_ColorType) -> Self {
1440        value.0
1441    }
1442}
1443
1444#[cfg(feature = "debug-impls")]
1445impl ::core::fmt::Debug for SDL_ColorType {
1446    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1447        #[allow(unreachable_patterns)]
1448        f.write_str(match *self {
1449            Self::UNKNOWN => "SDL_COLOR_TYPE_UNKNOWN",
1450            Self::RGB => "SDL_COLOR_TYPE_RGB",
1451            Self::YCBCR => "SDL_COLOR_TYPE_YCBCR",
1452
1453            _ => return write!(f, "SDL_ColorType({})", self.0),
1454        })
1455    }
1456}
1457
1458impl SDL_ColorType {
1459    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint));
1460    pub const RGB: Self = Self((1 as ::core::ffi::c_uint));
1461    pub const YCBCR: Self = Self((2 as ::core::ffi::c_uint));
1462}
1463
1464pub const SDL_COLOR_TYPE_UNKNOWN: SDL_ColorType = SDL_ColorType::UNKNOWN;
1465pub const SDL_COLOR_TYPE_RGB: SDL_ColorType = SDL_ColorType::RGB;
1466pub const SDL_COLOR_TYPE_YCBCR: SDL_ColorType = SDL_ColorType::YCBCR;
1467
1468#[cfg(feature = "metadata")]
1469impl sdl3_sys::metadata::GroupMetadata for SDL_ColorType {
1470    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1471        &crate::metadata::pixels::METADATA_SDL_ColorType;
1472}
1473
1474/// Colorspace color range, as described by
1475/// <https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en>
1476///
1477/// ## Availability
1478/// This enum is available since SDL 3.2.0.
1479///
1480/// ## Known values (`sdl3-sys`)
1481/// | Associated constant | Global constant | Description |
1482/// | ------------------- | --------------- | ----------- |
1483/// | [`UNKNOWN`](SDL_ColorRange::UNKNOWN) | [`SDL_COLOR_RANGE_UNKNOWN`] | |
1484/// | [`LIMITED`](SDL_ColorRange::LIMITED) | [`SDL_COLOR_RANGE_LIMITED`] | Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma |
1485/// | [`FULL`](SDL_ColorRange::FULL) | [`SDL_COLOR_RANGE_FULL`] | Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma |
1486#[repr(transparent)]
1487#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1488pub struct SDL_ColorRange(pub ::core::ffi::c_uint);
1489
1490impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorRange {
1491    #[inline(always)]
1492    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
1493        &self.0 == other
1494    }
1495}
1496
1497impl ::core::cmp::PartialEq<SDL_ColorRange> for ::core::ffi::c_uint {
1498    #[inline(always)]
1499    fn eq(&self, other: &SDL_ColorRange) -> bool {
1500        self == &other.0
1501    }
1502}
1503
1504impl From<SDL_ColorRange> for ::core::ffi::c_uint {
1505    #[inline(always)]
1506    fn from(value: SDL_ColorRange) -> Self {
1507        value.0
1508    }
1509}
1510
1511#[cfg(feature = "debug-impls")]
1512impl ::core::fmt::Debug for SDL_ColorRange {
1513    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1514        #[allow(unreachable_patterns)]
1515        f.write_str(match *self {
1516            Self::UNKNOWN => "SDL_COLOR_RANGE_UNKNOWN",
1517            Self::LIMITED => "SDL_COLOR_RANGE_LIMITED",
1518            Self::FULL => "SDL_COLOR_RANGE_FULL",
1519
1520            _ => return write!(f, "SDL_ColorRange({})", self.0),
1521        })
1522    }
1523}
1524
1525impl SDL_ColorRange {
1526    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint));
1527    /// Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma
1528    pub const LIMITED: Self = Self((1 as ::core::ffi::c_uint));
1529    /// Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma
1530    pub const FULL: Self = Self((2 as ::core::ffi::c_uint));
1531}
1532
1533pub const SDL_COLOR_RANGE_UNKNOWN: SDL_ColorRange = SDL_ColorRange::UNKNOWN;
1534/// Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma
1535pub const SDL_COLOR_RANGE_LIMITED: SDL_ColorRange = SDL_ColorRange::LIMITED;
1536/// Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma
1537pub const SDL_COLOR_RANGE_FULL: SDL_ColorRange = SDL_ColorRange::FULL;
1538
1539#[cfg(feature = "metadata")]
1540impl sdl3_sys::metadata::GroupMetadata for SDL_ColorRange {
1541    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1542        &crate::metadata::pixels::METADATA_SDL_ColorRange;
1543}
1544
1545/// Colorspace color primaries, as described by
1546/// <https://www.itu.int/rec/T-REC-H.273-201612-S/en>
1547///
1548/// ## Availability
1549/// This enum is available since SDL 3.2.0.
1550///
1551/// ## Known values (`sdl3-sys`)
1552/// | Associated constant | Global constant | Description |
1553/// | ------------------- | --------------- | ----------- |
1554/// | [`UNKNOWN`](SDL_ColorPrimaries::UNKNOWN) | [`SDL_COLOR_PRIMARIES_UNKNOWN`] | |
1555/// | [`BT709`](SDL_ColorPrimaries::BT709) | [`SDL_COLOR_PRIMARIES_BT709`] | ITU-R BT.709-6 |
1556/// | [`UNSPECIFIED`](SDL_ColorPrimaries::UNSPECIFIED) | [`SDL_COLOR_PRIMARIES_UNSPECIFIED`] | |
1557/// | [`BT470M`](SDL_ColorPrimaries::BT470M) | [`SDL_COLOR_PRIMARIES_BT470M`] | ITU-R BT.470-6 System M |
1558/// | [`BT470BG`](SDL_ColorPrimaries::BT470BG) | [`SDL_COLOR_PRIMARIES_BT470BG`] | ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 |
1559/// | [`BT601`](SDL_ColorPrimaries::BT601) | [`SDL_COLOR_PRIMARIES_BT601`] | ITU-R BT.601-7 525, SMPTE 170M |
1560/// | [`SMPTE240`](SDL_ColorPrimaries::SMPTE240) | [`SDL_COLOR_PRIMARIES_SMPTE240`] | SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`] |
1561/// | [`GENERIC_FILM`](SDL_ColorPrimaries::GENERIC_FILM) | [`SDL_COLOR_PRIMARIES_GENERIC_FILM`] | Generic film (color filters using Illuminant C) |
1562/// | [`BT2020`](SDL_ColorPrimaries::BT2020) | [`SDL_COLOR_PRIMARIES_BT2020`] | ITU-R BT.2020-2 / ITU-R BT.2100-0 |
1563/// | [`XYZ`](SDL_ColorPrimaries::XYZ) | [`SDL_COLOR_PRIMARIES_XYZ`] | SMPTE ST 428-1 |
1564/// | [`SMPTE431`](SDL_ColorPrimaries::SMPTE431) | [`SDL_COLOR_PRIMARIES_SMPTE431`] | SMPTE RP 431-2 |
1565/// | [`SMPTE432`](SDL_ColorPrimaries::SMPTE432) | [`SDL_COLOR_PRIMARIES_SMPTE432`] | SMPTE EG 432-1 / DCI P3 |
1566/// | [`EBU3213`](SDL_ColorPrimaries::EBU3213) | [`SDL_COLOR_PRIMARIES_EBU3213`] | EBU Tech. 3213-E |
1567/// | [`CUSTOM`](SDL_ColorPrimaries::CUSTOM) | [`SDL_COLOR_PRIMARIES_CUSTOM`] | |
1568#[repr(transparent)]
1569#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1570pub struct SDL_ColorPrimaries(pub ::core::ffi::c_uint);
1571
1572impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorPrimaries {
1573    #[inline(always)]
1574    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
1575        &self.0 == other
1576    }
1577}
1578
1579impl ::core::cmp::PartialEq<SDL_ColorPrimaries> for ::core::ffi::c_uint {
1580    #[inline(always)]
1581    fn eq(&self, other: &SDL_ColorPrimaries) -> bool {
1582        self == &other.0
1583    }
1584}
1585
1586impl From<SDL_ColorPrimaries> for ::core::ffi::c_uint {
1587    #[inline(always)]
1588    fn from(value: SDL_ColorPrimaries) -> Self {
1589        value.0
1590    }
1591}
1592
1593#[cfg(feature = "debug-impls")]
1594impl ::core::fmt::Debug for SDL_ColorPrimaries {
1595    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1596        #[allow(unreachable_patterns)]
1597        f.write_str(match *self {
1598            Self::UNKNOWN => "SDL_COLOR_PRIMARIES_UNKNOWN",
1599            Self::BT709 => "SDL_COLOR_PRIMARIES_BT709",
1600            Self::UNSPECIFIED => "SDL_COLOR_PRIMARIES_UNSPECIFIED",
1601            Self::BT470M => "SDL_COLOR_PRIMARIES_BT470M",
1602            Self::BT470BG => "SDL_COLOR_PRIMARIES_BT470BG",
1603            Self::BT601 => "SDL_COLOR_PRIMARIES_BT601",
1604            Self::SMPTE240 => "SDL_COLOR_PRIMARIES_SMPTE240",
1605            Self::GENERIC_FILM => "SDL_COLOR_PRIMARIES_GENERIC_FILM",
1606            Self::BT2020 => "SDL_COLOR_PRIMARIES_BT2020",
1607            Self::XYZ => "SDL_COLOR_PRIMARIES_XYZ",
1608            Self::SMPTE431 => "SDL_COLOR_PRIMARIES_SMPTE431",
1609            Self::SMPTE432 => "SDL_COLOR_PRIMARIES_SMPTE432",
1610            Self::EBU3213 => "SDL_COLOR_PRIMARIES_EBU3213",
1611            Self::CUSTOM => "SDL_COLOR_PRIMARIES_CUSTOM",
1612
1613            _ => return write!(f, "SDL_ColorPrimaries({})", self.0),
1614        })
1615    }
1616}
1617
1618impl SDL_ColorPrimaries {
1619    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint));
1620    /// ITU-R BT.709-6
1621    pub const BT709: Self = Self((1 as ::core::ffi::c_uint));
1622    pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint));
1623    /// ITU-R BT.470-6 System M
1624    pub const BT470M: Self = Self((4 as ::core::ffi::c_uint));
1625    /// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625
1626    pub const BT470BG: Self = Self((5 as ::core::ffi::c_uint));
1627    /// ITU-R BT.601-7 525, SMPTE 170M
1628    pub const BT601: Self = Self((6 as ::core::ffi::c_uint));
1629    /// SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`]
1630    pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint));
1631    /// Generic film (color filters using Illuminant C)
1632    pub const GENERIC_FILM: Self = Self((8 as ::core::ffi::c_uint));
1633    /// ITU-R BT.2020-2 / ITU-R BT.2100-0
1634    pub const BT2020: Self = Self((9 as ::core::ffi::c_uint));
1635    /// SMPTE ST 428-1
1636    pub const XYZ: Self = Self((10 as ::core::ffi::c_uint));
1637    /// SMPTE RP 431-2
1638    pub const SMPTE431: Self = Self((11 as ::core::ffi::c_uint));
1639    /// SMPTE EG 432-1 / DCI P3
1640    pub const SMPTE432: Self = Self((12 as ::core::ffi::c_uint));
1641    /// EBU Tech. 3213-E
1642    pub const EBU3213: Self = Self((22 as ::core::ffi::c_uint));
1643    pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint));
1644}
1645
1646pub const SDL_COLOR_PRIMARIES_UNKNOWN: SDL_ColorPrimaries = SDL_ColorPrimaries::UNKNOWN;
1647/// ITU-R BT.709-6
1648pub const SDL_COLOR_PRIMARIES_BT709: SDL_ColorPrimaries = SDL_ColorPrimaries::BT709;
1649pub const SDL_COLOR_PRIMARIES_UNSPECIFIED: SDL_ColorPrimaries = SDL_ColorPrimaries::UNSPECIFIED;
1650/// ITU-R BT.470-6 System M
1651pub const SDL_COLOR_PRIMARIES_BT470M: SDL_ColorPrimaries = SDL_ColorPrimaries::BT470M;
1652/// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625
1653pub const SDL_COLOR_PRIMARIES_BT470BG: SDL_ColorPrimaries = SDL_ColorPrimaries::BT470BG;
1654/// ITU-R BT.601-7 525, SMPTE 170M
1655pub const SDL_COLOR_PRIMARIES_BT601: SDL_ColorPrimaries = SDL_ColorPrimaries::BT601;
1656/// SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`]
1657pub const SDL_COLOR_PRIMARIES_SMPTE240: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE240;
1658/// Generic film (color filters using Illuminant C)
1659pub const SDL_COLOR_PRIMARIES_GENERIC_FILM: SDL_ColorPrimaries = SDL_ColorPrimaries::GENERIC_FILM;
1660/// ITU-R BT.2020-2 / ITU-R BT.2100-0
1661pub const SDL_COLOR_PRIMARIES_BT2020: SDL_ColorPrimaries = SDL_ColorPrimaries::BT2020;
1662/// SMPTE ST 428-1
1663pub const SDL_COLOR_PRIMARIES_XYZ: SDL_ColorPrimaries = SDL_ColorPrimaries::XYZ;
1664/// SMPTE RP 431-2
1665pub const SDL_COLOR_PRIMARIES_SMPTE431: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE431;
1666/// SMPTE EG 432-1 / DCI P3
1667pub const SDL_COLOR_PRIMARIES_SMPTE432: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE432;
1668/// EBU Tech. 3213-E
1669pub const SDL_COLOR_PRIMARIES_EBU3213: SDL_ColorPrimaries = SDL_ColorPrimaries::EBU3213;
1670pub const SDL_COLOR_PRIMARIES_CUSTOM: SDL_ColorPrimaries = SDL_ColorPrimaries::CUSTOM;
1671
1672#[cfg(feature = "metadata")]
1673impl sdl3_sys::metadata::GroupMetadata for SDL_ColorPrimaries {
1674    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1675        &crate::metadata::pixels::METADATA_SDL_ColorPrimaries;
1676}
1677
1678/// Colorspace transfer characteristics.
1679///
1680/// These are as described by <https://www.itu.int/rec/T-REC-H.273-201612-S/en>
1681///
1682/// ## Availability
1683/// This enum is available since SDL 3.2.0.
1684///
1685/// ## Known values (`sdl3-sys`)
1686/// | Associated constant | Global constant | Description |
1687/// | ------------------- | --------------- | ----------- |
1688/// | [`UNKNOWN`](SDL_TransferCharacteristics::UNKNOWN) | [`SDL_TRANSFER_CHARACTERISTICS_UNKNOWN`] | |
1689/// | [`BT709`](SDL_TransferCharacteristics::BT709) | [`SDL_TRANSFER_CHARACTERISTICS_BT709`] | Rec. ITU-R BT.709-6 / ITU-R BT1361 |
1690/// | [`UNSPECIFIED`](SDL_TransferCharacteristics::UNSPECIFIED) | [`SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED`] | |
1691/// | [`GAMMA22`](SDL_TransferCharacteristics::GAMMA22) | [`SDL_TRANSFER_CHARACTERISTICS_GAMMA22`] | ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM |
1692/// | [`GAMMA28`](SDL_TransferCharacteristics::GAMMA28) | [`SDL_TRANSFER_CHARACTERISTICS_GAMMA28`] | ITU-R BT.470-6 System B, G |
1693/// | [`BT601`](SDL_TransferCharacteristics::BT601) | [`SDL_TRANSFER_CHARACTERISTICS_BT601`] | SMPTE ST 170M / ITU-R BT.601-7 525 or 625 |
1694/// | [`SMPTE240`](SDL_TransferCharacteristics::SMPTE240) | [`SDL_TRANSFER_CHARACTERISTICS_SMPTE240`] | SMPTE ST 240M |
1695/// | [`LINEAR`](SDL_TransferCharacteristics::LINEAR) | [`SDL_TRANSFER_CHARACTERISTICS_LINEAR`] | |
1696/// | [`LOG100`](SDL_TransferCharacteristics::LOG100) | [`SDL_TRANSFER_CHARACTERISTICS_LOG100`] | |
1697/// | [`LOG100_SQRT10`](SDL_TransferCharacteristics::LOG100_SQRT10) | [`SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10`] | |
1698/// | [`IEC61966`](SDL_TransferCharacteristics::IEC61966) | [`SDL_TRANSFER_CHARACTERISTICS_IEC61966`] | IEC 61966-2-4 |
1699/// | [`BT1361`](SDL_TransferCharacteristics::BT1361) | [`SDL_TRANSFER_CHARACTERISTICS_BT1361`] | ITU-R BT1361 Extended Colour Gamut |
1700/// | [`SRGB`](SDL_TransferCharacteristics::SRGB) | [`SDL_TRANSFER_CHARACTERISTICS_SRGB`] | IEC 61966-2-1 (sRGB or sYCC) |
1701/// | [`BT2020_10BIT`](SDL_TransferCharacteristics::BT2020_10BIT) | [`SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT`] | ITU-R BT2020 for 10-bit system |
1702/// | [`BT2020_12BIT`](SDL_TransferCharacteristics::BT2020_12BIT) | [`SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT`] | ITU-R BT2020 for 12-bit system |
1703/// | [`PQ`](SDL_TransferCharacteristics::PQ) | [`SDL_TRANSFER_CHARACTERISTICS_PQ`] | SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems |
1704/// | [`SMPTE428`](SDL_TransferCharacteristics::SMPTE428) | [`SDL_TRANSFER_CHARACTERISTICS_SMPTE428`] | SMPTE ST 428-1 |
1705/// | [`HLG`](SDL_TransferCharacteristics::HLG) | [`SDL_TRANSFER_CHARACTERISTICS_HLG`] | ARIB STD-B67, known as "hybrid log-gamma" (HLG) |
1706/// | [`CUSTOM`](SDL_TransferCharacteristics::CUSTOM) | [`SDL_TRANSFER_CHARACTERISTICS_CUSTOM`] | |
1707#[repr(transparent)]
1708#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1709pub struct SDL_TransferCharacteristics(pub ::core::ffi::c_uint);
1710
1711impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_TransferCharacteristics {
1712    #[inline(always)]
1713    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
1714        &self.0 == other
1715    }
1716}
1717
1718impl ::core::cmp::PartialEq<SDL_TransferCharacteristics> for ::core::ffi::c_uint {
1719    #[inline(always)]
1720    fn eq(&self, other: &SDL_TransferCharacteristics) -> bool {
1721        self == &other.0
1722    }
1723}
1724
1725impl From<SDL_TransferCharacteristics> for ::core::ffi::c_uint {
1726    #[inline(always)]
1727    fn from(value: SDL_TransferCharacteristics) -> Self {
1728        value.0
1729    }
1730}
1731
1732#[cfg(feature = "debug-impls")]
1733impl ::core::fmt::Debug for SDL_TransferCharacteristics {
1734    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1735        #[allow(unreachable_patterns)]
1736        f.write_str(match *self {
1737            Self::UNKNOWN => "SDL_TRANSFER_CHARACTERISTICS_UNKNOWN",
1738            Self::BT709 => "SDL_TRANSFER_CHARACTERISTICS_BT709",
1739            Self::UNSPECIFIED => "SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED",
1740            Self::GAMMA22 => "SDL_TRANSFER_CHARACTERISTICS_GAMMA22",
1741            Self::GAMMA28 => "SDL_TRANSFER_CHARACTERISTICS_GAMMA28",
1742            Self::BT601 => "SDL_TRANSFER_CHARACTERISTICS_BT601",
1743            Self::SMPTE240 => "SDL_TRANSFER_CHARACTERISTICS_SMPTE240",
1744            Self::LINEAR => "SDL_TRANSFER_CHARACTERISTICS_LINEAR",
1745            Self::LOG100 => "SDL_TRANSFER_CHARACTERISTICS_LOG100",
1746            Self::LOG100_SQRT10 => "SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10",
1747            Self::IEC61966 => "SDL_TRANSFER_CHARACTERISTICS_IEC61966",
1748            Self::BT1361 => "SDL_TRANSFER_CHARACTERISTICS_BT1361",
1749            Self::SRGB => "SDL_TRANSFER_CHARACTERISTICS_SRGB",
1750            Self::BT2020_10BIT => "SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT",
1751            Self::BT2020_12BIT => "SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT",
1752            Self::PQ => "SDL_TRANSFER_CHARACTERISTICS_PQ",
1753            Self::SMPTE428 => "SDL_TRANSFER_CHARACTERISTICS_SMPTE428",
1754            Self::HLG => "SDL_TRANSFER_CHARACTERISTICS_HLG",
1755            Self::CUSTOM => "SDL_TRANSFER_CHARACTERISTICS_CUSTOM",
1756
1757            _ => return write!(f, "SDL_TransferCharacteristics({})", self.0),
1758        })
1759    }
1760}
1761
1762impl SDL_TransferCharacteristics {
1763    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint));
1764    /// Rec. ITU-R BT.709-6 / ITU-R BT1361
1765    pub const BT709: Self = Self((1 as ::core::ffi::c_uint));
1766    pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint));
1767    /// ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM
1768    pub const GAMMA22: Self = Self((4 as ::core::ffi::c_uint));
1769    /// ITU-R BT.470-6 System B, G
1770    pub const GAMMA28: Self = Self((5 as ::core::ffi::c_uint));
1771    /// SMPTE ST 170M / ITU-R BT.601-7 525 or 625
1772    pub const BT601: Self = Self((6 as ::core::ffi::c_uint));
1773    /// SMPTE ST 240M
1774    pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint));
1775    pub const LINEAR: Self = Self((8 as ::core::ffi::c_uint));
1776    pub const LOG100: Self = Self((9 as ::core::ffi::c_uint));
1777    pub const LOG100_SQRT10: Self = Self((10 as ::core::ffi::c_uint));
1778    /// IEC 61966-2-4
1779    pub const IEC61966: Self = Self((11 as ::core::ffi::c_uint));
1780    /// ITU-R BT1361 Extended Colour Gamut
1781    pub const BT1361: Self = Self((12 as ::core::ffi::c_uint));
1782    /// IEC 61966-2-1 (sRGB or sYCC)
1783    pub const SRGB: Self = Self((13 as ::core::ffi::c_uint));
1784    /// ITU-R BT2020 for 10-bit system
1785    pub const BT2020_10BIT: Self = Self((14 as ::core::ffi::c_uint));
1786    /// ITU-R BT2020 for 12-bit system
1787    pub const BT2020_12BIT: Self = Self((15 as ::core::ffi::c_uint));
1788    /// SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
1789    pub const PQ: Self = Self((16 as ::core::ffi::c_uint));
1790    /// SMPTE ST 428-1
1791    pub const SMPTE428: Self = Self((17 as ::core::ffi::c_uint));
1792    /// ARIB STD-B67, known as "hybrid log-gamma" (HLG)
1793    pub const HLG: Self = Self((18 as ::core::ffi::c_uint));
1794    pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint));
1795}
1796
1797pub const SDL_TRANSFER_CHARACTERISTICS_UNKNOWN: SDL_TransferCharacteristics =
1798    SDL_TransferCharacteristics::UNKNOWN;
1799/// Rec. ITU-R BT.709-6 / ITU-R BT1361
1800pub const SDL_TRANSFER_CHARACTERISTICS_BT709: SDL_TransferCharacteristics =
1801    SDL_TransferCharacteristics::BT709;
1802pub const SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED: SDL_TransferCharacteristics =
1803    SDL_TransferCharacteristics::UNSPECIFIED;
1804/// ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM
1805pub const SDL_TRANSFER_CHARACTERISTICS_GAMMA22: SDL_TransferCharacteristics =
1806    SDL_TransferCharacteristics::GAMMA22;
1807/// ITU-R BT.470-6 System B, G
1808pub const SDL_TRANSFER_CHARACTERISTICS_GAMMA28: SDL_TransferCharacteristics =
1809    SDL_TransferCharacteristics::GAMMA28;
1810/// SMPTE ST 170M / ITU-R BT.601-7 525 or 625
1811pub const SDL_TRANSFER_CHARACTERISTICS_BT601: SDL_TransferCharacteristics =
1812    SDL_TransferCharacteristics::BT601;
1813/// SMPTE ST 240M
1814pub const SDL_TRANSFER_CHARACTERISTICS_SMPTE240: SDL_TransferCharacteristics =
1815    SDL_TransferCharacteristics::SMPTE240;
1816pub const SDL_TRANSFER_CHARACTERISTICS_LINEAR: SDL_TransferCharacteristics =
1817    SDL_TransferCharacteristics::LINEAR;
1818pub const SDL_TRANSFER_CHARACTERISTICS_LOG100: SDL_TransferCharacteristics =
1819    SDL_TransferCharacteristics::LOG100;
1820pub const SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10: SDL_TransferCharacteristics =
1821    SDL_TransferCharacteristics::LOG100_SQRT10;
1822/// IEC 61966-2-4
1823pub const SDL_TRANSFER_CHARACTERISTICS_IEC61966: SDL_TransferCharacteristics =
1824    SDL_TransferCharacteristics::IEC61966;
1825/// ITU-R BT1361 Extended Colour Gamut
1826pub const SDL_TRANSFER_CHARACTERISTICS_BT1361: SDL_TransferCharacteristics =
1827    SDL_TransferCharacteristics::BT1361;
1828/// IEC 61966-2-1 (sRGB or sYCC)
1829pub const SDL_TRANSFER_CHARACTERISTICS_SRGB: SDL_TransferCharacteristics =
1830    SDL_TransferCharacteristics::SRGB;
1831/// ITU-R BT2020 for 10-bit system
1832pub const SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT: SDL_TransferCharacteristics =
1833    SDL_TransferCharacteristics::BT2020_10BIT;
1834/// ITU-R BT2020 for 12-bit system
1835pub const SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT: SDL_TransferCharacteristics =
1836    SDL_TransferCharacteristics::BT2020_12BIT;
1837/// SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
1838pub const SDL_TRANSFER_CHARACTERISTICS_PQ: SDL_TransferCharacteristics =
1839    SDL_TransferCharacteristics::PQ;
1840/// SMPTE ST 428-1
1841pub const SDL_TRANSFER_CHARACTERISTICS_SMPTE428: SDL_TransferCharacteristics =
1842    SDL_TransferCharacteristics::SMPTE428;
1843/// ARIB STD-B67, known as "hybrid log-gamma" (HLG)
1844pub const SDL_TRANSFER_CHARACTERISTICS_HLG: SDL_TransferCharacteristics =
1845    SDL_TransferCharacteristics::HLG;
1846pub const SDL_TRANSFER_CHARACTERISTICS_CUSTOM: SDL_TransferCharacteristics =
1847    SDL_TransferCharacteristics::CUSTOM;
1848
1849#[cfg(feature = "metadata")]
1850impl sdl3_sys::metadata::GroupMetadata for SDL_TransferCharacteristics {
1851    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1852        &crate::metadata::pixels::METADATA_SDL_TransferCharacteristics;
1853}
1854
1855/// Colorspace matrix coefficients.
1856///
1857/// These are as described by <https://www.itu.int/rec/T-REC-H.273-201612-S/en>
1858///
1859/// ## Availability
1860/// This enum is available since SDL 3.2.0.
1861///
1862/// ## Known values (`sdl3-sys`)
1863/// | Associated constant | Global constant | Description |
1864/// | ------------------- | --------------- | ----------- |
1865/// | [`IDENTITY`](SDL_MatrixCoefficients::IDENTITY) | [`SDL_MATRIX_COEFFICIENTS_IDENTITY`] | |
1866/// | [`BT709`](SDL_MatrixCoefficients::BT709) | [`SDL_MATRIX_COEFFICIENTS_BT709`] | ITU-R BT.709-6 |
1867/// | [`UNSPECIFIED`](SDL_MatrixCoefficients::UNSPECIFIED) | [`SDL_MATRIX_COEFFICIENTS_UNSPECIFIED`] | |
1868/// | [`FCC`](SDL_MatrixCoefficients::FCC) | [`SDL_MATRIX_COEFFICIENTS_FCC`] | US FCC Title 47 |
1869/// | [`BT470BG`](SDL_MatrixCoefficients::BT470BG) | [`SDL_MATRIX_COEFFICIENTS_BT470BG`] | ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`] |
1870/// | [`BT601`](SDL_MatrixCoefficients::BT601) | [`SDL_MATRIX_COEFFICIENTS_BT601`] | ITU-R BT.601-7 525 |
1871/// | [`SMPTE240`](SDL_MatrixCoefficients::SMPTE240) | [`SDL_MATRIX_COEFFICIENTS_SMPTE240`] | SMPTE 240M |
1872/// | [`YCGCO`](SDL_MatrixCoefficients::YCGCO) | [`SDL_MATRIX_COEFFICIENTS_YCGCO`] | |
1873/// | [`BT2020_NCL`](SDL_MatrixCoefficients::BT2020_NCL) | [`SDL_MATRIX_COEFFICIENTS_BT2020_NCL`] | ITU-R BT.2020-2 non-constant luminance |
1874/// | [`BT2020_CL`](SDL_MatrixCoefficients::BT2020_CL) | [`SDL_MATRIX_COEFFICIENTS_BT2020_CL`] | ITU-R BT.2020-2 constant luminance |
1875/// | [`SMPTE2085`](SDL_MatrixCoefficients::SMPTE2085) | [`SDL_MATRIX_COEFFICIENTS_SMPTE2085`] | SMPTE ST 2085 |
1876/// | [`CHROMA_DERIVED_NCL`](SDL_MatrixCoefficients::CHROMA_DERIVED_NCL) | [`SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL`] | |
1877/// | [`CHROMA_DERIVED_CL`](SDL_MatrixCoefficients::CHROMA_DERIVED_CL) | [`SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL`] | |
1878/// | [`ICTCP`](SDL_MatrixCoefficients::ICTCP) | [`SDL_MATRIX_COEFFICIENTS_ICTCP`] | ITU-R BT.2100-0 ICTCP |
1879/// | [`CUSTOM`](SDL_MatrixCoefficients::CUSTOM) | [`SDL_MATRIX_COEFFICIENTS_CUSTOM`] | |
1880#[repr(transparent)]
1881#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1882pub struct SDL_MatrixCoefficients(pub ::core::ffi::c_uint);
1883
1884impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_MatrixCoefficients {
1885    #[inline(always)]
1886    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
1887        &self.0 == other
1888    }
1889}
1890
1891impl ::core::cmp::PartialEq<SDL_MatrixCoefficients> for ::core::ffi::c_uint {
1892    #[inline(always)]
1893    fn eq(&self, other: &SDL_MatrixCoefficients) -> bool {
1894        self == &other.0
1895    }
1896}
1897
1898impl From<SDL_MatrixCoefficients> for ::core::ffi::c_uint {
1899    #[inline(always)]
1900    fn from(value: SDL_MatrixCoefficients) -> Self {
1901        value.0
1902    }
1903}
1904
1905#[cfg(feature = "debug-impls")]
1906impl ::core::fmt::Debug for SDL_MatrixCoefficients {
1907    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1908        #[allow(unreachable_patterns)]
1909        f.write_str(match *self {
1910            Self::IDENTITY => "SDL_MATRIX_COEFFICIENTS_IDENTITY",
1911            Self::BT709 => "SDL_MATRIX_COEFFICIENTS_BT709",
1912            Self::UNSPECIFIED => "SDL_MATRIX_COEFFICIENTS_UNSPECIFIED",
1913            Self::FCC => "SDL_MATRIX_COEFFICIENTS_FCC",
1914            Self::BT470BG => "SDL_MATRIX_COEFFICIENTS_BT470BG",
1915            Self::BT601 => "SDL_MATRIX_COEFFICIENTS_BT601",
1916            Self::SMPTE240 => "SDL_MATRIX_COEFFICIENTS_SMPTE240",
1917            Self::YCGCO => "SDL_MATRIX_COEFFICIENTS_YCGCO",
1918            Self::BT2020_NCL => "SDL_MATRIX_COEFFICIENTS_BT2020_NCL",
1919            Self::BT2020_CL => "SDL_MATRIX_COEFFICIENTS_BT2020_CL",
1920            Self::SMPTE2085 => "SDL_MATRIX_COEFFICIENTS_SMPTE2085",
1921            Self::CHROMA_DERIVED_NCL => "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL",
1922            Self::CHROMA_DERIVED_CL => "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL",
1923            Self::ICTCP => "SDL_MATRIX_COEFFICIENTS_ICTCP",
1924            Self::CUSTOM => "SDL_MATRIX_COEFFICIENTS_CUSTOM",
1925
1926            _ => return write!(f, "SDL_MatrixCoefficients({})", self.0),
1927        })
1928    }
1929}
1930
1931impl SDL_MatrixCoefficients {
1932    pub const IDENTITY: Self = Self((0 as ::core::ffi::c_uint));
1933    /// ITU-R BT.709-6
1934    pub const BT709: Self = Self((1 as ::core::ffi::c_uint));
1935    pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint));
1936    /// US FCC Title 47
1937    pub const FCC: Self = Self((4 as ::core::ffi::c_uint));
1938    /// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`]
1939    pub const BT470BG: Self = Self((5 as ::core::ffi::c_uint));
1940    /// ITU-R BT.601-7 525
1941    pub const BT601: Self = Self((6 as ::core::ffi::c_uint));
1942    /// SMPTE 240M
1943    pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint));
1944    pub const YCGCO: Self = Self((8 as ::core::ffi::c_uint));
1945    /// ITU-R BT.2020-2 non-constant luminance
1946    pub const BT2020_NCL: Self = Self((9 as ::core::ffi::c_uint));
1947    /// ITU-R BT.2020-2 constant luminance
1948    pub const BT2020_CL: Self = Self((10 as ::core::ffi::c_uint));
1949    /// SMPTE ST 2085
1950    pub const SMPTE2085: Self = Self((11 as ::core::ffi::c_uint));
1951    pub const CHROMA_DERIVED_NCL: Self = Self((12 as ::core::ffi::c_uint));
1952    pub const CHROMA_DERIVED_CL: Self = Self((13 as ::core::ffi::c_uint));
1953    /// ITU-R BT.2100-0 ICTCP
1954    pub const ICTCP: Self = Self((14 as ::core::ffi::c_uint));
1955    pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint));
1956}
1957
1958pub const SDL_MATRIX_COEFFICIENTS_IDENTITY: SDL_MatrixCoefficients =
1959    SDL_MatrixCoefficients::IDENTITY;
1960/// ITU-R BT.709-6
1961pub const SDL_MATRIX_COEFFICIENTS_BT709: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT709;
1962pub const SDL_MATRIX_COEFFICIENTS_UNSPECIFIED: SDL_MatrixCoefficients =
1963    SDL_MatrixCoefficients::UNSPECIFIED;
1964/// US FCC Title 47
1965pub const SDL_MATRIX_COEFFICIENTS_FCC: SDL_MatrixCoefficients = SDL_MatrixCoefficients::FCC;
1966/// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`]
1967pub const SDL_MATRIX_COEFFICIENTS_BT470BG: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT470BG;
1968/// ITU-R BT.601-7 525
1969pub const SDL_MATRIX_COEFFICIENTS_BT601: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT601;
1970/// SMPTE 240M
1971pub const SDL_MATRIX_COEFFICIENTS_SMPTE240: SDL_MatrixCoefficients =
1972    SDL_MatrixCoefficients::SMPTE240;
1973pub const SDL_MATRIX_COEFFICIENTS_YCGCO: SDL_MatrixCoefficients = SDL_MatrixCoefficients::YCGCO;
1974/// ITU-R BT.2020-2 non-constant luminance
1975pub const SDL_MATRIX_COEFFICIENTS_BT2020_NCL: SDL_MatrixCoefficients =
1976    SDL_MatrixCoefficients::BT2020_NCL;
1977/// ITU-R BT.2020-2 constant luminance
1978pub const SDL_MATRIX_COEFFICIENTS_BT2020_CL: SDL_MatrixCoefficients =
1979    SDL_MatrixCoefficients::BT2020_CL;
1980/// SMPTE ST 2085
1981pub const SDL_MATRIX_COEFFICIENTS_SMPTE2085: SDL_MatrixCoefficients =
1982    SDL_MatrixCoefficients::SMPTE2085;
1983pub const SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: SDL_MatrixCoefficients =
1984    SDL_MatrixCoefficients::CHROMA_DERIVED_NCL;
1985pub const SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL: SDL_MatrixCoefficients =
1986    SDL_MatrixCoefficients::CHROMA_DERIVED_CL;
1987/// ITU-R BT.2100-0 ICTCP
1988pub const SDL_MATRIX_COEFFICIENTS_ICTCP: SDL_MatrixCoefficients = SDL_MatrixCoefficients::ICTCP;
1989pub const SDL_MATRIX_COEFFICIENTS_CUSTOM: SDL_MatrixCoefficients = SDL_MatrixCoefficients::CUSTOM;
1990
1991#[cfg(feature = "metadata")]
1992impl sdl3_sys::metadata::GroupMetadata for SDL_MatrixCoefficients {
1993    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1994        &crate::metadata::pixels::METADATA_SDL_MatrixCoefficients;
1995}
1996
1997/// Colorspace chroma sample location.
1998///
1999/// ## Availability
2000/// This enum is available since SDL 3.2.0.
2001///
2002/// ## Known values (`sdl3-sys`)
2003/// | Associated constant | Global constant | Description |
2004/// | ------------------- | --------------- | ----------- |
2005/// | [`NONE`](SDL_ChromaLocation::NONE) | [`SDL_CHROMA_LOCATION_NONE`] | RGB, no chroma sampling |
2006/// | [`LEFT`](SDL_ChromaLocation::LEFT) | [`SDL_CHROMA_LOCATION_LEFT`] | In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically. |
2007/// | [`CENTER`](SDL_ChromaLocation::CENTER) | [`SDL_CHROMA_LOCATION_CENTER`] | In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel. |
2008/// | [`TOPLEFT`](SDL_ChromaLocation::TOPLEFT) | [`SDL_CHROMA_LOCATION_TOPLEFT`] | In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). |
2009#[repr(transparent)]
2010#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2011pub struct SDL_ChromaLocation(pub ::core::ffi::c_uint);
2012
2013impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ChromaLocation {
2014    #[inline(always)]
2015    fn eq(&self, other: &::core::ffi::c_uint) -> bool {
2016        &self.0 == other
2017    }
2018}
2019
2020impl ::core::cmp::PartialEq<SDL_ChromaLocation> for ::core::ffi::c_uint {
2021    #[inline(always)]
2022    fn eq(&self, other: &SDL_ChromaLocation) -> bool {
2023        self == &other.0
2024    }
2025}
2026
2027impl From<SDL_ChromaLocation> for ::core::ffi::c_uint {
2028    #[inline(always)]
2029    fn from(value: SDL_ChromaLocation) -> Self {
2030        value.0
2031    }
2032}
2033
2034#[cfg(feature = "debug-impls")]
2035impl ::core::fmt::Debug for SDL_ChromaLocation {
2036    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2037        #[allow(unreachable_patterns)]
2038        f.write_str(match *self {
2039            Self::NONE => "SDL_CHROMA_LOCATION_NONE",
2040            Self::LEFT => "SDL_CHROMA_LOCATION_LEFT",
2041            Self::CENTER => "SDL_CHROMA_LOCATION_CENTER",
2042            Self::TOPLEFT => "SDL_CHROMA_LOCATION_TOPLEFT",
2043
2044            _ => return write!(f, "SDL_ChromaLocation({})", self.0),
2045        })
2046    }
2047}
2048
2049impl SDL_ChromaLocation {
2050    /// RGB, no chroma sampling
2051    pub const NONE: Self = Self((0 as ::core::ffi::c_uint));
2052    /// In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.
2053    pub const LEFT: Self = Self((1 as ::core::ffi::c_uint));
2054    /// In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel.
2055    pub const CENTER: Self = Self((2 as ::core::ffi::c_uint));
2056    /// In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located").
2057    pub const TOPLEFT: Self = Self((3 as ::core::ffi::c_uint));
2058}
2059
2060/// RGB, no chroma sampling
2061pub const SDL_CHROMA_LOCATION_NONE: SDL_ChromaLocation = SDL_ChromaLocation::NONE;
2062/// In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.
2063pub const SDL_CHROMA_LOCATION_LEFT: SDL_ChromaLocation = SDL_ChromaLocation::LEFT;
2064/// In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel.
2065pub const SDL_CHROMA_LOCATION_CENTER: SDL_ChromaLocation = SDL_ChromaLocation::CENTER;
2066/// In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located").
2067pub const SDL_CHROMA_LOCATION_TOPLEFT: SDL_ChromaLocation = SDL_ChromaLocation::TOPLEFT;
2068
2069#[cfg(feature = "metadata")]
2070impl sdl3_sys::metadata::GroupMetadata for SDL_ChromaLocation {
2071    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2072        &crate::metadata::pixels::METADATA_SDL_ChromaLocation;
2073}
2074
2075/// Colorspace definitions.
2076///
2077/// Since similar colorspaces may vary in their details (matrix, transfer
2078/// function, etc.), this is not an exhaustive list, but rather a
2079/// representative sample of the kinds of colorspaces supported in SDL.
2080///
2081/// ## Availability
2082/// This enum is available since SDL 3.2.0.
2083///
2084/// ## See also
2085/// - [`SDL_ColorPrimaries`]
2086/// - [`SDL_ColorRange`]
2087/// - [`SDL_ColorType`]
2088/// - [`SDL_MatrixCoefficients`]
2089/// - [`SDL_TransferCharacteristics`]
2090///
2091/// ## Known values (`sdl3-sys`)
2092/// | Associated constant | Global constant | Description |
2093/// | ------------------- | --------------- | ----------- |
2094/// | [`UNKNOWN`](SDL_Colorspace::UNKNOWN) | [`SDL_COLORSPACE_UNKNOWN`] | |
2095/// | [`SRGB`](SDL_Colorspace::SRGB) | [`SDL_COLORSPACE_SRGB`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 |
2096/// | [`SRGB_LINEAR`](SDL_Colorspace::SRGB_LINEAR) | [`SDL_COLORSPACE_SRGB_LINEAR`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 |
2097/// | [`HDR10`](SDL_Colorspace::HDR10) | [`SDL_COLORSPACE_HDR10`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 |
2098/// | [`JPEG`](SDL_Colorspace::JPEG) | [`SDL_COLORSPACE_JPEG`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 |
2099/// | [`BT601_LIMITED`](SDL_Colorspace::BT601_LIMITED) | [`SDL_COLORSPACE_BT601_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 |
2100/// | [`BT601_FULL`](SDL_Colorspace::BT601_FULL) | [`SDL_COLORSPACE_BT601_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 |
2101/// | [`BT709_LIMITED`](SDL_Colorspace::BT709_LIMITED) | [`SDL_COLORSPACE_BT709_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 |
2102/// | [`BT709_FULL`](SDL_Colorspace::BT709_FULL) | [`SDL_COLORSPACE_BT709_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 |
2103/// | [`BT2020_LIMITED`](SDL_Colorspace::BT2020_LIMITED) | [`SDL_COLORSPACE_BT2020_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 |
2104/// | [`BT2020_FULL`](SDL_Colorspace::BT2020_FULL) | [`SDL_COLORSPACE_BT2020_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 |
2105/// | [`RGB_DEFAULT`](SDL_Colorspace::RGB_DEFAULT) | [`SDL_COLORSPACE_RGB_DEFAULT`] | The default colorspace for RGB surfaces if no colorspace is specified |
2106/// | [`YUV_DEFAULT`](SDL_Colorspace::YUV_DEFAULT) | [`SDL_COLORSPACE_YUV_DEFAULT`] | The default colorspace for YUV surfaces if no colorspace is specified |
2107#[repr(transparent)]
2108#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2109pub struct SDL_Colorspace(pub Uint32);
2110
2111impl ::core::cmp::PartialEq<Uint32> for SDL_Colorspace {
2112    #[inline(always)]
2113    fn eq(&self, other: &Uint32) -> bool {
2114        &self.0 == other
2115    }
2116}
2117
2118impl ::core::cmp::PartialEq<SDL_Colorspace> for Uint32 {
2119    #[inline(always)]
2120    fn eq(&self, other: &SDL_Colorspace) -> bool {
2121        self == &other.0
2122    }
2123}
2124
2125impl From<SDL_Colorspace> for Uint32 {
2126    #[inline(always)]
2127    fn from(value: SDL_Colorspace) -> Self {
2128        value.0
2129    }
2130}
2131
2132#[cfg(feature = "debug-impls")]
2133impl ::core::fmt::Debug for SDL_Colorspace {
2134    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2135        #[allow(unreachable_patterns)]
2136        f.write_str(match *self {
2137            Self::UNKNOWN => "SDL_COLORSPACE_UNKNOWN",
2138            Self::SRGB => "SDL_COLORSPACE_SRGB",
2139            Self::SRGB_LINEAR => "SDL_COLORSPACE_SRGB_LINEAR",
2140            Self::HDR10 => "SDL_COLORSPACE_HDR10",
2141            Self::JPEG => "SDL_COLORSPACE_JPEG",
2142            Self::BT601_LIMITED => "SDL_COLORSPACE_BT601_LIMITED",
2143            Self::BT601_FULL => "SDL_COLORSPACE_BT601_FULL",
2144            Self::BT709_LIMITED => "SDL_COLORSPACE_BT709_LIMITED",
2145            Self::BT709_FULL => "SDL_COLORSPACE_BT709_FULL",
2146            Self::BT2020_LIMITED => "SDL_COLORSPACE_BT2020_LIMITED",
2147            Self::BT2020_FULL => "SDL_COLORSPACE_BT2020_FULL",
2148            Self::RGB_DEFAULT => "SDL_COLORSPACE_RGB_DEFAULT",
2149            Self::YUV_DEFAULT => "SDL_COLORSPACE_YUV_DEFAULT",
2150
2151            _ => return write!(f, "SDL_Colorspace({})", self.0),
2152        })
2153    }
2154}
2155
2156impl SDL_Colorspace {
2157    pub const UNKNOWN: Self = Self((0 as Uint32));
2158    /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
2159    pub const SRGB: Self = Self((0x120005a0 as Uint32));
2160    /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709
2161    pub const SRGB_LINEAR: Self = Self((0x12000500 as Uint32));
2162    /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
2163    pub const HDR10: Self = Self((0x12002600 as Uint32));
2164    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601
2165    pub const JPEG: Self = Self((0x220004c6 as Uint32));
2166    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
2167    pub const BT601_LIMITED: Self = Self((0x211018c6 as Uint32));
2168    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
2169    pub const BT601_FULL: Self = Self((0x221018c6 as Uint32));
2170    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
2171    pub const BT709_LIMITED: Self = Self((0x21100421 as Uint32));
2172    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
2173    pub const BT709_FULL: Self = Self((0x22100421 as Uint32));
2174    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020
2175    pub const BT2020_LIMITED: Self = Self((0x21102609 as Uint32));
2176    /// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
2177    pub const BT2020_FULL: Self = Self((0x22102609 as Uint32));
2178    /// The default colorspace for RGB surfaces if no colorspace is specified
2179    pub const RGB_DEFAULT: Self = SDL_COLORSPACE_SRGB;
2180    /// The default colorspace for YUV surfaces if no colorspace is specified
2181    pub const YUV_DEFAULT: Self = SDL_COLORSPACE_BT601_LIMITED;
2182}
2183
2184pub const SDL_COLORSPACE_UNKNOWN: SDL_Colorspace = SDL_Colorspace::UNKNOWN;
2185/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
2186pub const SDL_COLORSPACE_SRGB: SDL_Colorspace = SDL_Colorspace::SRGB;
2187/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709
2188pub const SDL_COLORSPACE_SRGB_LINEAR: SDL_Colorspace = SDL_Colorspace::SRGB_LINEAR;
2189/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
2190pub const SDL_COLORSPACE_HDR10: SDL_Colorspace = SDL_Colorspace::HDR10;
2191/// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601
2192pub const SDL_COLORSPACE_JPEG: SDL_Colorspace = SDL_Colorspace::JPEG;
2193/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
2194pub const SDL_COLORSPACE_BT601_LIMITED: SDL_Colorspace = SDL_Colorspace::BT601_LIMITED;
2195/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
2196pub const SDL_COLORSPACE_BT601_FULL: SDL_Colorspace = SDL_Colorspace::BT601_FULL;
2197/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
2198pub const SDL_COLORSPACE_BT709_LIMITED: SDL_Colorspace = SDL_Colorspace::BT709_LIMITED;
2199/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
2200pub const SDL_COLORSPACE_BT709_FULL: SDL_Colorspace = SDL_Colorspace::BT709_FULL;
2201/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020
2202pub const SDL_COLORSPACE_BT2020_LIMITED: SDL_Colorspace = SDL_Colorspace::BT2020_LIMITED;
2203/// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
2204pub const SDL_COLORSPACE_BT2020_FULL: SDL_Colorspace = SDL_Colorspace::BT2020_FULL;
2205/// The default colorspace for RGB surfaces if no colorspace is specified
2206pub const SDL_COLORSPACE_RGB_DEFAULT: SDL_Colorspace = SDL_Colorspace::RGB_DEFAULT;
2207/// The default colorspace for YUV surfaces if no colorspace is specified
2208pub const SDL_COLORSPACE_YUV_DEFAULT: SDL_Colorspace = SDL_Colorspace::YUV_DEFAULT;
2209
2210#[cfg(feature = "metadata")]
2211impl sdl3_sys::metadata::GroupMetadata for SDL_Colorspace {
2212    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2213        &crate::metadata::pixels::METADATA_SDL_Colorspace;
2214}
2215
2216/// A macro for defining custom [`SDL_Colorspace`] formats.
2217///
2218/// For example, defining [`SDL_COLORSPACE_SRGB`] looks like this:
2219///
2220/// ```c
2221/// SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB,
2222///                       SDL_COLOR_RANGE_FULL,
2223///                       SDL_COLOR_PRIMARIES_BT709,
2224///                       SDL_TRANSFER_CHARACTERISTICS_SRGB,
2225///                       SDL_MATRIX_COEFFICIENTS_IDENTITY,
2226///                       SDL_CHROMA_LOCATION_NONE)
2227/// ```
2228///
2229/// ## Parameters
2230/// - `type`: the type of the new format, probably an [`SDL_ColorType`] value.
2231/// - `range`: the range of the new format, probably a [`SDL_ColorRange`] value.
2232/// - `primaries`: the primaries of the new format, probably an
2233///   [`SDL_ColorPrimaries`] value.
2234/// - `transfer`: the transfer characteristics of the new format, probably an
2235///   [`SDL_TransferCharacteristics`] value.
2236/// - `matrix`: the matrix coefficients of the new format, probably an
2237///   [`SDL_MatrixCoefficients`] value.
2238/// - `chroma`: the chroma sample location of the new format, probably an
2239///   [`SDL_ChromaLocation`] value.
2240///
2241/// ## Return value
2242/// Returns a format value in the style of [`SDL_Colorspace`].
2243///
2244/// ## Thread safety
2245/// It is safe to call this macro from any thread.
2246///
2247/// ## Availability
2248/// This macro is available since SDL 3.2.0.
2249#[inline(always)]
2250pub const fn SDL_DEFINE_COLORSPACE(
2251    r#type: SDL_ColorType,
2252    range: SDL_ColorRange,
2253    primaries: SDL_ColorPrimaries,
2254    transfer: SDL_TransferCharacteristics,
2255    matrix: SDL_MatrixCoefficients,
2256    chroma: SDL_ChromaLocation,
2257) -> SDL_Colorspace {
2258    SDL_Colorspace(
2259        (((((((r#type.0 as Uint32) << 28) | ((range.0 as Uint32) << 24))
2260            | ((chroma.0 as Uint32) << 20))
2261            | ((primaries.0 as Uint32) << 10))
2262            | ((transfer.0 as Uint32) << 5))
2263            | ((matrix.0 as Uint32) << 0)),
2264    )
2265}
2266
2267/// A macro to retrieve the type of an [`SDL_Colorspace`].
2268///
2269/// ## Parameters
2270/// - `cspace`: an [`SDL_Colorspace`] to check.
2271///
2272/// ## Return value
2273/// Returns the [`SDL_ColorType`] for `cspace`.
2274///
2275/// ## Thread safety
2276/// It is safe to call this macro from any thread.
2277///
2278/// ## Availability
2279/// This macro is available since SDL 3.2.0.
2280#[inline(always)]
2281pub const fn SDL_COLORSPACETYPE(cspace: SDL_Colorspace) -> SDL_ColorType {
2282    SDL_ColorType((((cspace.0 >> 28) & 15_u32) as ::core::ffi::c_uint))
2283}
2284
2285/// A macro to retrieve the range of an [`SDL_Colorspace`].
2286///
2287/// ## Parameters
2288/// - `cspace`: an [`SDL_Colorspace`] to check.
2289///
2290/// ## Return value
2291/// Returns the [`SDL_ColorRange`] of `cspace`.
2292///
2293/// ## Thread safety
2294/// It is safe to call this macro from any thread.
2295///
2296/// ## Availability
2297/// This macro is available since SDL 3.2.0.
2298#[inline(always)]
2299pub const fn SDL_COLORSPACERANGE(cspace: SDL_Colorspace) -> SDL_ColorRange {
2300    SDL_ColorRange((((cspace.0 >> 24) & 15_u32) as ::core::ffi::c_uint))
2301}
2302
2303/// A macro to retrieve the chroma sample location of an [`SDL_Colorspace`].
2304///
2305/// ## Parameters
2306/// - `cspace`: an [`SDL_Colorspace`] to check.
2307///
2308/// ## Return value
2309/// Returns the [`SDL_ChromaLocation`] of `cspace`.
2310///
2311/// ## Thread safety
2312/// It is safe to call this macro from any thread.
2313///
2314/// ## Availability
2315/// This macro is available since SDL 3.2.0.
2316#[inline(always)]
2317pub const fn SDL_COLORSPACECHROMA(cspace: SDL_Colorspace) -> SDL_ChromaLocation {
2318    SDL_ChromaLocation((((cspace.0 >> 20) & 15_u32) as ::core::ffi::c_uint))
2319}
2320
2321/// A macro to retrieve the primaries of an [`SDL_Colorspace`].
2322///
2323/// ## Parameters
2324/// - `cspace`: an [`SDL_Colorspace`] to check.
2325///
2326/// ## Return value
2327/// Returns the [`SDL_ColorPrimaries`] of `cspace`.
2328///
2329/// ## Thread safety
2330/// It is safe to call this macro from any thread.
2331///
2332/// ## Availability
2333/// This macro is available since SDL 3.2.0.
2334#[inline(always)]
2335pub const fn SDL_COLORSPACEPRIMARIES(cspace: SDL_Colorspace) -> SDL_ColorPrimaries {
2336    SDL_ColorPrimaries((((cspace.0 >> 10) & 31_u32) as ::core::ffi::c_uint))
2337}
2338
2339/// A macro to retrieve the transfer characteristics of an [`SDL_Colorspace`].
2340///
2341/// ## Parameters
2342/// - `cspace`: an [`SDL_Colorspace`] to check.
2343///
2344/// ## Return value
2345/// Returns the [`SDL_TransferCharacteristics`] of `cspace`.
2346///
2347/// ## Thread safety
2348/// It is safe to call this macro from any thread.
2349///
2350/// ## Availability
2351/// This macro is available since SDL 3.2.0.
2352#[inline(always)]
2353pub const fn SDL_COLORSPACETRANSFER(cspace: SDL_Colorspace) -> SDL_TransferCharacteristics {
2354    SDL_TransferCharacteristics((((cspace.0 >> 5) & 31_u32) as ::core::ffi::c_uint))
2355}
2356
2357/// A macro to retrieve the matrix coefficients of an [`SDL_Colorspace`].
2358///
2359/// ## Parameters
2360/// - `cspace`: an [`SDL_Colorspace`] to check.
2361///
2362/// ## Return value
2363/// Returns the [`SDL_MatrixCoefficients`] of `cspace`.
2364///
2365/// ## Thread safety
2366/// It is safe to call this macro from any thread.
2367///
2368/// ## Availability
2369/// This macro is available since SDL 3.2.0.
2370#[inline(always)]
2371pub const fn SDL_COLORSPACEMATRIX(cspace: SDL_Colorspace) -> SDL_MatrixCoefficients {
2372    SDL_MatrixCoefficients(((cspace.0 & 31_u32) as ::core::ffi::c_uint))
2373}
2374
2375/// A macro to determine if an [`SDL_Colorspace`] has a limited range.
2376///
2377/// ## Parameters
2378/// - `cspace`: an [`SDL_Colorspace`] to check.
2379///
2380/// ## Return value
2381/// Returns true if limited range, false otherwise.
2382///
2383/// ## Thread safety
2384/// It is safe to call this macro from any thread.
2385///
2386/// ## Availability
2387/// This macro is available since SDL 3.2.0.
2388#[inline(always)]
2389pub const fn SDL_ISCOLORSPACE_LIMITED_RANGE(cspace: SDL_Colorspace) -> ::core::primitive::bool {
2390    (SDL_COLORSPACERANGE(cspace).0 != SDL_COLOR_RANGE_FULL.0)
2391}
2392
2393/// A macro to determine if an [`SDL_Colorspace`] has a full range.
2394///
2395/// ## Parameters
2396/// - `cspace`: an [`SDL_Colorspace`] to check.
2397///
2398/// ## Return value
2399/// Returns true if full range, false otherwise.
2400///
2401/// ## Thread safety
2402/// It is safe to call this macro from any thread.
2403///
2404/// ## Availability
2405/// This macro is available since SDL 3.2.0.
2406#[inline(always)]
2407pub const fn SDL_ISCOLORSPACE_FULL_RANGE(cspace: SDL_Colorspace) -> ::core::primitive::bool {
2408    (SDL_COLORSPACERANGE(cspace).0 == SDL_COLOR_RANGE_FULL.0)
2409}
2410
2411/// A macro to determine if an [`SDL_Colorspace`] uses BT601 (or BT470BG) matrix
2412/// coefficients.
2413///
2414/// Note that this macro double-evaluates its parameter, so do not use
2415/// expressions with side-effects here.
2416///
2417/// ## Parameters
2418/// - `cspace`: an [`SDL_Colorspace`] to check.
2419///
2420/// ## Return value
2421/// Returns true if BT601 or BT470BG, false otherwise.
2422///
2423/// ## Thread safety
2424/// It is safe to call this macro from any thread.
2425///
2426/// ## Availability
2427/// This macro is available since SDL 3.2.0.
2428#[inline(always)]
2429pub const fn SDL_ISCOLORSPACE_MATRIX_BT601(cspace: SDL_Colorspace) -> ::core::primitive::bool {
2430    ((SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT601.0)
2431        || (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT470BG.0))
2432}
2433
2434/// A macro to determine if an [`SDL_Colorspace`] uses BT709 matrix coefficients.
2435///
2436/// ## Parameters
2437/// - `cspace`: an [`SDL_Colorspace`] to check.
2438///
2439/// ## Return value
2440/// Returns true if BT709, false otherwise.
2441///
2442/// ## Thread safety
2443/// It is safe to call this macro from any thread.
2444///
2445/// ## Availability
2446/// This macro is available since SDL 3.2.0.
2447#[inline(always)]
2448pub const fn SDL_ISCOLORSPACE_MATRIX_BT709(cspace: SDL_Colorspace) -> ::core::primitive::bool {
2449    (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT709.0)
2450}
2451
2452/// A macro to determine if an [`SDL_Colorspace`] uses BT2020_NCL matrix
2453/// coefficients.
2454///
2455/// ## Parameters
2456/// - `cspace`: an [`SDL_Colorspace`] to check.
2457///
2458/// ## Return value
2459/// Returns true if BT2020_NCL, false otherwise.
2460///
2461/// ## Thread safety
2462/// It is safe to call this macro from any thread.
2463///
2464/// ## Availability
2465/// This macro is available since SDL 3.2.0.
2466#[inline(always)]
2467pub const fn SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(cspace: SDL_Colorspace) -> ::core::primitive::bool {
2468    (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT2020_NCL.0)
2469}
2470
2471/// A structure that represents a color as RGBA components.
2472///
2473/// The bits of this structure can be directly reinterpreted as an
2474/// integer-packed color which uses the [`SDL_PIXELFORMAT_RGBA32`] format
2475/// ([`SDL_PIXELFORMAT_ABGR8888`] on little-endian systems and
2476/// [`SDL_PIXELFORMAT_RGBA8888`] on big-endian systems).
2477///
2478/// ## Availability
2479/// This struct is available since SDL 3.2.0.
2480#[repr(C)]
2481#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
2482#[cfg_attr(feature = "debug-impls", derive(Debug))]
2483pub struct SDL_Color {
2484    pub r: Uint8,
2485    pub g: Uint8,
2486    pub b: Uint8,
2487    pub a: Uint8,
2488}
2489
2490/// The bits of this structure can be directly reinterpreted as a float-packed
2491/// color which uses the [`SDL_PIXELFORMAT_RGBA128_FLOAT`] format
2492///
2493/// ## Availability
2494/// This struct is available since SDL 3.2.0.
2495#[repr(C)]
2496#[derive(Clone, Copy, Default, PartialEq)]
2497#[cfg_attr(feature = "debug-impls", derive(Debug))]
2498pub struct SDL_FColor {
2499    pub r: ::core::ffi::c_float,
2500    pub g: ::core::ffi::c_float,
2501    pub b: ::core::ffi::c_float,
2502    pub a: ::core::ffi::c_float,
2503}
2504
2505/// A set of indexed colors representing a palette.
2506///
2507/// ## Availability
2508/// This struct is available since SDL 3.2.0.
2509///
2510/// ## See also
2511/// - [`SDL_SetPaletteColors`]
2512///
2513/// ## Notes for `sdl3-sys`
2514/// This struct can't be created manually. Use the corresponding SDL functions.
2515#[repr(C)]
2516#[cfg_attr(feature = "debug-impls", derive(Debug))]
2517pub struct SDL_Palette {
2518    /// number of elements in `colors`.
2519    pub ncolors: ::core::ffi::c_int,
2520    /// an array of colors, `ncolors` long.
2521    pub colors: *mut SDL_Color,
2522    /// internal use only, do not touch.
2523    pub version: Uint32,
2524    /// internal use only, do not touch.
2525    pub refcount: ::core::ffi::c_int,
2526    #[doc(hidden)]
2527    __non_exhaustive: ::sdl3_sys::NonExhaustive,
2528}
2529
2530/// Details about the format of a pixel.
2531///
2532/// ## Availability
2533/// This struct is available since SDL 3.2.0.
2534///
2535/// ## Notes for `sdl3-sys`
2536/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
2537#[repr(C)]
2538#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
2539#[cfg_attr(feature = "debug-impls", derive(Debug))]
2540pub struct SDL_PixelFormatDetails {
2541    pub format: SDL_PixelFormat,
2542    pub bits_per_pixel: Uint8,
2543    pub bytes_per_pixel: Uint8,
2544    #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
2545    pub padding: [Uint8; 2],
2546    pub Rmask: Uint32,
2547    pub Gmask: Uint32,
2548    pub Bmask: Uint32,
2549    pub Amask: Uint32,
2550    pub Rbits: Uint8,
2551    pub Gbits: Uint8,
2552    pub Bbits: Uint8,
2553    pub Abits: Uint8,
2554    pub Rshift: Uint8,
2555    pub Gshift: Uint8,
2556    pub Bshift: Uint8,
2557    pub Ashift: Uint8,
2558}
2559
2560unsafe extern "C" {
2561    /// Get the human readable name of a pixel format.
2562    ///
2563    /// ## Parameters
2564    /// - `format`: the pixel format to query.
2565    ///
2566    /// ## Return value
2567    /// Returns the human readable name of the specified pixel format or
2568    ///   "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized.
2569    ///
2570    /// ## Thread safety
2571    /// It is safe to call this function from any thread.
2572    ///
2573    /// ## Availability
2574    /// This function is available since SDL 3.2.0.
2575    pub safe fn SDL_GetPixelFormatName(format: SDL_PixelFormat) -> *const ::core::ffi::c_char;
2576}
2577
2578unsafe extern "C" {
2579    /// Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
2580    ///
2581    /// ## Parameters
2582    /// - `format`: one of the [`SDL_PixelFormat`] values.
2583    /// - `bpp`: a bits per pixel value; usually 15, 16, or 32.
2584    /// - `Rmask`: a pointer filled in with the red mask for the format.
2585    /// - `Gmask`: a pointer filled in with the green mask for the format.
2586    /// - `Bmask`: a pointer filled in with the blue mask for the format.
2587    /// - `Amask`: a pointer filled in with the alpha mask for the format.
2588    ///
2589    /// ## Return value
2590    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2591    ///   information.
2592    ///
2593    /// ## Thread safety
2594    /// It is safe to call this function from any thread.
2595    ///
2596    /// ## Availability
2597    /// This function is available since SDL 3.2.0.
2598    ///
2599    /// ## See also
2600    /// - [`SDL_GetPixelFormatForMasks`]
2601    pub fn SDL_GetMasksForPixelFormat(
2602        format: SDL_PixelFormat,
2603        bpp: *mut ::core::ffi::c_int,
2604        Rmask: *mut Uint32,
2605        Gmask: *mut Uint32,
2606        Bmask: *mut Uint32,
2607        Amask: *mut Uint32,
2608    ) -> ::core::primitive::bool;
2609}
2610
2611unsafe extern "C" {
2612    /// Convert a bpp value and RGBA masks to an enumerated pixel format.
2613    ///
2614    /// This will return [`SDL_PIXELFORMAT_UNKNOWN`] if the conversion wasn't
2615    /// possible.
2616    ///
2617    /// ## Parameters
2618    /// - `bpp`: a bits per pixel value; usually 15, 16, or 32.
2619    /// - `Rmask`: the red mask for the format.
2620    /// - `Gmask`: the green mask for the format.
2621    /// - `Bmask`: the blue mask for the format.
2622    /// - `Amask`: the alpha mask for the format.
2623    ///
2624    /// ## Return value
2625    /// Returns the [`SDL_PixelFormat`] value corresponding to the format masks, or
2626    ///   [`SDL_PIXELFORMAT_UNKNOWN`] if there isn't a match.
2627    ///
2628    /// ## Thread safety
2629    /// It is safe to call this function from any thread.
2630    ///
2631    /// ## Availability
2632    /// This function is available since SDL 3.2.0.
2633    ///
2634    /// ## See also
2635    /// - [`SDL_GetMasksForPixelFormat`]
2636    pub safe fn SDL_GetPixelFormatForMasks(
2637        bpp: ::core::ffi::c_int,
2638        Rmask: Uint32,
2639        Gmask: Uint32,
2640        Bmask: Uint32,
2641        Amask: Uint32,
2642    ) -> SDL_PixelFormat;
2643}
2644
2645unsafe extern "C" {
2646    /// Create an [`SDL_PixelFormatDetails`] structure corresponding to a pixel format.
2647    ///
2648    /// Returned structure may come from a shared global cache (i.e. not newly
2649    /// allocated), and hence should not be modified, especially the palette. Weird
2650    /// errors such as `Blit combination not supported` may occur.
2651    ///
2652    /// ## Parameters
2653    /// - `format`: one of the [`SDL_PixelFormat`] values.
2654    ///
2655    /// ## Return value
2656    /// Returns a pointer to a [`SDL_PixelFormatDetails`] structure or NULL on
2657    ///   failure; call [`SDL_GetError()`] for more information.
2658    ///
2659    /// ## Thread safety
2660    /// It is safe to call this function from any thread.
2661    ///
2662    /// ## Availability
2663    /// This function is available since SDL 3.2.0.
2664    pub fn SDL_GetPixelFormatDetails(format: SDL_PixelFormat) -> *const SDL_PixelFormatDetails;
2665}
2666
2667unsafe extern "C" {
2668    /// Create a palette structure with the specified number of color entries.
2669    ///
2670    /// The palette entries are initialized to white.
2671    ///
2672    /// ## Parameters
2673    /// - `ncolors`: represents the number of color entries in the color palette.
2674    ///
2675    /// ## Return value
2676    /// Returns a new [`SDL_Palette`] structure on success or NULL on failure (e.g. if
2677    ///   there wasn't enough memory); call [`SDL_GetError()`] for more
2678    ///   information.
2679    ///
2680    /// ## Thread safety
2681    /// It is safe to call this function from any thread.
2682    ///
2683    /// ## Availability
2684    /// This function is available since SDL 3.2.0.
2685    ///
2686    /// ## See also
2687    /// - [`SDL_DestroyPalette`]
2688    /// - [`SDL_SetPaletteColors`]
2689    /// - [`SDL_SetSurfacePalette`]
2690    pub fn SDL_CreatePalette(ncolors: ::core::ffi::c_int) -> *mut SDL_Palette;
2691}
2692
2693unsafe extern "C" {
2694    /// Set a range of colors in a palette.
2695    ///
2696    /// ## Parameters
2697    /// - `palette`: the [`SDL_Palette`] structure to modify.
2698    /// - `colors`: an array of [`SDL_Color`] structures to copy into the palette.
2699    /// - `firstcolor`: the index of the first palette entry to modify.
2700    /// - `ncolors`: the number of entries to modify.
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    /// It is safe to call this function from any thread, as long as
2708    ///   the palette is not modified or destroyed in another thread.
2709    ///
2710    /// ## Availability
2711    /// This function is available since SDL 3.2.0.
2712    pub fn SDL_SetPaletteColors(
2713        palette: *mut SDL_Palette,
2714        colors: *const SDL_Color,
2715        firstcolor: ::core::ffi::c_int,
2716        ncolors: ::core::ffi::c_int,
2717    ) -> ::core::primitive::bool;
2718}
2719
2720unsafe extern "C" {
2721    /// Free a palette created with [`SDL_CreatePalette()`].
2722    ///
2723    /// ## Parameters
2724    /// - `palette`: the [`SDL_Palette`] structure to be freed.
2725    ///
2726    /// ## Thread safety
2727    /// It is safe to call this function from any thread, as long as
2728    ///   the palette is not modified or destroyed in another thread.
2729    ///
2730    /// ## Availability
2731    /// This function is available since SDL 3.2.0.
2732    ///
2733    /// ## See also
2734    /// - [`SDL_CreatePalette`]
2735    pub fn SDL_DestroyPalette(palette: *mut SDL_Palette);
2736}
2737
2738unsafe extern "C" {
2739    /// Map an RGB triple to an opaque pixel value for a given pixel format.
2740    ///
2741    /// This function maps the RGB color value to the specified pixel format and
2742    /// returns the pixel value best approximating the given RGB color value for
2743    /// the given pixel format.
2744    ///
2745    /// If the format has a palette (8-bit) the index of the closest matching color
2746    /// in the palette will be returned.
2747    ///
2748    /// If the specified pixel format has an alpha component it will be returned as
2749    /// all 1 bits (fully opaque).
2750    ///
2751    /// If the pixel format bpp (color depth) is less than 32-bpp then the unused
2752    /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp
2753    /// format the return value can be assigned to a Uint16, and similarly a Uint8
2754    /// for an 8-bpp format).
2755    ///
2756    /// ## Parameters
2757    /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel
2758    ///   format.
2759    /// - `palette`: an optional palette for indexed formats, may be NULL.
2760    /// - `r`: the red component of the pixel in the range 0-255.
2761    /// - `g`: the green component of the pixel in the range 0-255.
2762    /// - `b`: the blue component of the pixel in the range 0-255.
2763    ///
2764    /// ## Return value
2765    /// Returns a pixel value.
2766    ///
2767    /// ## Thread safety
2768    /// It is safe to call this function from any thread, as long as
2769    ///   the palette is not modified.
2770    ///
2771    /// ## Availability
2772    /// This function is available since SDL 3.2.0.
2773    ///
2774    /// ## See also
2775    /// - [`SDL_GetPixelFormatDetails`]
2776    /// - [`SDL_GetRGB`]
2777    /// - [`SDL_MapRGBA`]
2778    /// - [`SDL_MapSurfaceRGB`]
2779    pub fn SDL_MapRGB(
2780        format: *const SDL_PixelFormatDetails,
2781        palette: *const SDL_Palette,
2782        r: Uint8,
2783        g: Uint8,
2784        b: Uint8,
2785    ) -> Uint32;
2786}
2787
2788unsafe extern "C" {
2789    /// Map an RGBA quadruple to a pixel value for a given pixel format.
2790    ///
2791    /// This function maps the RGBA color value to the specified pixel format and
2792    /// returns the pixel value best approximating the given RGBA color value for
2793    /// the given pixel format.
2794    ///
2795    /// If the specified pixel format has no alpha component the alpha value will
2796    /// be ignored (as it will be in formats with a palette).
2797    ///
2798    /// If the format has a palette (8-bit) the index of the closest matching color
2799    /// in the palette will be returned.
2800    ///
2801    /// If the pixel format bpp (color depth) is less than 32-bpp then the unused
2802    /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp
2803    /// format the return value can be assigned to a Uint16, and similarly a Uint8
2804    /// for an 8-bpp format).
2805    ///
2806    /// ## Parameters
2807    /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel
2808    ///   format.
2809    /// - `palette`: an optional palette for indexed formats, may be NULL.
2810    /// - `r`: the red component of the pixel in the range 0-255.
2811    /// - `g`: the green component of the pixel in the range 0-255.
2812    /// - `b`: the blue component of the pixel in the range 0-255.
2813    /// - `a`: the alpha component of the pixel in the range 0-255.
2814    ///
2815    /// ## Return value
2816    /// Returns a pixel value.
2817    ///
2818    /// ## Thread safety
2819    /// It is safe to call this function from any thread, as long as
2820    ///   the palette is not modified.
2821    ///
2822    /// ## Availability
2823    /// This function is available since SDL 3.2.0.
2824    ///
2825    /// ## See also
2826    /// - [`SDL_GetPixelFormatDetails`]
2827    /// - [`SDL_GetRGBA`]
2828    /// - [`SDL_MapRGB`]
2829    /// - [`SDL_MapSurfaceRGBA`]
2830    pub fn SDL_MapRGBA(
2831        format: *const SDL_PixelFormatDetails,
2832        palette: *const SDL_Palette,
2833        r: Uint8,
2834        g: Uint8,
2835        b: Uint8,
2836        a: Uint8,
2837    ) -> Uint32;
2838}
2839
2840unsafe extern "C" {
2841    /// Get RGB values from a pixel in the specified format.
2842    ///
2843    /// This function uses the entire 8-bit \[0..255\] range when converting color
2844    /// components from pixel formats with less than 8-bits per RGB component
2845    /// (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
2846    /// 0xff, 0xff\] not \[0xf8, 0xfc, 0xf8\]).
2847    ///
2848    /// ## Parameters
2849    /// - `pixelvalue`: a pixel value.
2850    /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel
2851    ///   format.
2852    /// - `palette`: an optional palette for indexed formats, may be NULL.
2853    /// - `r`: a pointer filled in with the red component, may be NULL.
2854    /// - `g`: a pointer filled in with the green component, may be NULL.
2855    /// - `b`: a pointer filled in with the blue component, may be NULL.
2856    ///
2857    /// ## Thread safety
2858    /// It is safe to call this function from any thread, as long as
2859    ///   the palette is not modified.
2860    ///
2861    /// ## Availability
2862    /// This function is available since SDL 3.2.0.
2863    ///
2864    /// ## See also
2865    /// - [`SDL_GetPixelFormatDetails`]
2866    /// - [`SDL_GetRGBA`]
2867    /// - [`SDL_MapRGB`]
2868    /// - [`SDL_MapRGBA`]
2869    pub fn SDL_GetRGB(
2870        pixelvalue: Uint32,
2871        format: *const SDL_PixelFormatDetails,
2872        palette: *const SDL_Palette,
2873        r: *mut Uint8,
2874        g: *mut Uint8,
2875        b: *mut Uint8,
2876    );
2877}
2878
2879unsafe extern "C" {
2880    /// Get RGBA values from a pixel in the specified format.
2881    ///
2882    /// This function uses the entire 8-bit \[0..255\] range when converting color
2883    /// components from pixel formats with less than 8-bits per RGB component
2884    /// (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
2885    /// 0xff, 0xff\] not \[0xf8, 0xfc, 0xf8\]).
2886    ///
2887    /// If the surface has no alpha component, the alpha will be returned as 0xff
2888    /// (100% opaque).
2889    ///
2890    /// ## Parameters
2891    /// - `pixelvalue`: a pixel value.
2892    /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel
2893    ///   format.
2894    /// - `palette`: an optional palette for indexed formats, may be NULL.
2895    /// - `r`: a pointer filled in with the red component, may be NULL.
2896    /// - `g`: a pointer filled in with the green component, may be NULL.
2897    /// - `b`: a pointer filled in with the blue component, may be NULL.
2898    /// - `a`: a pointer filled in with the alpha component, may be NULL.
2899    ///
2900    /// ## Thread safety
2901    /// It is safe to call this function from any thread, as long as
2902    ///   the palette is not modified.
2903    ///
2904    /// ## Availability
2905    /// This function is available since SDL 3.2.0.
2906    ///
2907    /// ## See also
2908    /// - [`SDL_GetPixelFormatDetails`]
2909    /// - [`SDL_GetRGB`]
2910    /// - [`SDL_MapRGB`]
2911    /// - [`SDL_MapRGBA`]
2912    pub fn SDL_GetRGBA(
2913        pixelvalue: Uint32,
2914        format: *const SDL_PixelFormatDetails,
2915        palette: *const SDL_Palette,
2916        r: *mut Uint8,
2917        g: *mut Uint8,
2918        b: *mut Uint8,
2919        a: *mut Uint8,
2920    );
2921}
2922
2923#[cfg(doc)]
2924use crate::everything::*;