[][src]Trait pix::Format

pub trait Format: Clone + Copy + Default + PartialEq + AlphaMode + GammaMode {
    type Chan: Channel;
    fn rgba(self) -> [Self::Chan; 4];
fn with_rgba(rgba: [Self::Chan; 4]) -> Self;
fn difference(self, rhs: Self) -> Self;
fn within_threshold(self, rhs: Self) -> bool; fn convert<C, F>(self) -> F
    where
        F: Format<Chan = C>,
        C: Channel + From<Self::Chan>
, { ... } }

Pixel format determines bit depth (Channel), color components, alpha mode, and gamma mode.

The naming scheme for type aliases goes:

The following types are defined:

Associated Types

type Chan: Channel

Channel type

Loading content...

Required methods

fn rgba(self) -> [Self::Chan; 4]

Get red, green, blue and alpha Channels

fn with_rgba(rgba: [Self::Chan; 4]) -> Self

Make a pixel with given RGBA Channels

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

Get channel-wise difference

fn within_threshold(self, rhs: Self) -> bool

Check if all Channels are within threshold

Loading content...

Provided methods

fn convert<C, F>(self) -> F where
    F: Format<Chan = C>,
    C: Channel + From<Self::Chan>, 

Convert a pixel from one Format to another

  • p Source pixel to convert.
Loading content...

Implementors

impl<C, A> Format for Mask<A> where
    C: Channel,
    A: Alpha<Chan = C> + From<C>, 
[src]

type Chan = C

fn rgba(self) -> [Self::Chan; 4][src]

Get red, green, blue and alpha Channels

fn with_rgba(rgba: [Self::Chan; 4]) -> Self[src]

Make a pixel with given RGBA Channels

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

Get channel-wise difference

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

Check if all Channels are within threshold

impl<C, A, M, G: GammaMode> Format for Rgb<C, A, M, G> where
    C: Channel,
    A: Alpha<Chan = C> + From<C>,
    M: AlphaMode
[src]

type Chan = C

fn rgba(self) -> [Self::Chan; 4][src]

Get red, green, blue and alpha Channels

fn with_rgba(rgba: [Self::Chan; 4]) -> Self[src]

Make a pixel with given RGBA Channels

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

Get channel-wise difference

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

Check if all Channels are within threshold

impl<C, A, M: AlphaMode, G: GammaMode> Format for Gray<C, A, M, G> where
    C: Channel,
    A: Alpha<Chan = C> + From<C>, 
[src]

type Chan = C

fn rgba(self) -> [Self::Chan; 4][src]

Get red, green, blue and alpha Channels

fn with_rgba(rgba: [Self::Chan; 4]) -> Self[src]

Make a pixel with given RGBA Channels

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

Get channel-wise difference

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

Check if all Channels are within threshold

Loading content...