[][src]Struct pix::chan::Ch16

pub struct Ch16(_);

16-bit color Channel.

The Channel is represented by a u16, but multiplication and division treat values as though they range between 0 and 1.

use pix::chan::{Ch16, Ch32, Ch8, Channel};

let c: Ch16 = std::u16::MIN.into();
assert_eq!(c, Ch16::MIN);
let c: Ch8 = c.into();
assert_eq!(c, Ch8::MIN);
let c: Ch16 = std::u16::MAX.into();
assert_eq!(c, Ch16::MAX);
let c: Ch32 = c.into();
assert_eq!(c, Ch32::MAX);

Methods

impl Ch16[src]

pub const fn new(value: u16) -> Self[src]

Create a new 16-bit Channel value.

Trait Implementations

impl<R> Add<R> for Ch16 where
    Self: From<R>, 
[src]

type Output = Self

The resulting type after applying the + operator.

impl Channel for Ch16[src]

fn to_f32(self) -> f32[src]

Convert to f32

fn wrapping_add(self, rhs: Self) -> Self[src]

Wrapping addition

fn wrapping_sub(self, rhs: Self) -> Self[src]

Wrapping subtraction

fn encode_srgb(self) -> Self[src]

Encode an sRGB gamma value from linear intensity

fn decode_srgb(self) -> Self[src]

Decode an sRGB gamma value into linear intensity

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

Linear interpolation

impl Clone for Ch16[src]

impl Copy for Ch16[src]

impl Debug for Ch16[src]

impl Default for Ch16[src]

impl<R> Div<R> for Ch16 where
    Self: From<R>, 
[src]

type Output = Self

The resulting type after applying the / operator.

impl Eq for Ch16[src]

impl From<Ch16> for f32[src]

impl From<Ch16> for u16[src]

impl From<Ch16> for Ch8[src]

impl From<Ch16> for Ch32[src]

impl From<Ch32> for Ch16[src]

impl From<Ch8> for Ch16[src]

impl From<f32> for Ch16[src]

impl From<u16> for Ch16[src]

impl<R> Mul<R> for Ch16 where
    Self: From<R>, 
[src]

type Output = Self

The resulting type after applying the * operator.

impl Ord for Ch16[src]

impl PartialEq<Ch16> for Ch16[src]

impl PartialOrd<Ch16> for Ch16[src]

impl StructuralEq for Ch16[src]

impl StructuralPartialEq for Ch16[src]

impl<R> Sub<R> for Ch16 where
    Self: From<R>, 
[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Ch16

impl Send for Ch16

impl Sync for Ch16

impl Unpin for Ch16

impl UnwindSafe for Ch16

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.