Enum MemoryFormat

Source
#[non_exhaustive]
pub enum MemoryFormat {
Show 56 variants B8g8r8a8Premultiplied, A8r8g8b8Premultiplied, R8g8b8a8Premultiplied, B8g8r8a8, A8r8g8b8, R8g8b8a8, A8b8g8r8, R8g8b8, B8g8r8, R16g16b16, R16g16b16a16Premultiplied, R16g16b16a16, R16g16b16Float, R16g16b16a16FloatPremultiplied, R16g16b16a16Float, R32g32b32Float, R32g32b32a32FloatPremultiplied, R32g32b32a32Float, G8a8Premultiplied, G8a8, G8, G16a16Premultiplied, G16a16, G16, A8, A16, A16Float, A32Float, A8b8g8r8Premultiplied, B8g8r8x8, X8r8g8b8, R8g8b8x8, X8b8g8r8, G8B8r8420, G8R8b8420, G8B8r8422, G8R8b8422, G8B8r8444, G8R8b8444, G10x6B10x6r10x6420, G12x4B12x4r12x4420, G16B16r16420, G8B8R8410, G8R8B8410, G8B8R8411, G8R8B8411, G8B8R8420, G8R8B8420, G8B8R8422, G8R8B8422, G8B8R8444, G8R8B8444, G8b8g8r8422, G8r8g8b8422, R8g8b8g8422, B8g8r8g8422,
}
Expand description

Describes formats that image data can have in memory.

It describes formats by listing the contents of the memory passed to it. So GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a byte each of red, green and blue. It is not endian-dependent, so CAIRO_FORMAT_ARGB32 is represented by different GdkMemoryFormats on architectures with different endiannesses.

Its naming is modelled after VkFormat for details).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

B8g8r8a8Premultiplied

4 bytes; for blue, green, red, alpha. The color values are premultiplied with the alpha value.

§

A8r8g8b8Premultiplied

4 bytes; for alpha, red, green, blue. The color values are premultiplied with the alpha value.

§

R8g8b8a8Premultiplied

4 bytes; for red, green, blue, alpha The color values are premultiplied with the alpha value.

§

B8g8r8a8

4 bytes; for blue, green, red, alpha.

§

A8r8g8b8

4 bytes; for alpha, red, green, blue.

§

R8g8b8a8

4 bytes; for red, green, blue, alpha.

§

A8b8g8r8

4 bytes; for alpha, blue, green, red.

§

R8g8b8

3 bytes; for red, green, blue. The data is opaque.

§

B8g8r8

3 bytes; for blue, green, red. The data is opaque.

§

R16g16b16

Available on crate feature v4_6 only.

3 guint16 values; for red, green, blue.

§

R16g16b16a16Premultiplied

Available on crate feature v4_6 only.

4 guint16 values; for red, green, blue, alpha. The color values are premultiplied with the alpha value.

§

R16g16b16a16

Available on crate feature v4_6 only.

4 guint16 values; for red, green, blue, alpha.

§

R16g16b16Float

Available on crate feature v4_6 only.

3 half-float values; for red, green, blue. The data is opaque.

§

R16g16b16a16FloatPremultiplied

Available on crate feature v4_6 only.

4 half-float values; for red, green, blue and alpha. The color values are premultiplied with the alpha value.

§

R16g16b16a16Float

Available on crate feature v4_6 only.

4 half-float values; for red, green, blue and alpha.

§

R32g32b32Float

Available on crate feature v4_6 only.

3 float values; for red, green, blue.

§

R32g32b32a32FloatPremultiplied

Available on crate feature v4_6 only.

4 float values; for red, green, blue and alpha. The color values are premultiplied with the alpha value.

§

R32g32b32a32Float

Available on crate feature v4_6 only.

4 float values; for red, green, blue and alpha.

§

G8a8Premultiplied

Available on crate feature v4_12 only.

2 bytes; for grayscale, alpha. The color values are premultiplied with the alpha value.

§

G8a8

Available on crate feature v4_12 only.

2 bytes; for grayscale, alpha.

§

G8

Available on crate feature v4_12 only.

One byte; for grayscale. The data is opaque.

§

G16a16Premultiplied

Available on crate feature v4_12 only.

2 guint16 values; for grayscale, alpha. The color values are premultiplied with the alpha value.

§

G16a16

Available on crate feature v4_12 only.

2 guint16 values; for grayscale, alpha.

§

G16

Available on crate feature v4_12 only.

One guint16 value; for grayscale. The data is opaque.

§

A8

Available on crate feature v4_12 only.

One byte; for alpha.

§

A16

Available on crate feature v4_12 only.

One guint16 value; for alpha.

§

A16Float

Available on crate feature v4_12 only.

One half-float value; for alpha.

§

A32Float

Available on crate feature v4_12 only.

One float value; for alpha.

§

A8b8g8r8Premultiplied

Available on crate feature v4_14 only.

4 bytes; for alpha, blue, green, red, The color values are premultiplied with the alpha value.

§

B8g8r8x8

Available on crate feature v4_14 only.

4 bytes; for blue, green, red, unused.

§

X8r8g8b8

Available on crate feature v4_14 only.

4 bytes; for unused, red, green, blue.

§

R8g8b8x8

Available on crate feature v4_14 only.

4 bytes; for red, green, blue, unused.

§

X8b8g8r8

Available on crate feature v4_14 only.

4 bytes; for unused, blue, green, red.

§

G8B8r8420

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. Subsampled in both the X and Y direction.

Commonly known by the fourcc “NV12”.

§

