[][src]Struct prisma::Alpha

#[repr(C)]pub struct Alpha<T, InnerColor> { /* fields omitted */ }

A wrapper around a color with an alpha channel

Alpha<T> makes it easy to add an alpha channel to any other color and share code between all color types. Alpha<T> implements Deref and DerefMut, making it able to act like the underlying color in many situations.

Implementations

impl<T, InnerColor> Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color
[src]

pub fn new(color: InnerColor, alpha: T) -> Self[src]

Construct an Alpha object from a color and an alpha value

pub fn decompose(self) -> (InnerColor, T)[src]

Break apart an Alpha into the inner color and alpha channel value

pub fn color(&self) -> &InnerColor[src]

Returns a reference to the inner color

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

Returns the alpha scalar

pub fn color_mut(&mut self) -> &mut InnerColor[src]

Returns a mutable reference to the inner color

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

Returns a mutable reference to the alpha scalar

pub fn set_color(&mut self, color: InnerColor)[src]

Set the inner color

pub fn set_alpha(&mut self, alpha: T)[src]

Set the alpha channel value

Trait Implementations

impl<T, InnerColor> AbsDiffEq<Alpha<T, InnerColor>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + AbsDiffEq<Epsilon = InnerColor::Epsilon>,
    InnerColor: Color + AbsDiffEq,
    InnerColor::Epsilon: Clone + Float
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T, InnerColor> Bounded for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + Bounded
[src]

impl<T, InnerColor> Broadcast for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + HomogeneousColor<ChannelFormat = T> + Broadcast
[src]

impl<T: Clone, InnerColor: Clone> Clone for Alpha<T, InnerColor>[src]

impl<T, InnerColor> Color for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color
[src]

type Tag = AlphaTag<InnerColor::Tag>

The unique tag unit struct identifying the color type

type ChannelsTuple = (InnerColor::ChannelsTuple, T)

A tuple of types for each channel in the color

impl<T, InnerColor> Color4 for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color3
[src]

impl<T> ConvertFromXyz<T, Alpha<T, Xyz<T>>> for SRgb<T> where
    T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>, 
[src]

type OutputColor = Rgba<T>

The color type converted to.

impl<T, E> ConvertToXyz<T, Alpha<T, Rgb<T>>, E> for SRgb<T> where
    T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>,
    E: ColorEncoding
[src]

type OutputColor = Xyza<T>

The type to output. Always some form of Xyz

impl<T, E, EIn> ConvertToXyz<T, Alpha<T, Rgb<T>>, EIn> for EncodedColorSpace<T, E> where
    T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>,
    E: ColorEncoding + PartialEq,
    EIn: ColorEncoding + PartialEq
[src]

type OutputColor = Xyza<T>

The type to output. Always some form of Xyz

impl<'a, T, E, EIn> ConvertToXyz<T, Alpha<T, Rgb<T>>, EIn> for &'a EncodedColorSpace<T, E> where
    T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>,
    E: ColorEncoding + PartialEq,
    EIn: ColorEncoding + PartialEq
[src]

type OutputColor = Xyza<T>

The type to output. Always some form of Xyz

impl<T, E, EIn> ConvertToXyz<T, Alpha<T, Rgb<T>>, EIn> for Rc<EncodedColorSpace<T, E>> where
    T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>,
    E: ColorEncoding + PartialEq,
    EIn: ColorEncoding + PartialEq
[src]

type OutputColor = Xyza<T>

The type to output. Always some form of Xyz

impl<T, E, EIn> ConvertToXyz<T, Alpha<T, Rgb<T>>, EIn> for Arc<EncodedColorSpace<T, E>> where
    T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>,
    E: ColorEncoding + PartialEq,
    EIn: ColorEncoding + PartialEq
[src]

type OutputColor = Xyza<T>

The type to output. Always some form of Xyz

impl<T: Copy, InnerColor: Copy> Copy for Alpha<T, InnerColor>[src]

impl<T: Debug, InnerColor: Debug> Debug for Alpha<T, InnerColor>[src]

