Skip to main content

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