pub trait PixelFormat: Send + Sync {
type InputPixel: Send + Sync + Copy;
type OutputPixel: Default + Send + Sync + Copy;
type Accumulator: Send + Sync + Copy;
// Required methods
fn new() -> Self::Accumulator;
fn add(
&self,
acc: &mut Self::Accumulator,
inp: Self::InputPixel,
coeff: f32,
);
fn add_acc(acc: &mut Self::Accumulator, inp: Self::Accumulator, coeff: f32);
fn into_pixel(&self, acc: Self::Accumulator) -> Self::OutputPixel;
}
Expand description
Use Pixel
presets to specify pixel format.
The trait represents a temporary object that adds pixels together.
Required Associated Types§
Sourcetype InputPixel: Send + Sync + Copy
type InputPixel: Send + Sync + Copy
Pixel type in the source image
Sourcetype OutputPixel: Default + Send + Sync + Copy
type OutputPixel: Default + Send + Sync + Copy
Pixel type in the destination image (usually the same as Input)
Sourcetype Accumulator: Send + Sync + Copy
type Accumulator: Send + Sync + Copy
Temporary struct for the pixel in floating-point
Required Methods§
Sourcefn new() -> Self::Accumulator
fn new() -> Self::Accumulator
Create new floating-point pixel
Sourcefn add(&self, acc: &mut Self::Accumulator, inp: Self::InputPixel, coeff: f32)
fn add(&self, acc: &mut Self::Accumulator, inp: Self::InputPixel, coeff: f32)
Add new pixel with a given weight (first axis)
Sourcefn add_acc(acc: &mut Self::Accumulator, inp: Self::Accumulator, coeff: f32)
fn add_acc(acc: &mut Self::Accumulator, inp: Self::Accumulator, coeff: f32)
Add bunch of accumulated pixels with a weight (second axis)
Sourcefn into_pixel(&self, acc: Self::Accumulator) -> Self::OutputPixel
fn into_pixel(&self, acc: Self::Accumulator) -> Self::OutputPixel
Finalize, convert to output pixel format
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.