[][src]Struct prisma::Hwb

#[repr(C)]pub struct Hwb<T, A = Deg<T>> { /* fields omitted */ }

The HWB device-dependent polar color model

HWB is defined by a hue (base color), whiteness and blackness. HWB is a conical space that is not distorted into a cylinder like HSV and HSL are, but with the property that any value of W+B greater than 1 loses any chroma and is technically not inside the space. HWB is a relatively recent color model, and was designed to be easy for a human to reason about and use to build colors.

Hwb takes two type parameters: the cartesian channel scalar, and an angular channel scalar.

Hwb is in the same color space and encoding as the parent RGB space, it is merely a geometric transformation and distortion.

Implementations

impl<T, A> Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

pub fn new(hue: A, whiteness: T, blackness: T) -> Self[src]

Construct a Hwb instance from hue, whiteness and blackness

pub fn color_cast<TOut, AOut>(&self) -> Hwb<TOut, AOut> where
    T: ChannelFormatCast<TOut>,
    A: ChannelFormatCast<AOut>,
    AOut: AngularChannelScalar,
    TOut: PosNormalChannelScalar
[src]

Convert the internal channel scalar format

pub fn hue(&self) -> A[src]

Returns the hue scalar

pub fn whiteness(&self) -> T[src]

Returns the whiteness scalar

pub fn blackness(&self) -> T[src]

Returns the blackness scalar

pub fn hue_mut(&mut self) -> &mut A[src]

Returns a mutable reference to the hue channel scalar

pub fn whiteness_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the white channel scalar

pub fn blackness_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the black channel scalar

pub fn set_hue(&mut self, val: A)[src]

Set the hue channel value

pub fn set_whiteness(&mut self, val: T)[src]

Set the whiteness channel value

pub fn set_blackness(&mut self, val: T)[src]

Set the blackness channel value

impl<T, A> Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

pub fn wb_needs_rescaled(&self) -> bool[src]

Returns whether the whiteness + blackness is outside the cylinder (greater than 1)

pub fn rescale_wb(self) -> Self[src]

Rescale such that whiteness + blackness is no greater than 1

Trait Implementations

impl<T, A> AbsDiffEq<Hwb<T, A>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + AbsDiffEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + AbsDiffEq,
    A::Epsilon: Clone + Float
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T, A> Bounded for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T: Clone, A: Clone> Clone for Hwb<T, A>[src]

impl<T, A> Color for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

type Tag = HwbTag

The unique tag unit struct identifying the color type

type ChannelsTuple = (A, T, T)

A tuple of types for each channel in the color

impl<T: Copy, A: Copy> Copy for Hwb<T, A>[src]

impl<T: Debug, A: Debug> Debug for Hwb<T, A>[src]

impl<T, A> Default for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + Zero,
    A: AngularChannelScalar + Zero
[src]

impl<T, A> Display for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + Display,
    A: AngularChannelScalar + Display
[src]

impl<T, A> EncodableColor for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + Angle<Scalar = T> + FromAngle<Turns<T>>, 
[src]

impl<T, A> From<Hwb<T, A>> for Rgb<T> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> From<Rgb<T>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + FromAngle<Turns<T>>, 
[src]

impl<T, A> FromColor<Hsv<T, A>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> FromColor<Hwb<T, A>> for Rgb<T> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> FromColor<Hwb<T, A>> for Hsv<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> FromColor<Rgb<T>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + FromAngle<Turns<T>>, 
[src]

impl<T, A> FromTuple for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T: Hash, A: Hash> Hash for Hwb<T, A>[src]

impl<T, A> Invert for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> Lerp for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + Lerp,
    A: AngularChannelScalar + Lerp
[src]

type Position = A::Position

The type of the pos argument

impl<T: PartialEq, A: PartialEq> PartialEq<Hwb<T, A>> for Hwb<T, A>[src]

impl<T: PartialOrd, A: PartialOrd> PartialOrd<Hwb<T, A>> for Hwb<T, A>[src]

impl<T, A> PolarColor for Hwb<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

type Angular = A

The angular channel's scalar type

type Cartesian = T

The remaining channels' scalar types

impl<T, A> RelativeEq<Hwb<T, A>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + RelativeEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + RelativeEq,
    A::Epsilon: Clone + Float
[src]

impl<T, A> StructuralPartialEq for Hwb<T, A>[src]

impl<T, A> UlpsEq<Hwb<T, A>> for Hwb<T, A> where
    T: PosNormalChannelScalar + Float + UlpsEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + UlpsEq,
    A::Epsilon: Clone + Float
[src]

Auto Trait Implementations

impl<T, A> RefUnwindSafe for Hwb<T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, A> Send for Hwb<T, A> where
    A: Send,
    T: Send

impl<T, A> Sync for Hwb<T, A> where
    A: Sync,
    T: Sync

impl<T, A> Unpin for Hwb<T, A> where
    A: Unpin,
    T: Unpin

impl<T, A> UnwindSafe for Hwb<T, A> where
    A: UnwindSafe,
    T: UnwindSafe

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> ToString for T where
    T: Display + ?Sized
[src]

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.