#[non_exhaustive]pub struct SampleClaims {
pub float: FloatClaims,
pub depth: Option<ExactDepth>,
pub all_opaque: bool,
pub all_grayscale: bool,
pub binary_alpha: bool,
}Expand description
Full re-export of zenpixels core types (zero module name collisions!).
Positive claims about active sample values, stored as inline image metadata.
Each true flag or populated field asserts its property. Self::NONE
carries no claims. Fill constructors seed these fields from known samples,
and callers can attach measured or caller-asserted values for conversion
plans to rely on.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.float: FloatClaimsClaimed floating-point invariants.
depth: Option<ExactDepth>Claimed exact integer code-grid depth (range-aware, separate color & alpha grids).
all_opaque: boolClaimed that every active alpha sample equals channel max (or layout has no meaningful alpha).
all_grayscale: boolClaimed that R == G == B for every pixel (or layout is already grayscale).
binary_alpha: boolClaimed that every active alpha sample is either 0 or channel max (binary transparency).
Implementations§
Source§impl SampleClaims
impl SampleClaims
Sourcepub const NONE: SampleClaims
pub const NONE: SampleClaims
Unknown / unclaimed sample properties.
Sourcepub const fn with_float(self, float: FloatClaims) -> SampleClaims
pub const fn with_float(self, float: FloatClaims) -> SampleClaims
Set floating-point claims.
Sourcepub fn with_depth(self, depth: impl Into<Option<ExactDepth>>) -> SampleClaims
pub fn with_depth(self, depth: impl Into<Option<ExactDepth>>) -> SampleClaims
Attach (or clear with None) an ExactDepth claim.
Accepts either ExactDepth directly or Option<ExactDepth>.
Sourcepub const fn for_black_format(format: &PixelFormat) -> SampleClaims
pub const fn for_black_format(format: &PixelFormat) -> SampleClaims
Claims guaranteed for a freshly allocated black-filled buffer of format (as produced by
PixelBuf::new: color channels zeroed and AlphaMode::Opaque
alpha slots initialized to channel maximum).
Sourcepub const fn for_signal_white_format(format: &PixelFormat) -> SampleClaims
pub const fn for_signal_white_format(format: &PixelFormat) -> SampleClaims
Claims guaranteed for a freshly allocated signal-white-filled buffer of format
(color channels filled with the format’s nominal signal-white sample pattern and alpha
filled to channel maximum).
Sourcepub const fn from_float(float: FloatClaims) -> SampleClaims
pub const fn from_float(float: FloatClaims) -> SampleClaims
Construct claims carrying only FloatClaims.
Sourcepub const fn from_depth(depth: ExactDepth) -> SampleClaims
pub const fn from_depth(depth: ExactDepth) -> SampleClaims
Construct claims carrying ExactDepth.
Sourcepub const fn with_all_opaque(self, all_opaque: bool) -> SampleClaims
pub const fn with_all_opaque(self, all_opaque: bool) -> SampleClaims
Attach all_opaque claim (also implies binary_alpha when true).
Sourcepub const fn with_all_grayscale(self, all_grayscale: bool) -> SampleClaims
pub const fn with_all_grayscale(self, all_grayscale: bool) -> SampleClaims
Attach all_grayscale claim.
Sourcepub const fn with_binary_alpha(self, binary_alpha: bool) -> SampleClaims
pub const fn with_binary_alpha(self, binary_alpha: bool) -> SampleClaims
Attach binary_alpha claim.
Sourcepub const fn is_exact_at(self, color_bits: u8, alpha_bits: u8) -> bool
pub const fn is_exact_at(self, color_bits: u8, alpha_bits: u8) -> bool
Whether current full-range/narrow integer samples are claimed exact at color_bits and alpha_bits.
Sourcepub const fn is_color_exact_at(self, color_bits: u8) -> bool
pub const fn is_color_exact_at(self, color_bits: u8) -> bool
Whether current integer color channels are claimed exact at color_bits (ignoring alpha depth).
Sourcepub const fn union_disjoint_regions(
a: SampleClaims,
b: SampleClaims,
) -> SampleClaims
pub const fn union_disjoint_regions( a: SampleClaims, b: SampleClaims, ) -> SampleClaims
Combine claims from two disjoint regions or bands of the same image into claims guaranteed across their union.
Every property holds on the combined image iff it holds across both regions:
float: bitwise intersection (a.float.intersect(b.float))depth:ExactDepth::union_disjoint_regions(Noneif either is unclaimed or incompatible)all_opaque,all_grayscale,binary_alpha: logical AND (&&)
Sourcepub const fn intersect_same_buffer(
a: SampleClaims,
b: SampleClaims,
) -> SampleClaims
pub const fn intersect_same_buffer( a: SampleClaims, b: SampleClaims, ) -> SampleClaims
Combine two independent claim sets that both describe the same buffer into the tighter claim set.
float: bitwise union (a.float.union(b.float))depth:ExactDepth::intersect_same_bufferwhen both are present (or whichever is present)all_opaque,all_grayscale,binary_alpha: logical OR (||)
Trait Implementations§
Source§impl Clone for SampleClaims
impl Clone for SampleClaims
Source§fn clone(&self) -> SampleClaims
fn clone(&self) -> SampleClaims
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more