#[repr(transparent)]pub struct SDL_PixelFormat(pub c_int);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: c_intImplementations§
Source§impl SDL_PixelFormat
impl SDL_PixelFormat
pub const UNKNOWN: Self
pub const INDEX1LSB: Self
pub const INDEX1MSB: Self
pub const INDEX2LSB: Self
pub const INDEX2MSB: Self
pub const INDEX4LSB: Self
pub const INDEX4MSB: Self
pub const INDEX8: Self
pub const RGB332: Self
pub const XRGB4444: Self
pub const XBGR4444: Self
pub const XRGB1555: Self
pub const XBGR1555: Self
pub const ARGB4444: Self
pub const RGBA4444: Self
pub const ABGR4444: Self
pub const BGRA4444: Self
pub const ARGB1555: Self
pub const RGBA5551: Self
pub const ABGR1555: Self
pub const BGRA5551: Self
pub const RGB565: Self
pub const BGR565: Self
pub const RGB24: Self
pub const BGR24: Self
pub const XRGB8888: Self
pub const RGBX8888: Self
pub const XBGR8888: Self
pub const BGRX8888: Self
pub const ARGB8888: Self
pub const RGBA8888: Self
pub const ABGR8888: Self
pub const BGRA8888: Self
pub const XRGB2101010: Self
pub const XBGR2101010: Self
pub const ARGB2101010: Self
pub const ABGR2101010: Self
pub const RGB48: Self
pub const BGR48: Self
pub const RGBA64: Self
pub const ARGB64: Self
pub const BGRA64: Self
pub const ABGR64: Self
pub const RGB48_FLOAT: Self
pub const BGR48_FLOAT: Self
pub const RGBA64_FLOAT: Self
pub const ARGB64_FLOAT: Self
pub const BGRA64_FLOAT: Self
pub const ABGR64_FLOAT: Self
pub const RGB96_FLOAT: Self
pub const BGR96_FLOAT: Self
pub const RGBA128_FLOAT: Self
pub const ARGB128_FLOAT: Self
pub const BGRA128_FLOAT: Self
pub const ABGR128_FLOAT: Self
Sourcepub const EXTERNAL_OES: Self
pub const EXTERNAL_OES: Self
Android video texture format
pub const RGBA32: Self = SDL_PIXELFORMAT_ABGR8888
pub const ARGB32: Self = SDL_PIXELFORMAT_BGRA8888
pub const BGRA32: Self = SDL_PIXELFORMAT_ARGB8888
pub const ABGR32: Self = SDL_PIXELFORMAT_RGBA8888
pub const RGBX32: Self = SDL_PIXELFORMAT_XBGR8888
pub const XRGB32: Self = SDL_PIXELFORMAT_BGRX8888
pub const BGRX32: Self = SDL_PIXELFORMAT_XRGB8888
pub const XBGR32: Self = SDL_PIXELFORMAT_RGBX8888
Trait Implementations§
Source§impl Clone for SDL_PixelFormat
impl Clone for SDL_PixelFormat
Source§fn clone(&self) -> SDL_PixelFormat
fn clone(&self) -> SDL_PixelFormat
Returns a duplicate 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 moreSource§impl Debug for SDL_PixelFormat
Available on crate feature debug-impls only.
impl Debug for SDL_PixelFormat
Available on crate feature
debug-impls only.Source§impl Default for SDL_PixelFormat
impl Default for SDL_PixelFormat
Source§fn default() -> SDL_PixelFormat
fn default() -> SDL_PixelFormat
Returns the “default value” for a type. Read more
Source§impl From<SDL_PixelFormat> for c_int
impl From<SDL_PixelFormat> for c_int
Source§fn from(value: SDL_PixelFormat) -> Self
fn from(value: SDL_PixelFormat) -> Self
Converts to this type from the input type.
Source§impl GroupMetadata for SDL_PixelFormat
Available on crate feature metadata only.
impl GroupMetadata for SDL_PixelFormat
Available on crate feature
metadata only.Source§const GROUP_METADATA: &'static Group
const GROUP_METADATA: &'static Group
Metadata for this group
Source§impl Hash for SDL_PixelFormat
impl Hash for SDL_PixelFormat
Source§impl Ord for SDL_PixelFormat
impl Ord for SDL_PixelFormat
Source§fn cmp(&self, other: &SDL_PixelFormat) -> Ordering
fn cmp(&self, other: &SDL_PixelFormat) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<SDL_PixelFormat> for c_int
impl PartialEq<SDL_PixelFormat> for c_int
Source§impl PartialEq<i32> for SDL_PixelFormat
impl PartialEq<i32> for SDL_PixelFormat
Source§impl PartialEq for SDL_PixelFormat
impl PartialEq for SDL_PixelFormat
Source§impl PartialOrd for SDL_PixelFormat
impl PartialOrd for SDL_PixelFormat
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