#[repr(u32)]pub enum PixelFormat {
Bgra8 = 0,
Yuy2 = 1,
Nv12 = 2,
Yv12 = 3,
R8G8B8A8 = 4,
}
Expand description
Specifies how pixels are represented in the image buffer.
Variants§
Bgra8 = 0
BGRA_8
A 32-bit four-component unsigned integer format.
Byte order: B, G, R, A (little-endian ARGB packed 32-bit word).
Equivalent to Skia kBGRA_8888_SkColorType
color type.
Equivalent to Zircon ARGB_8888
pixel format on little-endian arch.
Yuy2 = 1
YUY2
4:2:2 (2x down-sampled UV horizontally; full res UV vertically)
A 32-bit component that contains information for 2 pixels: Byte order: Y1, U, Y2, V Unpacks to 2 RGB pixels, where RGB1 = func(Y1, U, V) and RGB2 = func(Y2, U, V) Equivalent to YUV422
Nv12 = 2
NV12
4:2:0 (2x down-sampled UV in both directions)
Offset 0: 8 bit per pixel Y plane with bytes YYY. Offset height * stride: 8 bit UV data interleaved bytes as UVUVUV.
Y plane has line stride >= width.
In this context, both width and height are required to be even.
The UV data is separated into “lines”, with each “line” having same byte width as a line of Y data, and same “line” stride as Y data’s line stride. The UV data has height / 2 “lines”.
In converting to RGB, the UV data gets up-scaled by 2x in both directions overall. This comment is intentionally silent on exactly how UV up-scaling phase/filtering/signal processing works, as it’s a complicated topic that can vary by implementation, typically trading off speed and quality of the up-scaling. See comments in relevant conversion code for approach taken by any given convert path. The precise relative phase of the UV data is not presently conveyed.
Yv12 = 3
YV12
Like I420, except with V and U swapped.
4:2:0 (2x down-sampled UV in both directions)
Offset 0: 8 bit per pixel Y plane with bytes YYY. Offset height * stride: 8 bit V data with uv_stride = stride / 2 Offset height * stride + uv_stride * height / 2: 8 bit U data with uv_stride = stride / 2
Y plane has line stride >= width.
Both width and height are required to be even.
R8G8B8A8 = 4
R8G8B8A8
A 32-bit four-component unsigned integer format.
Byte order: R, G, B, A (little-endian ABGR packed 32-bit word).
Equivalent to Skia kRGBA_8888_SkColorType
color type.
Equivalent to Zircon ABGR_8888
pixel format on little-endian arch.
This format can only be used with VK_DEVICE_MEMORY.
Implementations§
Source§impl PixelFormat
impl PixelFormat
pub fn from_primitive(prim: u32) -> Option<Self>
pub const fn into_primitive(self) -> u32
pub fn is_unknown(&self) -> bool
is_unknown
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PixelFormat
impl Debug for PixelFormat
Source§impl<D: ResourceDialect> Decode<PixelFormat, D> for PixelFormat
impl<D: ResourceDialect> Decode<PixelFormat, D> for PixelFormat
Source§impl<D: ResourceDialect> Encode<PixelFormat, D> for PixelFormat
impl<D: ResourceDialect> Encode<PixelFormat, D> for PixelFormat
Source§impl Hash for PixelFormat
impl Hash for PixelFormat
Source§impl Ord for PixelFormat
impl Ord for PixelFormat
Source§fn cmp(&self, other: &PixelFormat) -> Ordering
fn cmp(&self, other: &PixelFormat) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
Source§impl PartialOrd for PixelFormat
impl PartialOrd for PixelFormat
Source§impl TypeMarker for PixelFormat
impl TypeMarker for PixelFormat
Source§type Owned = PixelFormat
type Owned = PixelFormat
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.Source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read moreSource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for PixelFormat
impl ValueTypeMarker for PixelFormat
Source§type Borrowed<'a> = PixelFormat
type Borrowed<'a> = PixelFormat
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read moreimpl Copy for PixelFormat
impl Eq for PixelFormat
impl StructuralPartialEq for PixelFormat
Auto Trait Implementations§
impl Freeze for PixelFormat
impl RefUnwindSafe for PixelFormat
impl Send for PixelFormat
impl Sync for PixelFormat
impl Unpin for PixelFormat
impl UnwindSafe for 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)