G8R8b8420

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. Subsampled in both the X and Y direction.

Commonly known by the fourcc “NV21”.

§

G8B8r8422

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. Subsampled in the X direction.

Commonly known by the fourcc “NV16”.

§

G8R8b8422

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. Subsampled in the X direction.

Commonly known by the fourcc “NV61”.

§

G8B8r8444

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. This format is not subsampled.

Commonly known by the fourcc “NV24”.

§

G8R8b8444

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

Commonly known by the fourcc “NV42”.

§

G10x6B10x6r10x6420

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

Each channel is a 16 bit integer, but only the highest 10 bits are used.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

Commonly known by the fourcc “P010”.

§

G12x4B12x4r12x4420

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

Each channel is a 16 bit integer, but only the highest 10 bits are used.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

Commonly known by the fourcc “P012”.

§

G16B16r16420

Available on crate feature v4_20 only.

Multiplane format with 2 planes.

Each channel is a 16 bit integer.

The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

Commonly known by the fourcc “P016”.

§

G8B8R8410

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 3rd channel.

The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 1st channel.

Commonly known by the fourcc “YUV410”.

§

G8R8B8410

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the second chroma chanel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 1st channel.

The third plane usually contains the first chroma channel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 3rd channel.

Commonly known by the fourcc “YVU410”.

§

G8B8R8411

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the first chroma chanel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 3rd channel.

The third plane usually contains the second chroma channel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 1st channel.

Commonly known by the fourcc “YUV411”.

§

G8R8B8411

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the second chroma chanel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 1st channel.

The third plane usually contains the first chroma channel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 3rd channel.

Commonly known by the fourcc “YVU411”.

§

G8B8R8420

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

Commonly known by the fourcc “YUV420”.

§

G8R8B8420

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the second chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

The third plane usually contains the first chroma channel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

Commonly known by the fourcc “YVU420”.

§

G8B8R8422

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the first chroma chanel. Subsampled in the X direction. It is mapped into the 3rd channel.

The third plane usually contains the second chroma channel. Subsampled in the X direction. It is mapped into the 1st channel.

Commonly known by the fourcc “YUV422”.

§

G8R8B8422

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the second chroma chanel. Subsampled in the X direction. It is mapped into the 1st channel.

The third plane usually contains the first chroma channel. Subsampled in the X direction. It is mapped into the 3rd channel.

Commonly known by the fourcc “YVU422”.

§

G8B8R8444

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the first chroma chanel. It is mapped into the 3rd channel.

The third plane usually contains the second chroma channel. It is mapped into the 1st channel.

Commonly known by the fourcc “YUV444”.

§

G8R8B8444

Available on crate feature v4_20 only.

Multiplane format with 3 planes.

Each channel is a 8 bit integer.

The first plane usually contains the luma channel. It is mapped into the 2nd channel.

The second plane usually contains the second chroma chanel. Subsampled in the X direction. It is mapped into the 1st channel.

The third plane usually contains the first chroma channel. Subsampled in the X direction. It is mapped into the 3rd channel.

Commonly known by the fourcc “YVU444”.

§

G8b8g8r8422

Available on crate feature v4_20 only.

Packed format with subsampled channels.

Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

Each block contains 2 pixels, so the width must be a multiple of 2.

Commonly known by the fourcc “YUYV”.

§

G8r8g8b8422

Available on crate feature v4_20 only.

Packed format with subsampled channels.

Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

Each block contains 2 pixels, so the width must be a multiple of 2.

Commonly known by the fourcc “YVYU”.

§

R8g8b8g8422

Available on crate feature v4_20 only.

Packed format with subsampled channels.

Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

Each block contains 2 pixels, so the width must be a multiple of 2.

Commonly known by the fourcc “VYUY”.

§

B8g8r8g8422

Available on crate feature v4_20 only.

Packed format with subsampled channels.

Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

Each block contains 2 pixels, so the width must be a multiple of 2.

Commonly known by the fourcc “UYVY”.

Trait Implementations§

Source§

impl Clone for MemoryFormat

Source§

fn clone(&self) -> MemoryFormat

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<MemoryFormat> for Value

Source§

fn from(v: MemoryFormat) -> Self

Converts to this type from the input type.
Source§

impl<'a> FromValue<'a> for MemoryFormat

Source§

type Checker = GenericValueTypeChecker<MemoryFormat>

Value type checker.
Source§

unsafe fn from_value(value: &'a Value) -> Self

Get the contained value from a Value. Read more
Source§

impl HasParamSpec for MemoryFormat

Source§

type ParamSpec = ParamSpecEnum

Source§

type SetValue = MemoryFormat

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(&str, MemoryFormat) -> ParamSpecEnumBuilder<'_, MemoryFormat>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for MemoryFormat

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for MemoryFormat

Source§

fn cmp(&self, other: &MemoryFormat) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for MemoryFormat

Source§

fn eq(&self, other: &MemoryFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for MemoryFormat

Source§

fn partial_cmp(&self, other: &MemoryFormat) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for MemoryFormat

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl ToValue for MemoryFormat

Source§

fn to_value(&self) -> Value

Convert a value to a Value.
Source§

fn value_type(&self) -> Type

Returns the type identifier of self. Read more
Source§

impl ValueType for MemoryFormat

Source§

type Type = MemoryFormat

Type to get the Type from. Read more
Source§

impl Copy for MemoryFormat

Source§

impl Eq for MemoryFormat

Source§

impl StructuralPartialEq for MemoryFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSendValue for T
where T: Send + ToValue + ?Sized,

Source§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.