#[repr(C)]pub struct Alpha<C, T> {
pub color: C,
pub alpha: T,
}
Expand description
An alpha component wrapper for colors.
Fields
color: C
The color.
alpha: T
The transparency component. 0.0 is fully transparent and 1.0 is fully opaque.
Implementations
sourceimpl<T, A> Alpha<Hsl<Srgb, T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Hsl<Srgb, T>, A> where
T: FloatComponent,
A: Component,
Hsla
implementations.
sourceimpl<S, T, A> Alpha<Hsl<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
impl<S, T, A> Alpha<Hsl<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
Hsla
implementations.
sourcepub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
lightness: T,
alpha: A
) -> Self
pub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
lightness: T,
alpha: A
) -> Self
Linear HSL and transparency.
sourcepub fn into_components(self) -> (RgbHue<T>, T, T, A)
pub fn into_components(self) -> (RgbHue<T>, T, T, A)
Convert to a (hue, saturation, lightness, alpha)
tuple.
sourcepub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, lightness, alpha): (H, T, T, A)
) -> Self
pub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, lightness, alpha): (H, T, T, A)
) -> Self
Convert from a (hue, saturation, lightness, alpha)
tuple.
sourceimpl<T, A> Alpha<Hsluv<D65, T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Hsluv<D65, T>, A> where
T: FloatComponent,
A: Component,
Hsluva
implementations.
sourceimpl<Wp, T, A> Alpha<Hsluv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Hsluv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Hsluva
implementations.
sourcepub fn with_wp<H: Into<LuvHue<T>>>(
hue: H,
saturation: T,
l: T,
alpha: A
) -> Self
pub fn with_wp<H: Into<LuvHue<T>>>(
hue: H,
saturation: T,
l: T,
alpha: A
) -> Self
HSLuv and transparency.
sourcepub fn into_components(self) -> (LuvHue<T>, T, T, A)
pub fn into_components(self) -> (LuvHue<T>, T, T, A)
Convert to a (hue, saturation, l, alpha)
tuple.
sourcepub fn from_components<H: Into<LuvHue<T>>>(
(hue, saturation, l, alpha): (H, T, T, A)
) -> Self
pub fn from_components<H: Into<LuvHue<T>>>(
(hue, saturation, l, alpha): (H, T, T, A)
) -> Self
Convert from a (hue, saturation, l, alpha)
tuple.
sourceimpl<T, A> Alpha<Hsv<Srgb, T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Hsv<Srgb, T>, A> where
T: FloatComponent,
A: Component,
Hsva
implementations.
sourceimpl<S, T, A> Alpha<Hsv<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
impl<S, T, A> Alpha<Hsv<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
Hsva
implementations.
sourcepub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
value: T,
alpha: A
) -> Self
pub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
value: T,
alpha: A
) -> Self
Linear HSV and transparency.
sourcepub fn into_components(self) -> (RgbHue<T>, T, T, A)
pub fn into_components(self) -> (RgbHue<T>, T, T, A)
Convert to a (hue, saturation, value, alpha)
tuple.
sourcepub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, value, alpha): (H, T, T, A)
) -> Self
pub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, value, alpha): (H, T, T, A)
) -> Self
Convert from a (hue, saturation, value, alpha)
tuple.
sourceimpl<T, A> Alpha<Hwb<Srgb, T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Hwb<Srgb, T>, A> where
T: FloatComponent,
A: Component,
Hwba
implementations.
sourceimpl<S, T, A> Alpha<Hwb<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
impl<S, T, A> Alpha<Hwb<S, T>, A> where
T: FloatComponent,
A: Component,
S: RgbStandard,
Hwba
implementations.
sourcepub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
whiteness: T,
blackness: T,
alpha: A
) -> Self
pub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
whiteness: T,
blackness: T,
alpha: A
) -> Self
Linear HWB and transparency.
sourcepub fn into_components(self) -> (RgbHue<T>, T, T, A)
pub fn into_components(self) -> (RgbHue<T>, T, T, A)
Convert to a (hue, whiteness, blackness, alpha)
tuple.
sourcepub fn from_components<H: Into<RgbHue<T>>>(
(hue, whiteness, blackness, alpha): (H, T, T, A)
) -> Self
pub fn from_components<H: Into<RgbHue<T>>>(
(hue, whiteness, blackness, alpha): (H, T, T, A)
) -> Self
Convert from a (hue, whiteness, blackness, alpha)
tuple.
sourceimpl<Wp, T, A> Alpha<Lab<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Lab<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Laba
implementations.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to a (L\*, a\*, b\*, alpha)
tuple.
sourcepub fn from_components((l, a, b, alpha): (T, T, T, A)) -> Self
pub fn from_components((l, a, b, alpha): (T, T, T, A)) -> Self
Convert from a (L\*, a\*, b\*, alpha)
tuple.
sourceimpl<Wp, T, A> Alpha<Lch<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Lch<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Lcha
implementations.
sourcepub fn with_wp<H: Into<LabHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
pub fn with_wp<H: Into<LabHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
CIE L*C*h° and transparency.
sourcepub fn into_components(self) -> (T, T, LabHue<T>, A)
pub fn into_components(self) -> (T, T, LabHue<T>, A)
Convert to a (L\*, C\*, h°, alpha)
tuple.
sourcepub fn from_components<H: Into<LabHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
pub fn from_components<H: Into<LabHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
Convert from a (L\*, C\*, h°, alpha)
tuple.
sourceimpl<T, A> Alpha<Lchuv<D65, T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Lchuv<D65, T>, A> where
T: FloatComponent,
A: Component,
Lchuva
implementations.
sourceimpl<Wp, T, A> Alpha<Lchuv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Lchuv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Lchuva
implementations.
sourcepub fn with_wp<H: Into<LuvHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
pub fn with_wp<H: Into<LuvHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
CIE L*C*uv h°uv and transparency.
sourcepub fn into_components(self) -> (T, T, LuvHue<T>, A)
pub fn into_components(self) -> (T, T, LuvHue<T>, A)
Convert to a (L\*, C\*uv, h°uv, alpha)
tuple.
sourcepub fn from_components<H: Into<LuvHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
pub fn from_components<H: Into<LuvHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
Convert from a (L\*, C\*uv, h°uv, alpha)
tuple.
sourceimpl<S, T, A> Alpha<Luma<S, T>, A> where
T: Component,
A: Component,
S: LumaStandard,
impl<S, T, A> Alpha<Luma<S, T>, A> where
T: Component,
A: Component,
S: LumaStandard,
Lumaa
implementations.
sourcepub fn into_format<U, B>(self) -> Alpha<Luma<S, U>, B> where
U: Component + FromComponent<T>,
B: Component + FromComponent<A>,
pub fn into_format<U, B>(self) -> Alpha<Luma<S, U>, B> where
U: Component + FromComponent<T>,
B: Component + FromComponent<A>,
Convert into another component type.
sourcepub fn from_format<U, B>(color: Alpha<Luma<S, U>, B>) -> Self where
T: FromComponent<U>,
U: Component,
A: FromComponent<B>,
B: Component,
pub fn from_format<U, B>(color: Alpha<Luma<S, U>, B>) -> Self where
T: FromComponent<U>,
U: Component,
A: FromComponent<B>,
B: Component,
Convert from another component type.
sourcepub fn into_components(self) -> (T, A)
pub fn into_components(self) -> (T, A)
Convert to a (luma, alpha)
tuple.
sourcepub fn from_components((luma, alpha): (T, A)) -> Self
pub fn from_components((luma, alpha): (T, A)) -> Self
Convert from a (luma, alpha)
tuple.
sourceimpl<S, T, A> Alpha<Luma<S, T>, A> where
T: FloatComponent,
A: Component,
S: LumaStandard,
impl<S, T, A> Alpha<Luma<S, T>, A> where
T: FloatComponent,
A: Component,
S: LumaStandard,
Lumaa
implementations.
sourcepub fn into_linear(self) -> Alpha<Luma<Linear<S::WhitePoint>, T>, A>
pub fn into_linear(self) -> Alpha<Luma<Linear<S::WhitePoint>, T>, A>
Convert the color to linear luminance with transparency.
sourcepub fn from_linear(
color: Alpha<Luma<Linear<S::WhitePoint>, T>, A>
) -> Alpha<Luma<S, T>, A>
pub fn from_linear(
color: Alpha<Luma<Linear<S::WhitePoint>, T>, A>
) -> Alpha<Luma<S, T>, A>
Convert linear luminance to non-linear luminance with transparency.
sourcepub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
self
) -> Alpha<Luma<St, T>, A>
pub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
self
) -> Alpha<Luma<St, T>, A>
Convert the color to a different encoding with transparency.
sourcepub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
color: Alpha<Luma<St, T>, A>
) -> Alpha<Luma<S, T>, A>
pub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
color: Alpha<Luma<St, T>, A>
) -> Alpha<Luma<S, T>, A>
Convert luminance from a different encoding with transparency.
sourceimpl<Wp, T, A> Alpha<Luv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Luv<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Luva
implementations.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to u (L\*, u\*, v\*, alpha)
tuple.
sourcepub fn from_components((l, u, v, alpha): (T, T, T, A)) -> Self
pub fn from_components((l, u, v, alpha): (T, T, T, A)) -> Self
Convert from u (L\*, u\*, v\*, alpha)
tuple.
sourceimpl<T, A> Alpha<Oklab<T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Oklab<T>, A> where
T: FloatComponent,
A: Component,
Oklaba
implementations.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to a (L, a, b, alpha)
tuple.
sourcepub fn from_components((l, a, b, alpha): (T, T, T, A)) -> Self
pub fn from_components((l, a, b, alpha): (T, T, T, A)) -> Self
Convert from a (L, a, b, alpha)
tuple.
sourceimpl<T, A> Alpha<Oklch<T>, A> where
T: FloatComponent,
A: Component,
impl<T, A> Alpha<Oklch<T>, A> where
T: FloatComponent,
A: Component,
Oklcha
implementations.
sourcepub fn new<H: Into<OklabHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
pub fn new<H: Into<OklabHue<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Self
Oklch and transparency.
sourcepub fn into_components(self) -> (T, T, OklabHue<T>, A)
pub fn into_components(self) -> (T, T, OklabHue<T>, A)
Convert to a (L, C, h, alpha)
tuple.
sourcepub fn from_components<H: Into<OklabHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
pub fn from_components<H: Into<OklabHue<T>>>(
(l, chroma, hue, alpha): (T, T, H, A)
) -> Self
Convert from a (L, C, h, alpha)
tuple.
sourceimpl<S: RgbStandard, T: Component, A: Component> Alpha<Rgb<S, T>, A>
impl<S: RgbStandard, T: Component, A: Component> Alpha<Rgb<S, T>, A>
Rgba
implementations.
sourcepub fn into_format<U, B>(self) -> Alpha<Rgb<S, U>, B> where
U: Component + FromComponent<T>,
B: Component + FromComponent<A>,
pub fn into_format<U, B>(self) -> Alpha<Rgb<S, U>, B> where
U: Component + FromComponent<T>,
B: Component + FromComponent<A>,
Convert into another component type.
sourcepub fn from_format<U, B>(color: Alpha<Rgb<S, U>, B>) -> Self where
T: FromComponent<U>,
U: Component,
A: FromComponent<B>,
B: Component,
pub fn from_format<U, B>(color: Alpha<Rgb<S, U>, B>) -> Self where
T: FromComponent<U>,
U: Component,
A: FromComponent<B>,
B: Component,
Convert from another component type.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to a (red, green, blue, alpha)
tuple.
sourcepub fn from_components((red, green, blue, alpha): (T, T, T, A)) -> Self
pub fn from_components((red, green, blue, alpha): (T, T, T, A)) -> Self
Convert from a (red, green, blue, alpha)
tuple.
sourceimpl<S: RgbStandard> Alpha<Rgb<S, T>, T>
impl<S: RgbStandard> Alpha<Rgb<S, T>, T>
Convenience functions to convert between a packed u32
and Rgba
.
use palette::Srgba;
let rgba = Srgba::from(0x607F00FF);
assert_eq!(Srgba::new(96u8, 127, 0, 255), rgba);
let integer = u32::from(rgba);
assert_eq!(0x607F00FF, integer);
sourcepub fn into_u32<C: RgbChannels>(self) -> u32
pub fn into_u32<C: RgbChannels>(self) -> u32
Convert to a packed u32
with with specifiable component order.
Defaults to ARGB ordering (0xAARRGGBB).
See Packed for more details.
sourcepub fn from_u32<C: RgbChannels>(color: u32) -> Self
pub fn from_u32<C: RgbChannels>(color: u32) -> Self
Convert from a packed u32
with specifiable component order. Defaults
to ARGB ordering (0xAARRGGBB).
See Packed for more details.
sourceimpl<S: RgbStandard, T: FloatComponent, A: Component> Alpha<Rgb<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, A: Component> Alpha<Rgb<S, T>, A>
Rgba
implementations.
sourcepub fn into_linear(self) -> Alpha<Rgb<Linear<S::Space>, T>, A>
pub fn into_linear(self) -> Alpha<Rgb<Linear<S::Space>, T>, A>
Convert the color to linear RGB with transparency.
sourcepub fn from_linear(color: Alpha<Rgb<Linear<S::Space>, T>, A>) -> Self
pub fn from_linear(color: Alpha<Rgb<Linear<S::Space>, T>, A>) -> Self
Convert linear RGB to non-linear RGB with transparency.
sourcepub fn into_encoding<St: RgbStandard<Space = S::Space>>(
self
) -> Alpha<Rgb<St, T>, A>
pub fn into_encoding<St: RgbStandard<Space = S::Space>>(
self
) -> Alpha<Rgb<St, T>, A>
Convert the color to a different encoding with transparency.
sourcepub fn from_encoding<St: RgbStandard<Space = S::Space>>(
color: Alpha<Rgb<St, T>, A>
) -> Self
pub fn from_encoding<St: RgbStandard<Space = S::Space>>(
color: Alpha<Rgb<St, T>, A>
) -> Self
Convert RGB from a different encoding with transparency.
sourceimpl<Wp, T, A> Alpha<Xyz<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Xyz<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Xyza
implementations.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to a (X, Y, Z, alpha)
tuple.
sourcepub fn from_components((x, y, z, alpha): (T, T, T, A)) -> Self
pub fn from_components((x, y, z, alpha): (T, T, T, A)) -> Self
Convert from a (X, Y, Z, alpha)
tuple.
sourceimpl<Wp, T, A> Alpha<Yxy<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
impl<Wp, T, A> Alpha<Yxy<Wp, T>, A> where
T: FloatComponent,
A: Component,
Wp: WhitePoint,
Yxya
implementations.
sourcepub fn into_components(self) -> (T, T, T, A)
pub fn into_components(self) -> (T, T, T, A)
Convert to a (x, y, luma)
, a.k.a. (x, y, Y)
tuple.
sourcepub fn from_components((x, y, luma, alpha): (T, T, T, A)) -> Self
pub fn from_components((x, y, luma, alpha): (T, T, T, A)) -> Self
Convert from a (x, y, luma)
, a.k.a. (x, y, Y)
tuple.
Trait Implementations
sourceimpl<C, T> AbsDiffEq<Alpha<C, T>> for Alpha<C, T> where
C: AbsDiffEq<Epsilon = T::Epsilon>,
T: AbsDiffEq,
T::Epsilon: Clone,
impl<C, T> AbsDiffEq<Alpha<C, T>> for Alpha<C, T> where
C: AbsDiffEq<Epsilon = T::Epsilon>,
T: AbsDiffEq,
T::Epsilon: Clone,
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl<C: AddAssign, T: Float + AddAssign> AddAssign<Alpha<C, T>> for Alpha<C, T>
impl<C: AddAssign, T: Float + AddAssign> AddAssign<Alpha<C, T>> for Alpha<C, T>
sourcefn add_assign(&mut self, other: Alpha<C, T>)
fn add_assign(&mut self, other: Alpha<C, T>)
Performs the +=
operation. Read more
sourceimpl<T: AddAssign + Copy, C: AddAssign<T>> AddAssign<T> for Alpha<C, T>
impl<T: AddAssign + Copy, C: AddAssign<T>> AddAssign<T> for Alpha<C, T>
sourcefn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
Performs the +=
operation. Read more
sourceimpl<C: Blend, T: Float> Blend for Alpha<C, T> where
C::Color: ComponentWise<Scalar = T>,
Alpha<C, T>: Into<Alpha<C::Color, T>> + From<Alpha<C::Color, T>>,
impl<C: Blend, T: Float> Blend for Alpha<C, T> where
C::Color: ComponentWise<Scalar = T>,
Alpha<C, T>: Into<Alpha<C::Color, T>> + From<Alpha<C::Color, T>>,
sourcefn into_premultiplied(self) -> PreAlpha<C::Color, T>
fn into_premultiplied(self) -> PreAlpha<C::Color, T>
Convert the color to premultiplied alpha.
sourcefn from_premultiplied(color: PreAlpha<C::Color, T>) -> Alpha<C, T>
fn from_premultiplied(color: PreAlpha<C::Color, T>) -> Alpha<C, T>
Convert the color from premultiplied alpha.
sourcefn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
fn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
Blend self, as the source color, with destination
, using
blend_function
. Anything that implements BlendFunction
is
acceptable, including functions and closures. Read more
sourcefn over(self, other: Self) -> Self
fn over(self, other: Self) -> Self
Place self
over other
. This is the good old common alpha
composition equation. Read more
sourcefn inside(self, other: Self) -> Self
fn inside(self, other: Self) -> Self
Results in the parts of self
that overlaps the visible parts of
other
. Read more
sourcefn outside(self, other: Self) -> Self
fn outside(self, other: Self) -> Self
Results in the parts of self
that lies outside the visible parts of
other
. Read more
sourcefn plus(self, other: Self) -> Self
fn plus(self, other: Self) -> Self
Add self
and other
. This uses the alpha component to regulate the
effect, so it’s not just plain component wise addition. Read more
sourcefn multiply(self, other: Self) -> Self
fn multiply(self, other: Self) -> Self
Multiply self
with other
. This uses the alpha component to regulate
the effect, so it’s not just plain component wise multiplication. Read more
sourcefn overlay(self, other: Self) -> Self
fn overlay(self, other: Self) -> Self
Multiply self
or other
if other is dark, or screen them if other
is light. This results in an S curve. Read more
sourcefn dodge(self, other: Self) -> Self
fn dodge(self, other: Self) -> Self
Lighten other
to reflect self
. Results in other
if self
is
black. Read more
sourcefn burn(self, other: Self) -> Self
fn burn(self, other: Self) -> Self
Darken other
to reflect self
. Results in other
if self
is
white. Read more
sourcefn hard_light(self, other: Self) -> Self
fn hard_light(self, other: Self) -> Self
Multiply self
or other
if other is dark, or screen them if self
is light. This is similar to overlay
, but depends on self
instead
of other
. Read more
sourcefn soft_light(self, other: Self) -> Self
fn soft_light(self, other: Self) -> Self
Lighten other
if self
is light, or darken other
as if it’s burned
if self
is dark. The effect is increased if the components of self
is further from 0.5. Read more
sourcefn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Return the absolute difference between self
and other
. It’s
basically abs(self - other)
, but regulated by the alpha component. Read more
sourceimpl<C: Clamp, T: Component> Clamp for Alpha<C, T>
impl<C: Clamp, T: Component> Clamp for Alpha<C, T>
sourcefn is_within_bounds(&self) -> bool
fn is_within_bounds(&self) -> bool
Check if the color’s components are within the expected clamped range bounds. Read more
sourcefn clamp(&self) -> Alpha<C, T>
fn clamp(&self) -> Alpha<C, T>
Return a new color where the components have been clamped to the nearest valid values. Read more
sourcefn clamp_self(&mut self)
fn clamp_self(&mut self)
Clamp the color’s components to the nearest valid values.
sourceimpl<C: ComponentWise<Scalar = T>, T: Clone> ComponentWise for Alpha<C, T>
impl<C: ComponentWise<Scalar = T>, T: Clone> ComponentWise for Alpha<C, T>
type Scalar = T
type Scalar = T
The scalar type for color components.
sourcefn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Alpha<C, T>,
f: F
) -> Alpha<C, T>
fn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Alpha<C, T>,
f: F
) -> Alpha<C, T>
Perform a binary operation on this and an other color.
sourcefn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Alpha<C, T>
fn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Alpha<C, T>
Perform a unary operation on this color.
sourceimpl<C: DivAssign, T: Float + DivAssign> DivAssign<Alpha<C, T>> for Alpha<C, T>
impl<C: DivAssign, T: Float + DivAssign> DivAssign<Alpha<C, T>> for Alpha<C, T>
sourcefn div_assign(&mut self, other: Alpha<C, T>)
fn div_assign(&mut self, other: Alpha<C, T>)
Performs the /=
operation. Read more
sourceimpl<T: DivAssign + Copy, C: DivAssign<T>> DivAssign<T> for Alpha<C, T>
impl<T: DivAssign + Copy, C: DivAssign<T>> DivAssign<T> for Alpha<C, T>
sourcefn div_assign(&mut self, c: T)
fn div_assign(&mut self, c: T)
Performs the /=
operation. Read more
sourceimpl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsl<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsl<S, T>, A>
sourcefn from(components: (H, T, T, A)) -> Self
fn from(components: (H, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, H: Into<LuvHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsluv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, H: Into<LuvHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsluv<Wp, T>, A>
sourcefn from(components: (H, T, T, A)) -> Self
fn from(components: (H, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsv<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hsv<S, T>, A>
sourcefn from(components: (H, T, T, A)) -> Self
fn from(components: (H, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hwb<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>, A: Component> From<(H, T, T, A)> for Alpha<Hwb<S, T>, A>
sourcefn from(components: (H, T, T, A)) -> Self
fn from(components: (H, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, H: Into<LabHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Lch<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, H: Into<LabHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Lch<Wp, T>, A>
sourcefn from(components: (T, T, H, A)) -> Self
fn from(components: (T, T, H, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, H: Into<LuvHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Lchuv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, H: Into<LuvHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Lchuv<Wp, T>, A>
sourcefn from(components: (T, T, H, A)) -> Self
fn from(components: (T, T, H, A)) -> Self
Converts to this type from the input type.
sourceimpl<T: FloatComponent, H: Into<OklabHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Oklch<T>, A>
impl<T: FloatComponent, H: Into<OklabHue<T>>, A: Component> From<(T, T, H, A)> for Alpha<Oklch<T>, A>
sourcefn from(components: (T, T, H, A)) -> Self
fn from(components: (T, T, H, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Lab<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Lab<Wp, T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Luv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Luv<Wp, T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Oklab<T>, A>
impl<T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Oklab<T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<S: RgbStandard, T: Component, A: Component> From<(T, T, T, A)> for Alpha<Rgb<S, T>, A>
impl<S: RgbStandard, T: Component, A: Component> From<(T, T, T, A)> for Alpha<Rgb<S, T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Yxy<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> From<(T, T, T, A)> for Alpha<Yxy<Wp, T>, A>
sourcefn from(components: (T, T, T, A)) -> Self
fn from(components: (T, T, T, A)) -> Self
Converts to this type from the input type.
sourceimpl<T, U> From<Alpha<Rgb<Linear<Srgb>, T>, T>> for Srgba<U> where
T: FloatComponent,
U: Component + FromComponent<T>,
impl<T, U> From<Alpha<Rgb<Linear<Srgb>, T>, T>> for Srgba<U> where
T: FloatComponent,
U: Component + FromComponent<T>,
sourceimpl<S, C> From<Alpha<Rgb<S, u8>, u8>> for Packed<C> where
S: RgbStandard,
C: RgbChannels,
impl<S, C> From<Alpha<Rgb<S, u8>, u8>> for Packed<C> where
S: RgbStandard,
C: RgbChannels,
sourceimpl<T, U> From<Alpha<Rgb<Srgb, T>, T>> for LinSrgba<U> where
T: FloatComponent,
U: Component + FromComponent<T>,
impl<T, U> From<Alpha<Rgb<Srgb, T>, T>> for LinSrgba<U> where
T: FloatComponent,
U: Component + FromComponent<T>,
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S: RgbStandard, T: Component, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Rgb<S, T> where
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S: RgbStandard, T: Component, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Rgb<S, T> where
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Yxy<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Yxy<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<C1: WithAlpha<T>, C2, T: Component> FromColorUnclamped<C1> for Alpha<C2, T> where
C1::Color: IntoColorUnclamped<C2>,
impl<C1: WithAlpha<T>, C2, T: Component> FromColorUnclamped<C1> for Alpha<C2, T> where
C1::Color: IntoColorUnclamped<C2>,
sourcefn from_color_unclamped(other: C1) -> Self
fn from_color_unclamped(other: C1) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(LuvHue<T>, T, T, A)> for Alpha<Hsluv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(LuvHue<T>, T, T, A)> for Alpha<Hsluv<Wp, T>, A>
sourceimpl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hsl<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hsl<S, T>, A>
sourceimpl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hsv<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hsv<S, T>, A>
sourceimpl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hwb<S, T>, A>
impl<S: RgbStandard, T: FloatComponent, A: Component> Into<(RgbHue<T>, T, T, A)> for Alpha<Hwb<S, T>, A>
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, LabHue<T>, A)> for Alpha<Lch<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, LabHue<T>, A)> for Alpha<Lch<Wp, T>, A>
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, LuvHue<T>, A)> for Alpha<Lchuv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, LuvHue<T>, A)> for Alpha<Lchuv<Wp, T>, A>
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Lab<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Lab<Wp, T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Luv<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Luv<Wp, T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Oklab<T>, A>
impl<T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Oklab<T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<S: RgbStandard, T: Component, A: Component> Into<(T, T, T, A)> for Alpha<Rgb<S, T>, A>
impl<S: RgbStandard, T: Component, A: Component> Into<(T, T, T, A)> for Alpha<Rgb<S, T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Yxy<Wp, T>, A>
impl<Wp: WhitePoint, T: FloatComponent, A: Component> Into<(T, T, T, A)> for Alpha<Yxy<Wp, T>, A>
sourcefn into(self) -> (T, T, T, A)
fn into(self) -> (T, T, T, A)
Converts this type into the (usually inferred) input type.
sourceimpl<C: MulAssign, T: Float + MulAssign> MulAssign<Alpha<C, T>> for Alpha<C, T>
impl<C: MulAssign, T: Float + MulAssign> MulAssign<Alpha<C, T>> for Alpha<C, T>
sourcefn mul_assign(&mut self, other: Alpha<C, T>)
fn mul_assign(&mut self, other: Alpha<C, T>)
Performs the *=
operation. Read more
sourceimpl<T: MulAssign + Copy, C: MulAssign<T>> MulAssign<T> for Alpha<C, T>
impl<T: MulAssign + Copy, C: MulAssign<T>> MulAssign<T> for Alpha<C, T>
sourcefn mul_assign(&mut self, c: T)
fn mul_assign(&mut self, c: T)
Performs the *=
operation. Read more
sourceimpl<T, C: Pixel<T>> Pixel<T> for Alpha<C, T>
impl<T, C: Pixel<T>> Pixel<T> for Alpha<C, T>
sourcefn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
Cast as a mutable reference to raw color components.
sourcefn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
Convert into raw color components.
sourcefn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
Cast from a reference to raw color components.
sourcefn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
Cast from a mutable reference to raw color components.
sourcefn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a slice of raw color components to a slice of colors. Read more
sourcefn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
sourceimpl<C, T> RelativeEq<Alpha<C, T>> for Alpha<C, T> where
C: RelativeEq<Epsilon = T::Epsilon>,
T: RelativeEq,
T::Epsilon: Clone,
impl<C, T> RelativeEq<Alpha<C, T>> for Alpha<C, T> where
C: RelativeEq<Epsilon = T::Epsilon>,
T: RelativeEq,
T::Epsilon: Clone,
sourcefn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Alpha<C, T>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Alpha<C, T>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
sourcefn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of RelativeEq::relative_eq
.
sourceimpl<C: Saturate> Saturate for Alpha<C, C::Scalar>
impl<C: Saturate> Saturate for Alpha<C, C::Scalar>
sourcefn saturate(&self, factor: C::Scalar) -> Alpha<C, C::Scalar>
fn saturate(&self, factor: C::Scalar) -> Alpha<C, C::Scalar>
Scale the color towards the maximum saturation by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn saturate_fixed(&self, amount: C::Scalar) -> Alpha<C, C::Scalar>
fn saturate_fixed(&self, amount: C::Scalar) -> Alpha<C, C::Scalar>
Increase the saturation by amount
, a value ranging from 0.0
to
1.0
. Read more
sourcefn desaturate(&self, factor: Self::Scalar) -> Self
fn desaturate(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum saturation by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn desaturate_fixed(&self, amount: Self::Scalar) -> Self
fn desaturate_fixed(&self, amount: Self::Scalar) -> Self
Increase the saturation by amount
, a value ranging from 0.0
to
1.0
. Read more
sourceimpl<C: Shade> Shade for Alpha<C, C::Scalar>
impl<C: Shade> Shade for Alpha<C, C::Scalar>
sourcefn lighten(&self, factor: C::Scalar) -> Alpha<C, C::Scalar>
fn lighten(&self, factor: C::Scalar) -> Alpha<C, C::Scalar>
Scale the color towards the maximum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn lighten_fixed(&self, amount: C::Scalar) -> Alpha<C, C::Scalar>
fn lighten_fixed(&self, amount: C::Scalar) -> Alpha<C, C::Scalar>
Lighten the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourcefn darken(&self, factor: Self::Scalar) -> Self
fn darken(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn darken_fixed(&self, amount: Self::Scalar) -> Self
fn darken_fixed(&self, amount: Self::Scalar) -> Self
Darken the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourceimpl<C: SubAssign, T: Float + SubAssign> SubAssign<Alpha<C, T>> for Alpha<C, T>
impl<C: SubAssign, T: Float + SubAssign> SubAssign<Alpha<C, T>> for Alpha<C, T>
sourcefn sub_assign(&mut self, other: Alpha<C, T>)
fn sub_assign(&mut self, other: Alpha<C, T>)
Performs the -=
operation. Read more
sourceimpl<T: SubAssign + Copy, C: SubAssign<T>> SubAssign<T> for Alpha<C, T>
impl<T: SubAssign + Copy, C: SubAssign<T>> SubAssign<T> for Alpha<C, T>
sourcefn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
Performs the -=
operation. Read more
sourceimpl<C, T> UlpsEq<Alpha<C, T>> for Alpha<C, T> where
C: UlpsEq<Epsilon = T::Epsilon>,
T: UlpsEq,
T::Epsilon: Clone,
impl<C, T> UlpsEq<Alpha<C, T>> for Alpha<C, T> where
C: UlpsEq<Epsilon = T::Epsilon>,
T: UlpsEq,
T::Epsilon: Clone,
sourceimpl<C, A: Component> WithAlpha<A> for Alpha<C, A>
impl<C, A: Component> WithAlpha<A> for Alpha<C, A>
sourcefn with_alpha(self, alpha: A) -> Self::WithAlpha
fn with_alpha(self, alpha: A) -> Self::WithAlpha
Transforms the color into a transparent color with the provided
alpha value. If Self
already has a transparency, it is
overwritten. Read more
sourcefn without_alpha(self) -> Self::Color
fn without_alpha(self) -> Self::Color
Removes the transparency from the color. If Self::Color
has
an internal transparency field, that field will be set to
A::max_intensity()
to make it opaque. Read more
sourcefn split(self) -> (Self::Color, A)
fn split(self) -> (Self::Color, A)
Splits the color into separate color and transparency values. Read more
sourcefn opaque(self) -> Self::WithAlpha
fn opaque(self) -> Self::WithAlpha
Transforms the color into a fully opaque color with a transparency
field. If Self
already has a transparency, it is overwritten. Read more
sourcefn transparent(self) -> Self::WithAlpha
fn transparent(self) -> Self::WithAlpha
Transforms the color into a fully transparent color. If Self
already has a transparency, it is overwritten. Read more
impl<C: Copy, T: Copy> Copy for Alpha<C, T>
impl<C, T> Eq for Alpha<C, T> where
T: Eq,
C: Eq,
Auto Trait Implementations
impl<C, T> RefUnwindSafe for Alpha<C, T> where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<C, T> Send for Alpha<C, T> where
C: Send,
T: Send,
impl<C, T> Sync for Alpha<C, T> where
C: Sync,
T: Sync,
impl<C, T> Unpin for Alpha<C, T> where
C: Unpin,
T: Unpin,
impl<C, T> UnwindSafe for Alpha<C, T> where
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
sourcefn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_from(color: S) -> Self
fn adapt_from(color: S) -> Self
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn from_color(t: T) -> U
fn from_color(t: T) -> U
Convert from T with values clamped to the color defined bounds. Read more
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourceimpl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
fn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
Convert from T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more