Skip to main content

PixelScanExt

Trait PixelScanExt 

Source
pub trait PixelScanExt: Sealed {
    // Required methods
    fn measure_claims(&self) -> SampleClaims;
    fn measure_and_attach_claims(&mut self) -> SampleClaims;
    fn check_samples(&self, bounds: SampleBounds) -> Result<(), PixelCheckError>;
    fn verify_claims(
        &self,
        required: SampleClaims,
    ) -> Result<(), ClaimVerificationError>;

    // Provided method
    fn check_nominal_samples(&self) -> Result<(), PixelCheckError> { ... }
}
Expand description

Measure sample facts and validate samples on a borrowed view or owned interleaved buffer.

Required Methods§

Source

fn measure_claims(&self) -> SampleClaims

Scan active pixels and return fresh evidence about opacity, grayscale, binary alpha, float values, and exact integer code depth.

The scan reads supported stored alpha samples even when the format declares AlphaMode::Opaque. It ignores padding in strided rows and applies SIMD predicates where available. Use measure_and_attach_claims to store the result.

Source

fn measure_and_attach_claims(&mut self) -> SampleClaims

Replace the attached claims with the result of measure_claims and return those fresh facts. On a view, updates the view’s own metadata.

Source

fn check_samples(&self, bounds: SampleBounds) -> Result<(), PixelCheckError>

Check stored values against the requested SampleBounds.

Reads the current samples when their layout alone cannot establish a bound. Attached facts play no role. On failure, locate the offending pixel in the reported row and return its view-relative rectangle.

Source

fn verify_claims( &self, required: SampleClaims, ) -> Result<(), ClaimVerificationError>

Check caller-supplied facts directly against stored samples.

Pass view.attached_claims() to audit previously attached claims. A false flag leaves that property unspecified. Use this to check only the properties a conversion needs. For example, an all-opaque claim checks stored alpha independently of color bounds, grayscale, and exact depth. Exact depth is checked against the requested code grid, including when the measured minimum depth differs.

Provided Methods§

Source

fn check_nominal_samples(&self) -> Result<(), PixelCheckError>

Check nominal sample bounds and report the bad pixel on failure.

Equivalent to check_samples(SampleBounds::Nominal).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§