Enum fidl_fuchsia_images::PixelFormat
source · #[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 Decode<PixelFormat> for PixelFormat
impl Decode<PixelFormat> for PixelFormat
source§impl Encode<PixelFormat> for PixelFormat
impl Encode<PixelFormat> 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§fn eq(&self, other: &PixelFormat) -> bool
fn eq(&self, other: &PixelFormat) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PixelFormat
impl PartialOrd for PixelFormat
source§fn partial_cmp(&self, other: &PixelFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &PixelFormat) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TypeMarker for PixelFormat
impl TypeMarker for PixelFormat
§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
§type Borrowed<'a> = PixelFormat
type Borrowed<'a> = PixelFormat
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more