Trait color::Channel

source ·
pub trait Channel: Copy + Sized + PartialOrd + PartialEq {
    type NearestFloat: Float + Channel;

    const CHANNEL_MAX: Self;
Show 17 methods // Required methods fn from<T: Channel>(chan: T) -> Self; fn to_channel_u8(self) -> u8; fn to_channel_u16(self) -> u16; fn to_channel_u32(self) -> u32; fn to_channel_f16(self) -> f16; fn to_channel_f32(self) -> f32; fn to_channel_f64(self) -> f64; fn to_nearest_precision_float(self) -> Self::NearestFloat; fn invert_channel(self) -> Self; fn mix(self, rhs: Self, value: Self) -> Self; fn zero() -> Self; // Provided methods fn to_channel<T: Channel>(self) -> T { ... } fn clamp(self, lo: Self, hi: Self) -> Self { ... } fn normalized_mul(self, rhs: Self) -> Self { ... } fn normalized_div(self, rhs: Self) -> Self { ... } fn channel_min(self, rhs: Self) -> Self { ... } fn channel_max(self, rhs: Self) -> Self { ... }
}

Required Associated Types§

Required Associated Constants§

source

const CHANNEL_MAX: Self

Required Methods§

source

fn from<T: Channel>(chan: T) -> Self

source

fn to_channel_u8(self) -> u8

source

fn to_channel_u16(self) -> u16

source

fn to_channel_u32(self) -> u32

source

fn to_channel_f16(self) -> f16

source

fn to_channel_f32(self) -> f32

source

fn to_channel_f64(self) -> f64

source

fn to_nearest_precision_float(self) -> Self::NearestFloat

source

fn invert_channel(self) -> Self

source

fn mix(self, rhs: Self, value: Self) -> Self

source

fn zero() -> Self

Provided Methods§

source

fn to_channel<T: Channel>(self) -> T

source

fn clamp(self, lo: Self, hi: Self) -> Self

source

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

source

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

source

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

source

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

Implementations on Foreign Types§

source§

impl Channel for u8

§

type NearestFloat = f32

source§

const CHANNEL_MAX: Self = 255u8

source§

fn from<T: Channel>(chan: T) -> u8

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> u8

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

source§

impl Channel for u32

§

type NearestFloat = f32

source§

const CHANNEL_MAX: Self = 4_294_967_295u32

source§

fn from<T: Channel>(chan: T) -> u32

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> u32

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

source§

impl Channel for f64

§

type NearestFloat = f64

source§

const CHANNEL_MAX: Self = 1f64

source§

fn from<T: Channel>(chan: T) -> f64

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> f64

source§

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

source§

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

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

source§

impl Channel for f32

§

type NearestFloat = f32

source§

const CHANNEL_MAX: Self = 1f32

source§

fn from<T: Channel>(chan: T) -> f32

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> f32

source§

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

source§

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

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

source§

impl Channel for f16

§

type NearestFloat = f32

source§

const CHANNEL_MAX: Self = f16::ONE

source§

fn from<T: Channel>(chan: T) -> f16

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> f16

source§

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

source§

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

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

source§

impl Channel for u16

§

type NearestFloat = f32

source§

const CHANNEL_MAX: Self = 65_535u16

source§

fn from<T: Channel>(chan: T) -> u16

source§

fn to_channel_u8(self) -> u8

source§

fn to_channel_u16(self) -> u16

source§

fn to_channel_u32(self) -> u32

source§

fn to_channel_f16(self) -> f16

source§

fn to_channel_f32(self) -> f32

source§

fn to_channel_f64(self) -> f64

source§

fn to_nearest_precision_float(self) -> Self::NearestFloat

source§

fn invert_channel(self) -> u16

source§

fn mix(self, rhs: Self, value: Self) -> Self

source§

fn zero() -> Self

Implementors§