Struct SDL_PixelFormat
#[repr(transparent)]pub struct SDL_PixelFormat(pub i32);
Available on crate feature
dep_sdl3
only.Expand description
Pixel format.
SDL’s pixel formats have the following naming convention:
- Names with a list of components and a single bit count, such as RGB24 and ABGR32, define a platform-independent encoding into bytes in the order specified. For example, in RGB24 data, each pixel is encoded in 3 bytes (red, green, blue) in that order, and in ABGR32 data, each pixel is encoded in 4 bytes alpha, blue, green, red) in that order. Use these names if the property of a format that is important to you is the order of the bytes in memory or on disk.
- Names with a bit count per component, such as ARGB8888 and XRGB1555, are “packed” into an appropriately-sized integer in the platform’s native endianness. For example, ARGB8888 is a sequence of 32-bit integers; in each integer, the most significant bits are alpha, and the least significant bits are blue. On a little-endian CPU such as x86, the least significant bits of each integer are arranged first in memory, but on a big-endian CPU such as s390x, the most significant bits are arranged first. Use these names if the property of a format that is important to you is the meaning of each bit position within a native-endianness integer.
- In indexed formats such as INDEX4LSB, each pixel is represented by encoding an index into the palette into the indicated number of bits, with multiple pixels packed into each byte if appropriate. In LSB formats, the first (leftmost) pixel is stored in the least-significant bits of the byte; in MSB formats, it’s stored in the most-significant bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly fills one byte.
The 32-bit byte-array encodings such as RGBA32 are aliases for the appropriate 8888 encoding for the current platform. For example, RGBA32 is an alias for ABGR8888 on little-endian CPUs like x86, or an alias for RGBA8888 on big-endian CPUs.
§Availability
This enum is available since SDL 3.2.0.
§Known values (sdl3-sys
)
Tuple Fields§
§0: i32
Implementations§
§impl SDL_PixelFormat
impl SDL_PixelFormat
pub const UNKNOWN: SDL_PixelFormat
pub const INDEX1LSB: SDL_PixelFormat
pub const INDEX1MSB: SDL_PixelFormat
pub const INDEX2LSB: SDL_PixelFormat
pub const INDEX2MSB: SDL_PixelFormat
pub const INDEX4LSB: SDL_PixelFormat
pub const INDEX4MSB: SDL_PixelFormat
pub const INDEX8: SDL_PixelFormat
pub const RGB332: SDL_PixelFormat
pub const XRGB4444: SDL_PixelFormat
pub const XBGR4444: SDL_PixelFormat
pub const XRGB1555: SDL_PixelFormat
pub const XBGR1555: SDL_PixelFormat
pub const ARGB4444: SDL_PixelFormat
pub const RGBA4444: SDL_PixelFormat
pub const ABGR4444: SDL_PixelFormat
pub const BGRA4444: SDL_PixelFormat
pub const ARGB1555: SDL_PixelFormat
pub const RGBA5551: SDL_PixelFormat
pub const ABGR1555: SDL_PixelFormat
pub const BGRA5551: SDL_PixelFormat
pub const RGB565: SDL_PixelFormat
pub const BGR565: SDL_PixelFormat
pub const RGB24: SDL_PixelFormat
pub const BGR24: SDL_PixelFormat
pub const XRGB8888: SDL_PixelFormat
pub const RGBX8888: SDL_PixelFormat
pub const XBGR8888: SDL_PixelFormat
pub const BGRX8888: SDL_PixelFormat
pub const ARGB8888: SDL_PixelFormat
pub const RGBA8888: SDL_PixelFormat
pub const ABGR8888: SDL_PixelFormat
pub const BGRA8888: SDL_PixelFormat
pub const XRGB2101010: SDL_PixelFormat
pub const XBGR2101010: SDL_PixelFormat
pub const ARGB2101010: SDL_PixelFormat
pub const ABGR2101010: SDL_PixelFormat
pub const RGB48: SDL_PixelFormat
pub const BGR48: SDL_PixelFormat
pub const RGBA64: SDL_PixelFormat
pub const ARGB64: SDL_PixelFormat
pub const BGRA64: SDL_PixelFormat
pub const ABGR64: SDL_PixelFormat
pub const RGB48_FLOAT: SDL_PixelFormat
pub const BGR48_FLOAT: SDL_PixelFormat
pub const RGBA64_FLOAT: SDL_PixelFormat
pub const ARGB64_FLOAT: SDL_PixelFormat
pub const BGRA64_FLOAT: SDL_PixelFormat
pub const ABGR64_FLOAT: SDL_PixelFormat
pub const RGB96_FLOAT: SDL_PixelFormat
pub const BGR96_FLOAT: SDL_PixelFormat
pub const RGBA128_FLOAT: SDL_PixelFormat
pub const ARGB128_FLOAT: SDL_PixelFormat
pub const BGRA128_FLOAT: SDL_PixelFormat
pub const ABGR128_FLOAT: SDL_PixelFormat
pub const YV12: SDL_PixelFormat
pub const YV12: SDL_PixelFormat
Planar mode: Y + V + U (3 planes)
pub const IYUV: SDL_PixelFormat
pub const IYUV: SDL_PixelFormat
Planar mode: Y + U + V (3 planes)
pub const YUY2: SDL_PixelFormat
pub const YUY2: SDL_PixelFormat
Packed mode: Y0+U0+Y1+V0 (1 plane)
pub const UYVY: SDL_PixelFormat
pub const UYVY: SDL_PixelFormat
Packed mode: U0+Y0+V0+Y1 (1 plane)
pub const YVYU: SDL_PixelFormat
pub const YVYU: SDL_PixelFormat
Packed mode: Y0+V0+Y1+U0 (1 plane)
pub const NV12: SDL_PixelFormat
pub const NV12: SDL_PixelFormat
Planar mode: Y + U/V interleaved (2 planes)
pub const NV21: SDL_PixelFormat
pub const NV21: SDL_PixelFormat
Planar mode: Y + V/U interleaved (2 planes)
pub const P010: SDL_PixelFormat
pub const P010: SDL_PixelFormat
Planar mode: Y + U/V interleaved (2 planes)
pub const EXTERNAL_OES: SDL_PixelFormat
pub const EXTERNAL_OES: SDL_PixelFormat
Android video texture format
pub const RGBA32: SDL_PixelFormat = SDL_PIXELFORMAT_ABGR8888
pub const ARGB32: SDL_PixelFormat = SDL_PIXELFORMAT_BGRA8888
pub const BGRA32: SDL_PixelFormat = SDL_PIXELFORMAT_ARGB8888
pub const ABGR32: SDL_PixelFormat = SDL_PIXELFORMAT_RGBA8888
pub const RGBX32: SDL_PixelFormat = SDL_PIXELFORMAT_XBGR8888
pub const XRGB32: SDL_PixelFormat = SDL_PIXELFORMAT_BGRX8888
pub const BGRX32: SDL_PixelFormat = SDL_PIXELFORMAT_XRGB8888
pub const XBGR32: SDL_PixelFormat = SDL_PIXELFORMAT_RGBX8888
Trait Implementations§
§impl Clone for SDL_PixelFormat
impl Clone for SDL_PixelFormat
§fn clone(&self) -> SDL_PixelFormat
fn clone(&self) -> SDL_PixelFormat
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Default for SDL_PixelFormat
impl Default for SDL_PixelFormat
§fn default() -> SDL_PixelFormat
fn default() -> SDL_PixelFormat
Returns the “default value” for a type. Read more
§impl From<PixelFormat> for SDL_PixelFormat
impl From<PixelFormat> for SDL_PixelFormat
§fn from(pf: PixelFormat) -> SDL_PixelFormat
fn from(pf: PixelFormat) -> SDL_PixelFormat
Converts to this type from the input type.
§impl From<SDL_PixelFormat> for i32
impl From<SDL_PixelFormat> for i32
§fn from(value: SDL_PixelFormat) -> i32
fn from(value: SDL_PixelFormat) -> i32
Converts to this type from the input type.
§impl Hash for SDL_PixelFormat
impl Hash for SDL_PixelFormat
§impl Ord for SDL_PixelFormat
impl Ord for SDL_PixelFormat
§impl PartialEq for SDL_PixelFormat
impl PartialEq for SDL_PixelFormat
§impl PartialOrd for SDL_PixelFormat
impl PartialOrd for SDL_PixelFormat
§impl TryFrom<SDL_PixelFormat> for PixelFormat
impl TryFrom<SDL_PixelFormat> for PixelFormat
§fn try_from(
format: SDL_PixelFormat,
) -> Result<PixelFormat, <PixelFormat as TryFrom<SDL_PixelFormat>>::Error> ⓘ
fn try_from( format: SDL_PixelFormat, ) -> Result<PixelFormat, <PixelFormat as TryFrom<SDL_PixelFormat>>::Error> ⓘ
Performs the conversion.
impl Copy for SDL_PixelFormat
impl Eq for SDL_PixelFormat
impl StructuralPartialEq for SDL_PixelFormat
Auto Trait Implementations§
impl Freeze for SDL_PixelFormat
impl RefUnwindSafe for SDL_PixelFormat
impl Send for SDL_PixelFormat
impl Sync for SDL_PixelFormat
impl Unpin for SDL_PixelFormat
impl UnwindSafe for SDL_PixelFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
Returns a deterministic hash of the
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more