[][src]Struct pix::hwb::Hwb

pub struct Hwb {}

HWB color model.

The components are hue, whiteness, blackness and optional alpha.

Methods

impl Hwb[src]

pub fn hue<P>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the hue component.

Hue is divided into 6 equal intervals arranged into a circle of degrees:

  • 0: Red
  • 60: Yellow
  • 120: Green
  • 180: Cyan
  • 240: Blue
  • 300: Magenta

The degrees are mapped from Channel::MIN (0) to Channel::MAX (360)

Example: HWB Hue

use pix::chan::Ch32;
use pix::hwb::{Hwb, Hwb32};

let p = Hwb32::new(0.25, 0.5, 1.0);
assert_eq!(Hwb::hue(p), Ch32::new(0.25));

pub fn hue_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the hue component.

Example: Modify HWB Hue

use pix::chan::{Ch32, Channel};
use pix::hwb::{Hwb, Hwb32};

let mut p = Hwb32::new(0.75, 0.5, 0.5);
let mut h = Hwb::hue_mut(&mut p);
*h = h.wrapping_add(0.5.into());
assert_eq!(Hwb::hue(p), Ch32::new(0.25));

pub fn whiteness<P: Pixel>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the whiteness component.

This is the amount of whiteness mixed in with a "pure" hue.

Example: HWB Whiteness

use pix::chan::Ch16;
use pix::hwb::{Hwb, Hwb16};

let p = Hwb16::new(0x2000, 0x2345, 0x5432);
assert_eq!(Hwb::whiteness(p), Ch16::new(0x2345));

pub fn whiteness_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the whiteness component.

Example: Modify HWB Whiteness

use pix::chan::Ch16;
use pix::hwb::{Hwb, Hwb16};

let mut p = Hwb16::new(0x2000, 0x1234, 0x8000);
*Hwb::whiteness_mut(&mut p) = Ch16::new(0x4321);
assert_eq!(Hwb::whiteness(p), Ch16::new(0x4321));

pub fn blackness<P: Pixel>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the blackness component.

This is the amount of blackness mixed in with a "pure" hue.

Example: HWB Blackness

use pix::chan::Ch8;
use pix::hwb::{Hwb, Hwb8};

let p = Hwb8::new(0x43, 0x22, 0x19);
assert_eq!(Hwb::blackness(p), Ch8::new(0x19));

pub fn blackness_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the blackness component.

Example: Modify HWB Blackness

use pix::chan::Ch8;
use pix::hwb::{Hwb, Hwb8};

let mut p = Hwb8::new(0x93, 0x80, 0xA0);
*Hwb::blackness_mut(&mut p) = Ch8::new(0xBB);
assert_eq!(Hwb::blackness(p), Ch8::new(0xBB));

Trait Implementations

impl Clone for Hwb[src]

impl ColorModel for Hwb[src]

fn into_rgba<P>(p: P) -> PixRgba<P> where
    P: Pixel<Model = Self>, 
[src]

Convert into red, green, blue and alpha components

fn from_rgba<P>(rgba: PixRgba<P>) -> P where
    P: Pixel<Model = Self>, 
[src]

Convert from red, green, blue and alpha components

impl Copy for Hwb[src]

impl Debug for Hwb[src]

impl Default for Hwb[src]

impl PartialEq<Hwb> for Hwb[src]

impl StructuralPartialEq for Hwb[src]

Auto Trait Implementations

impl RefUnwindSafe for Hwb

impl Send for Hwb

impl Sync for Hwb

impl Unpin for Hwb

impl UnwindSafe for Hwb

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.