impl<T, InnerColor> Default for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + Default + Zero,
    InnerColor: Color + Default + Zero
[src]

impl<T, InnerColor> Deref for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color
[src]

type Target = InnerColor

The resulting type after dereferencing.

impl<T, InnerColor> DerefMut for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color
[src]

impl<T, InnerColor> Display for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + Display,
    InnerColor: Color + Display
[src]

impl<T, InnerColor> EncodableColor for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: EncodableColor
[src]

impl<T: Eq, InnerColor: Eq> Eq for Alpha<T, InnerColor>[src]

impl<T, InnerColor> Flatten for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + Flatten + HomogeneousColor<ChannelFormat = T>, 
[src]

impl<T, InnerColor, InnerColor2> FromColor<Alpha<T, InnerColor2>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + FromColor<InnerColor2>,
    InnerColor2: Color
[src]

impl<T, InnerColor, A> FromHsi<Alpha<T, Hsi<T, A>>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + FromHsi<Hsi<T, A>>,
    A: AngularChannelScalar + Angle
[src]

impl<T, InnerColor> FromTuple for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + FromTuple
[src]

impl<T, InnerColor, M> FromYCbCr<Alpha<T, YCbCr<T, M>>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + NormalChannelScalar,
    InnerColor: Color + FromYCbCr<YCbCr<T, M>>,
    M: YCbCrModel<T>, 
[src]

impl<T: Hash, InnerColor: Hash> Hash for Alpha<T, InnerColor>[src]

impl<T, InnerColor> HomogeneousColor for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + HomogeneousColor<ChannelFormat = T>, 
[src]

type ChannelFormat = T

The scalar type of each channel

impl<T, InnerColor> Invert for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + Invert
[src]

impl<T, InnerColor> Lerp for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + Lerp<Position = InnerColor::Position>,
    InnerColor: Color + Lerp
[src]

type Position = InnerColor::Position

The type of the pos argument

impl<T: Ord, InnerColor: Ord> Ord for Alpha<T, InnerColor>[src]

impl<T: PartialEq, InnerColor: PartialEq> PartialEq<Alpha<T, InnerColor>> for Alpha<T, InnerColor>[src]

impl<T: PartialOrd, InnerColor: PartialOrd> PartialOrd<Alpha<T, InnerColor>> for Alpha<T, InnerColor>[src]

impl<T, InnerColor> PolarColor for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar,
    InnerColor: Color + PolarColor<Cartesian = T>, 
[src]

type Angular = InnerColor::Angular

The angular channel's scalar type

type Cartesian = InnerColor::Cartesian

The remaining channels' scalar types

impl<T, InnerColor> RelativeEq<Alpha<T, InnerColor>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + RelativeEq<Epsilon = InnerColor::Epsilon>,
    InnerColor: Color + RelativeEq,
    InnerColor::Epsilon: Clone + Float
[src]

impl<T, InnerColor> StructuralEq for Alpha<T, InnerColor>[src]

impl<T, InnerColor> StructuralPartialEq for Alpha<T, InnerColor>[src]

impl<T, InnerColor> UlpsEq<Alpha<T, InnerColor>> for Alpha<T, InnerColor> where
    T: PosNormalChannelScalar + UlpsEq<Epsilon = InnerColor::Epsilon>,
    InnerColor: Color + UlpsEq,
    InnerColor::Epsilon: Clone + Float
[src]

Auto Trait Implementations

impl<T, InnerColor> RefUnwindSafe for Alpha<T, InnerColor> where
    InnerColor: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, InnerColor> Send for Alpha<T, InnerColor> where
    InnerColor: Send,
    T: Send

impl<T, InnerColor> Sync for Alpha<T, InnerColor> where
    InnerColor: Sync,
    T: Sync

impl<T, InnerColor> Unpin for Alpha<T, InnerColor> where
    InnerColor: Unpin,
    T: Unpin

impl<T, InnerColor> UnwindSafe for Alpha<T, InnerColor> where
    InnerColor: 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.