[−][src]Struct prisma::Alpha
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]
T: PosNormalChannelScalar,
InnerColor: Color,
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]
T: PosNormalChannelScalar + AbsDiffEq<Epsilon = InnerColor::Epsilon>,
InnerColor: Color + AbsDiffEq,
InnerColor::Epsilon: Clone + Float,
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl<T, InnerColor> Bounded for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + Bounded,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + Bounded,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T, InnerColor> Broadcast for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + HomogeneousColor<ChannelFormat = T> + Broadcast,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + HomogeneousColor<ChannelFormat = T> + Broadcast,
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]
T: PosNormalChannelScalar,
InnerColor: Color,
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
fn num_channels() -> u32
[src]
fn to_tuple(self) -> Self::ChannelsTuple
[src]
impl<T, InnerColor> Color4 for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color3,
[src]
T: PosNormalChannelScalar,
InnerColor: Color3,
impl<T> ConvertFromXyz<T, Alpha<T, Xyz<T>>> for SRgb<T> where
T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
[src]
T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
type OutputColor = Rgba<T>
The color type converted to.
fn convert_from_xyz_raw(&self, color: &Xyza<T>) -> Rgba<T>
[src]
fn convert_from_xyz(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
fn convert_from_xyz_linear(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
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]
T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding,
type OutputColor = Xyza<T>
The type to output. Always some form of Xyz
fn convert_to_xyz(&self, color: &EncodedColor<Rgba<T>, E>) -> Self::OutputColor
[src]
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]
T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq,
EIn: ColorEncoding + PartialEq,
type OutputColor = Xyza<T>
The type to output. Always some form of Xyz
fn convert_to_xyz(
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
[src]
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
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]
T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq,
EIn: ColorEncoding + PartialEq,
type OutputColor = Xyza<T>
The type to output. Always some form of Xyz
fn convert_to_xyz(
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
[src]
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
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]
T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq,
EIn: ColorEncoding + PartialEq,
type OutputColor = Xyza<T>
The type to output. Always some form of Xyz
fn convert_to_xyz(
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
[src]
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
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]
T: PosNormalChannelScalar + FreeChannelScalar + Float + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq,
EIn: ColorEncoding + PartialEq,
type OutputColor = Xyza<T>
The type to output. Always some form of Xyz
fn convert_to_xyz(
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
[src]
&self,
color: &EncodedColor<Rgba<T>, EIn>
) -> Self::OutputColor
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]
T: PosNormalChannelScalar + Default + Zero,
InnerColor: Color + Default + Zero,
impl<T, InnerColor> Deref for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color,
[src]
T: PosNormalChannelScalar,
InnerColor: Color,
impl<T, InnerColor> DerefMut for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color,
[src]
T: PosNormalChannelScalar,
InnerColor: Color,
impl<T, InnerColor> Display for Alpha<T, InnerColor> where
T: PosNormalChannelScalar + Display,
InnerColor: Color + Display,
[src]
T: PosNormalChannelScalar + Display,
InnerColor: Color + Display,
impl<T, InnerColor> EncodableColor for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: EncodableColor,
[src]
T: PosNormalChannelScalar,
InnerColor: EncodableColor,
fn encoded_as<E>(self, encoding: E) -> EncodedColor<Self, E> where
E: ColorEncoding,
[src]
E: ColorEncoding,
fn linear(self) -> EncodedColor<Self, LinearEncoding>
[src]
fn srgb_encoded(self) -> EncodedColor<Self, SrgbEncoding>
[src]
fn gamma_encoded<T: Float>(
self,
gamma: T
) -> EncodedColor<Self, GammaEncoding<T>>
[src]
self,
gamma: T
) -> EncodedColor<Self, GammaEncoding<T>>
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]
T: PosNormalChannelScalar,
InnerColor: Color + Flatten + HomogeneousColor<ChannelFormat = T>,
fn as_slice(&self) -> &[Self::ChannelFormat]
[src]
fn from_slice(values: &[T]) -> Self
[src]
impl<T, InnerColor, InnerColor2> FromColor<Alpha<T, InnerColor2>> for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + FromColor<InnerColor2>,
InnerColor2: Color,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + FromColor<InnerColor2>,
InnerColor2: Color,
fn from_color(from: &Alpha<T, InnerColor2>) -> Self
[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]
T: PosNormalChannelScalar,
InnerColor: Color + FromHsi<Hsi<T, A>>,
A: AngularChannelScalar + Angle,
fn from_hsi(
from: &Alpha<T, Hsi<T, A>>,
out_of_gamut_mode: HsiOutOfGamutMode
) -> Self
[src]
from: &Alpha<T, Hsi<T, A>>,
out_of_gamut_mode: HsiOutOfGamutMode
) -> Self
impl<T, InnerColor> FromTuple for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + FromTuple,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + FromTuple,
fn from_tuple(values: Self::ChannelsTuple) -> Self
[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]
T: PosNormalChannelScalar + NormalChannelScalar,
InnerColor: Color + FromYCbCr<YCbCr<T, M>>,
M: YCbCrModel<T>,
fn from_ycbcr(
from: &Alpha<T, YCbCr<T, M>>,
out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Self
[src]
from: &Alpha<T, YCbCr<T, M>>,
out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Self
impl<T: Hash, InnerColor: Hash> Hash for Alpha<T, InnerColor>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T, InnerColor> HomogeneousColor for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + HomogeneousColor<ChannelFormat = T>,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + HomogeneousColor<ChannelFormat = T>,
impl<T, InnerColor> Invert for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + Invert,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + Invert,
impl<T, InnerColor> Lerp for Alpha<T, InnerColor> where
T: PosNormalChannelScalar + Lerp<Position = InnerColor::Position>,
InnerColor: Color + Lerp,
[src]
T: PosNormalChannelScalar + Lerp<Position = InnerColor::Position>,
InnerColor: Color + Lerp,
type Position = InnerColor::Position
The type of the pos
argument
fn lerp(&self, right: &Self, pos: Self::Position) -> Self
[src]
impl<T: Ord, InnerColor: Ord> Ord for Alpha<T, InnerColor>
[src]
fn cmp(&self, other: &Alpha<T, InnerColor>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq, InnerColor: PartialEq> PartialEq<Alpha<T, InnerColor>> for Alpha<T, InnerColor>
[src]
fn eq(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
fn ne(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
impl<T: PartialOrd, InnerColor: PartialOrd> PartialOrd<Alpha<T, InnerColor>> for Alpha<T, InnerColor>
[src]
fn partial_cmp(&self, other: &Alpha<T, InnerColor>) -> Option<Ordering>
[src]
fn lt(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
fn le(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
fn gt(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
fn ge(&self, other: &Alpha<T, InnerColor>) -> bool
[src]
impl<T, InnerColor> PolarColor for Alpha<T, InnerColor> where
T: PosNormalChannelScalar,
InnerColor: Color + PolarColor<Cartesian = T>,
[src]
T: PosNormalChannelScalar,
InnerColor: Color + PolarColor<Cartesian = T>,
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]
T: PosNormalChannelScalar + RelativeEq<Epsilon = InnerColor::Epsilon>,
InnerColor: Color + RelativeEq,
InnerColor::Epsilon: Clone + Float,
fn default_max_relative() -> Self::Epsilon
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
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]
T: PosNormalChannelScalar + UlpsEq<Epsilon = InnerColor::Epsilon>,
InnerColor: Color + UlpsEq,
InnerColor::Epsilon: Clone + Float,
Auto Trait Implementations
impl<T, InnerColor> RefUnwindSafe for Alpha<T, InnerColor> where
InnerColor: RefUnwindSafe,
T: RefUnwindSafe,
InnerColor: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, InnerColor> Send for Alpha<T, InnerColor> where
InnerColor: Send,
T: Send,
InnerColor: Send,
T: Send,
impl<T, InnerColor> Sync for Alpha<T, InnerColor> where
InnerColor: Sync,
T: Sync,
InnerColor: Sync,
T: Sync,
impl<T, InnerColor> Unpin for Alpha<T, InnerColor> where
InnerColor: Unpin,
T: Unpin,
InnerColor: Unpin,
T: Unpin,
impl<T, InnerColor> UnwindSafe for Alpha<T, InnerColor> where
InnerColor: UnwindSafe,
T: UnwindSafe,
InnerColor: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,