pub enum PixelLayout {
Gray {
sample: SampleStorage,
},
GrayAlphaInterleaved {
sample: SampleStorage,
order: GrayAlphaOrder,
alpha: AlphaAssociation,
},
GrayAlphaPlanar {
gray: SampleStorage,
alpha_sample: SampleStorage,
alpha: AlphaAssociation,
},
RgbInterleaved {
sample: SampleStorage,
order: RgbOrder,
},
RgbPlanar {
sample: SampleStorage,
},
RgbaInterleaved {
sample: SampleStorage,
order: RgbaOrder,
alpha: AlphaAssociation,
},
RgbaPlanar {
color: SampleStorage,
alpha_sample: SampleStorage,
alpha: AlphaAssociation,
},
YcbcrPlanar {
luma: SampleStorage,
chroma: SampleStorage,
subsampling: ChromaSubsampling,
},
YcbcrSemiPlanar {
luma: SampleStorage,
chroma: SampleStorage,
subsampling: ChromaSubsampling,
order: ChromaOrder,
},
YcbcrAlphaPlanar {
luma: SampleStorage,
chroma: SampleStorage,
alpha_sample: SampleStorage,
subsampling: ChromaSubsampling,
alpha: AlphaAssociation,
},
YcbcrAlphaSemiPlanar {
luma: SampleStorage,
chroma: SampleStorage,
alpha_sample: SampleStorage,
subsampling: ChromaSubsampling,
order: ChromaOrder,
alpha: AlphaAssociation,
},
}Expand description
A format-neutral pixel layout whose channel, alpha, chroma, and plane relationships are fixed by its variant.
Variants§
Gray
One full-resolution gray plane.
Fields
sample: SampleStorageGray sample storage.
GrayAlphaInterleaved
One full-resolution interleaved gray/alpha plane.
Fields
sample: SampleStorageShared gray and alpha storage.
order: GrayAlphaOrderInterleaved channel order.
alpha: AlphaAssociationAlpha association.
GrayAlphaPlanar
Separate full-resolution gray and alpha planes, in that order.
Fields
gray: SampleStorageGray-plane storage.
alpha_sample: SampleStorageAlpha-plane storage.
alpha: AlphaAssociationAlpha association.
RgbInterleaved
One full-resolution interleaved RGB plane.
RgbPlanar
Separate full-resolution R, G, and B planes, in that order.
Fields
sample: SampleStorageShared channel storage.
RgbaInterleaved
One full-resolution interleaved RGB/alpha plane.
RgbaPlanar
Separate full-resolution R, G, B, and alpha planes, in that order.
Fields
color: SampleStorageShared RGB-plane storage.
alpha_sample: SampleStorageAlpha-plane storage.
alpha: AlphaAssociationAlpha association.
YcbcrPlanar
Separate Y, Cb, and Cr planes, in that order.
Fields
luma: SampleStorageLuma-plane storage.
chroma: SampleStorageShared chroma-plane storage.
subsampling: ChromaSubsamplingChroma sampling factors.
YcbcrSemiPlanar
A full-resolution Y plane followed by one interleaved chroma plane.
Fields
luma: SampleStorageLuma-plane storage.
chroma: SampleStorageChroma-plane channel storage.
subsampling: ChromaSubsamplingChroma sampling factors.
order: ChromaOrderInterleaved chroma order.
YcbcrAlphaPlanar
Separate Y, Cb, Cr, and full-resolution alpha planes, in that order.
Fields
luma: SampleStorageLuma-plane storage.
chroma: SampleStorageShared chroma-plane storage.
alpha_sample: SampleStorageAlpha-plane storage.
subsampling: ChromaSubsamplingChroma sampling factors.
alpha: AlphaAssociationAlpha association.
YcbcrAlphaSemiPlanar
Y, interleaved chroma, and full-resolution alpha planes, in that order.
Fields
luma: SampleStorageLuma-plane storage.
chroma: SampleStorageChroma-plane channel storage.
alpha_sample: SampleStorageAlpha-plane storage.
subsampling: ChromaSubsamplingChroma sampling factors.
order: ChromaOrderInterleaved chroma order.
alpha: AlphaAssociationAlpha association.
Implementations§
Source§impl PixelLayout
impl PixelLayout
Sourcepub const fn plane_count(self) -> u8
pub const fn plane_count(self) -> u8
Returns the exact number of planes required by the variant.
Sourcepub const fn alpha_association(self) -> Option<AlphaAssociation>
pub const fn alpha_association(self) -> Option<AlphaAssociation>
Returns the alpha association only for layouts that contain alpha.
Sourcepub const fn chroma_subsampling(self) -> Option<ChromaSubsampling>
pub const fn chroma_subsampling(self) -> Option<ChromaSubsampling>
Returns chroma subsampling only for YCbCr layouts.
Sourcepub const fn plane(self, index: u8) -> Option<PixelPlane>
pub const fn plane(self, index: u8) -> Option<PixelPlane>
Returns one logical plane, or None when the index is out of range.
Sourcepub fn validate_planes(
self,
image: Dimensions,
planes: &[PlaneLayout],
) -> PixelLayoutResult<OutputLength>
pub fn validate_planes( self, image: Dimensions, planes: &[PlaneLayout], ) -> PixelLayoutResult<OutputLength>
Validates concrete byte planes against the exact logical layout.
Plane count, sampled row count, and tightly packed used row bytes must
match. Stride padding and gaps between planes remain permitted by
PlaneLayout; overlap and ordering remain forbidden.
§Errors
Rejects mismatched plane relationships, row-size arithmetic failure, or invalid concrete plane ordering and overlap.