#[non_exhaustive]pub struct CompactionReport { /* private fields */ }Expand description
Which channels and precision of a buffer’s declared PixelFormat are required
to represent its current pixel values without loss.
Each field is Option<bool>:
Some(false)— measured redundant (safe to drop/narrow without loss).Some(true)— measured required (keep).None— predicate did not apply / was not assessed (keep conservatively).
Implementations§
Source§impl CompactionReport
impl CompactionReport
Sourcepub const fn requires_alpha(&self) -> Option<bool>
pub const fn requires_alpha(&self) -> Option<bool>
Whether the measured image requires its alpha channel.
Sourcepub const fn requires_chroma(&self) -> Option<bool>
pub const fn requires_chroma(&self) -> Option<bool>
Whether the measured image requires chroma.
Sourcepub const fn requires_u16_precision(&self) -> Option<bool>
pub const fn requires_u16_precision(&self) -> Option<bool>
Whether the measured image requires 16-bit precision.
Sourcepub const fn any_analyzed(&self) -> bool
pub const fn any_analyzed(&self) -> bool
Whether at least one predicate ran or answered structurally.
Sourcepub fn candidate_format(&self, src: &PixelFormat) -> PixelFormat
pub fn candidate_format(&self, src: &PixelFormat) -> PixelFormat
Compute the narrowest candidate PixelFormat justified by this report (metadata only;
does not inspect or transform pixels). Pass the format of the image used to produce
this report. The candidate describes that image only.
Order of reduction:
- Full-range
U16 -> U8whenrequires_u16_precision == Some(false). - Alpha/padding drop (
RGBA/BGRA/RGBX/BGRX -> RGB,GrayAlpha -> Gray) whenrequires_alpha == Some(false). - Chroma drop (
RGB/BGR -> Gray,RGBA/BGRA/RGBX/BGRX -> GrayAlpha/Gray) whenrequires_chroma == Some(false)(only on structured D65Rgb/Gray;ColorSpace::Iccchroma collapse is gated separately by ICC class swapping).
Source§impl CompactionReport
impl CompactionReport
Sourcepub fn measure(view: &PixelView<'_>) -> Self
pub fn measure(view: &PixelView<'_>) -> Self
Measure which dimensions of view’s spec are actually required by its pixel values.
Sourcepub fn measure_with_pulse(
view: &PixelView<'_>,
pulse: Option<&dyn Pulse>,
) -> Result<Self, At<ConvertError>>
pub fn measure_with_pulse( view: &PixelView<'_>, pulse: Option<&dyn Pulse>, ) -> Result<Self, At<ConvertError>>
Measure which dimensions of view’s spec are actually required by its pixel values,
observing optional cooperative cancellation and row progress via pulse (pass None
when not needed).
Trait Implementations§
Source§impl Clone for CompactionReport
impl Clone for CompactionReport
Source§fn clone(&self) -> CompactionReport
fn clone(&self) -> CompactionReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more