Trait pix::chan::Channel

source ·
pub trait Channel: Copy + Debug + Default + From<f32> + Ord + Add<Output = Self> + Div<Output = Self> + Mul<Output = Self> + Sub<Output = Self> + Sealed {
    const MIN: Self;
    const MID: Self;
    const MAX: Self;

    // Required methods
    fn to_f32(self) -> f32;
    fn wrapping_add(self, rhs: Self) -> Self;
    fn wrapping_sub(self, rhs: Self) -> Self;
    fn encode_srgb(self) -> Self;
    fn decode_srgb(self) -> Self;
    fn lerp(self, rhs: Self, t: Self) -> Self;
}
Expand description

Component of a color model, such as red, green, etc.

Existing Channels are Ch8, Ch16 and Ch32.

This trait is sealed, and cannot be implemented outside of this crate.

Required Associated Constants§

source

const MIN: Self

Minimum intensity (zero)

source

const MID: Self

Mid intensity

source

const MAX: Self

Maximum intensity (one)

Required Methods§

source

fn to_f32(self) -> f32

Convert to f32

source

fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition

source

fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction

source

fn encode_srgb(self) -> Self

Encode an sRGB gamma value from linear intensity

source

fn decode_srgb(self) -> Self

Decode an sRGB gamma value into linear intensity

source

fn lerp(self, rhs: Self, t: Self) -> Self

Linear interpolation

Implementors§

source§

impl Channel for Ch8

source§

const MIN: Ch8 = _

source§

const MID: Ch8 = _

source§

const MAX: Ch8 = _

source§

impl Channel for Ch16

source§

const MIN: Ch16 = _

source§

const MID: Ch16 = _

source§

const MAX: Ch16 = _

source§

impl Channel for Ch32

source§

const MIN: Ch32 = _

source§

const MID: Ch32 = _

source§

const MAX: Ch32 = _