pub trait Sample:
Copy
+ Clone
+ PartialOrd
+ Default
+ Send
+ Sync
+ 'static
+ Into<f32>
+ FromF32 {
const MAX: Self;
const MIN: Self;
const BIT_DEPTH: u8;
// Required methods
fn clamp_sample(self) -> Self;
fn from_normalized(v: f32) -> Self;
fn to_normalized(self) -> f32;
}Expand description
Trait for scalar sample values used in image processing.
Implemented for u8, u16, and f32 — the common pixel sample types
in raw image processing pipelines.
Required Associated Constants§
Required Methods§
Sourcefn clamp_sample(self) -> Self
fn clamp_sample(self) -> Self
Clamp a value to the valid range.
Sourcefn from_normalized(v: f32) -> Self
fn from_normalized(v: f32) -> Self
Convert from a normalized f32 value in [0.0, 1.0] to this sample type.
Sourcefn to_normalized(self) -> f32
fn to_normalized(self) -> f32
Convert this sample to a normalized f32 value in [0.0, 1.0].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".