Type Alias palette::Xyza

source ·
pub type Xyza<Wp = D65, T = f32> = Alpha<Xyz<Wp, T>, T>;
Expand description

CIE 1931 XYZ with an alpha component. See the Xyza implementation in Alpha.

Aliased Type§

struct Xyza<Wp = D65, T = f32> {
    pub color: Xyz<Wp, T>,
    pub alpha: T,
}

Fields§

§color: Xyz<Wp, T>

The color.

§alpha: T

The transparency component. 0.0 is fully transparent and 1.0 is fully opaque.

Implementations

source§

impl<T, A> Alpha<Xyz<D65, T>, A>
where T: Component + Float, A: Component,

Xyza implementations.

source

pub fn new(x: T, y: T, luma: T, alpha: A) -> Self

CIE Yxy and transparency with white point D65.

source§

impl<Wp, T, A> Alpha<Xyz<Wp, T>, A>
where T: Component + Float, A: Component, Wp: WhitePoint,

Xyza implementations.

source

pub fn with_wp(x: T, y: T, z: T, alpha: A) -> Self

CIE XYZ and transparency.

source

pub fn into_components(self) -> (T, T, T, A)

Convert to a (X, Y, Z, alpha) tuple.

source

pub fn from_components((x, y, z, alpha): (T, T, T, A)) -> Self

Convert from a (X, Y, Z, alpha) tuple.

Trait Implementations

source§

impl<C, T> Serialize for Alpha<C, T>
where C: Serialize, T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Wp, T> From<Alpha<Lab<Wp, T>, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Alpha<Lab<Wp, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<C, T> AbsDiffEq for Alpha<C, T>
where C: AbsDiffEq<Epsilon = T::Epsilon>, T: AbsDiffEq, T::Epsilon: Clone,

§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

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.
source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of ApproxEq::abs_diff_eq.
source§

impl<Wp, T, _S> From<Alpha<Luma<_S, T>, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: LumaStandard<WhitePoint = Wp>,

source§

fn from(color: Alpha<Luma<_S, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<T: Div + Clone, C: Div<T>> Div<T> for Alpha<C, T>

§

type Output = Alpha<<C as Div<T>>::Output, <T as Div>::Output>

The resulting type after applying the / operator.
source§

fn div(self, c: T) -> Self::Output

Performs the / operation. Read more
source§

impl<Wp, T, _S> From<Alpha<Hsl<_S, T>, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Alpha<Hsl<_S, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<C: Mul, T: Float> Mul for Alpha<C, T>

§

type Output = Alpha<<C as Mul>::Output, <T as Mul>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, other: Alpha<C, T>) -> Self::Output

Performs the * operation. Read more
source§

impl<C, T> DerefMut for Alpha<C, T>

source§

fn deref_mut(&mut self) -> &mut C

Mutably dereferences the value.
source§

impl<C: Hue, T: Clone> Hue for Alpha<C, T>

source§

fn with_hue<H: Into<C::Hue>>(&self, hue: H) -> Alpha<C, T>

Return a new copy of self, but with a specific hue.
source§

fn shift_hue<H: Into<C::Hue>>(&self, amount: H) -> Alpha<C, T>

Return a new copy of self, but with the hue shifted by amount.
source§

impl<C: Sub, T: Float> Sub for Alpha<C, T>

§

type Output = Alpha<<C as Sub>::Output, <T as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, other: Alpha<C, T>) -> Self::Output

Performs the - operation. Read more
source§

impl<C: GetHue, T> GetHue for Alpha<C, T>

§

type Hue = <C as GetHue>::Hue

The kind of hue unit this color space uses. Read more
source§

fn get_hue(&self) -> Option<C::Hue>

Calculate a hue if possible. Read more
source§

impl<Wp, T, _S> From<Hsv<_S, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Hsv<_S, T>) -> Self

Converts to this type from the input type.
source§

impl<C, T> StructuralPartialEq for Alpha<C, T>

source§

impl<C: Saturate> Saturate for Alpha<C, C::Scalar>

§

type Scalar = <C as Saturate>::Scalar

The type of the (de)saturation factor.
source§

fn saturate(&self, factor: C::Scalar) -> Alpha<C, C::Scalar>

Increase the saturation by factor.
source§

fn desaturate(&self, factor: Self::Scalar) -> Self

Decrease the saturation by factor.
source§

impl<C: Debug, T: Debug> Debug for Alpha<C, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C: Div, T: Float> Div for Alpha<C, T>

§

type Output = Alpha<<C as Div>::Output, <T as Div>::Output>

The resulting type after applying the / operator.
source§

fn div(self, other: Alpha<C, T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T: MulAssign + Copy, C: MulAssign<T>> MulAssign<T> for Alpha<C, T>

source§

fn mul_assign(&mut self, c: T)

Performs the *= operation. Read more
source§

impl<C, T, P> AsMut<P> for Alpha<C, T>
where C: Pixel<T>, P: RawPixel<T> + ?Sized,

source§

fn as_mut(&mut self) -> &mut P

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<Wp, T, _S> From<Alpha<Hsv<_S, T>, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Alpha<Hsv<_S, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<T: Sub + Clone, C: Sub<T>> Sub<T> for Alpha<C, T>

§

type Output = Alpha<<C as Sub<T>>::Output, <T as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, c: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T, C: Pixel<T>> Pixel<T> for Alpha<C, T>

source§

const CHANNELS: usize = _

The number of color channels.
source§

fn as_raw<P: RawPixel<T> + ?Sized>(&self) -> &P

Cast as a reference to raw color components.
source§

fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P

Cast as a mutable reference to raw color components.
source§

fn into_raw<P: RawPixelSized<T>>(self) -> P

Convert from raw color components.
source§

fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self

Cast from a reference to raw color components.
source§

fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self

Cast from a mutable reference to raw color components.
source§

fn from_raw_slice(slice: &[T]) -> &[Self]

Cast a slice of raw color components to a slice of colors. Read more
source§

fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]

Cast a mutable slice of raw color components to a mutable slice of colors. Read more
source§

fn into_raw_slice(slice: &[Self]) -> &[T]

Cast a slice of colors to a slice of raw color components. Read more
source§

fn into_raw_slice_mut(slice: &mut [Self]) -> &mut [T]

Cast a mutable slice of colors to a mutable slice of raw color components. Read more
source§

impl<Wp, T, _S> From<Rgb<_S, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Rgb<_S, T>) -> Self

Converts to this type from the input type.
source§

impl<C: Limited, T: Component> Limited for Alpha<C, T>

source§

fn is_valid(&self) -> bool

Check if the color’s components are within the expected ranges.
source§

fn clamp(&self) -> Alpha<C, T>

Return a new color where the components has been clamped to the nearest valid values.
source§

fn clamp_self(&mut self)

Clamp the color’s components to the nearest valid values.
source§

impl<Wp, T, _S> From<Hwb<_S, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Hwb<_S, T>) -> Self

Converts to this type from the input type.
source§

impl<C: SubAssign, T: Float + SubAssign> SubAssign for Alpha<C, T>

source§

fn sub_assign(&mut self, other: Alpha<C, T>)

Performs the -= operation. Read more
source§

impl<Wp, T, _S> From<Luma<_S, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: LumaStandard<WhitePoint = Wp>,

source§

fn from(color: Luma<_S, T>) -> Self

Converts to this type from the input type.
source§

impl<Wp, T> From<Alpha<Lch<Wp, T>, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Alpha<Lch<Wp, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<C: Clone, T: Clone> Clone for Alpha<C, T>

source§

fn clone(&self) -> Alpha<C, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Hsl<_S, T>) -> Self

Converts to this type from the input type.
source§

impl<T: AddAssign + Copy, C: AddAssign<T>> AddAssign<T> for Alpha<C, T>

source§

fn add_assign(&mut self, c: T)

Performs the += operation. Read more
source§

impl<C, T, P> AsRef<P> for Alpha<C, T>
where C: Pixel<T>, P: RawPixel<T> + ?Sized,

source§

fn as_ref(&self) -> &P

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<C: DivAssign, T: Float + DivAssign> DivAssign for Alpha<C, T>

source§

fn div_assign(&mut self, other: Alpha<C, T>)

Performs the /= operation. Read more
source§

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>>,

§

type Color = <C as Blend>::Color

The core color type. Typically Self for color types without alpha.
source§

fn into_premultiplied(self) -> PreAlpha<C::Color, T>

Convert the color to premultiplied alpha.
source§

fn from_premultiplied(color: PreAlpha<C::Color, T>) -> Alpha<C, T>

Convert the color from premultiplied alpha.
source§

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
source§

fn over(self, other: Self) -> Self

Place self over other. This is the good old common alpha composition equation.
source§

fn inside(self, other: Self) -> Self

Results in the parts of self that overlaps the visible parts of other.
source§

fn outside(self, other: Self) -> Self

Results in the parts of self that lies outside the visible parts of other.
source§

fn atop(self, other: Self) -> Self

Place self over only the visible parts of other.
source§

fn xor(self, other: Self) -> Self

Results in either self or other, where they do not overlap.
source§

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.
source§

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.
source§

fn screen(self, other: Self) -> Self

Make a color which is at least as light as self or other.
source§

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.
source§

fn darken(self, other: Self) -> Self

Return the darkest parts of self and other.
source§

fn lighten(self, other: Self) -> Self

Return the lightest parts of self and other.
source§

fn dodge(self, other: Self) -> Self

Lighten other to reflect self. Results in other if self is black.
source§

fn burn(self, other: Self) -> Self

Darken other to reflect self. Results in other if self is white.
source§

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.
source§

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.
source§

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.
source§

fn exclusion(self, other: Self) -> Self

Similar to difference, but appears to result in a lower contrast. other is inverted if self is white, and preserved if self is black.
source§

impl<C: MulAssign, T: Float + MulAssign> MulAssign for Alpha<C, T>

source§

fn mul_assign(&mut self, other: Alpha<C, T>)

Performs the *= operation. Read more
source§

impl<C, T> RelativeEq for Alpha<C, T>
where C: RelativeEq<Epsilon = T::Epsilon>, T: RelativeEq, T::Epsilon: Clone,

source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

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.
source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of ApproxEq::relative_eq.
source§

impl<C: Shade> Shade for Alpha<C, C::Scalar>

§

type Scalar = <C as Shade>::Scalar

The type of the lighten/darken amount.
source§

fn lighten(&self, amount: C::Scalar) -> Alpha<C, C::Scalar>

Lighten the color by amount.
source§

fn darken(&self, amount: Self::Scalar) -> Self

Darken the color by amount.
source§

impl<C: AddAssign, T: Float + AddAssign> AddAssign for Alpha<C, T>

source§

fn add_assign(&mut self, other: Alpha<C, T>)

Performs the += operation. Read more
source§

impl<Wp: WhitePoint, T: Component + Float, A: Component> Into<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>

source§

fn into(self) -> (T, T, T, A)

Converts this type into the (usually inferred) input type.
source§

impl<C: Mix> Mix for Alpha<C, C::Scalar>

§

type Scalar = <C as Mix>::Scalar

The type of the mixing factor.
source§

fn mix( &self, other: &Alpha<C, C::Scalar>, factor: C::Scalar ) -> Alpha<C, C::Scalar>

Mix the color with an other color, by factor. Read more
source§

impl<C, T> UlpsEq for Alpha<C, T>
where C: UlpsEq<Epsilon = T::Epsilon>, T: UlpsEq, T::Epsilon: Clone,

source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn ulps_eq( &self, other: &Alpha<C, T>, epsilon: Self::Epsilon, max_ulps: u32 ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.
source§

impl<Wp, T, _S> From<Alpha<Hwb<_S, T>, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Alpha<Hwb<_S, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<C: PartialEq, T: PartialEq> PartialEq for Alpha<C, T>

source§

fn eq(&self, other: &Alpha<C, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: SubAssign + Copy, C: SubAssign<T>> SubAssign<T> for Alpha<C, T>

source§

fn sub_assign(&mut self, c: T)

Performs the -= operation. Read more
source§

impl<C: Add, T: Float> Add for Alpha<C, T>

§

type Output = Alpha<<C as Add>::Output, <T as Add>::Output>

The resulting type after applying the + operator.
source§

fn add(self, other: Alpha<C, T>) -> Self::Output

Performs the + operation. Read more
source§

impl<Wp, T> From<Yxy<Wp, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Yxy<Wp, T>) -> Self

Converts to this type from the input type.
source§

impl<Wp: WhitePoint, T: Component + Float, A: Component> From<(T, T, T, A)> for Alpha<Xyz<Wp, T>, A>

source§

fn from(components: (T, T, T, A)) -> Self

Converts to this type from the input type.
source§

impl<C, T> UpperHex for Alpha<C, T>
where T: UpperHex, C: UpperHex,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<C: Copy, T: Copy> Copy for Alpha<C, T>

source§

impl<C, T> From<PreAlpha<C, T>> for Alpha<C, T>
where C: ComponentWise<Scalar = T>, T: Float,

source§

fn from(color: PreAlpha<C, T>) -> Alpha<C, T>

Converts to this type from the input type.
source§

impl<C: Default, T: Component> Default for Alpha<C, T>

source§

fn default() -> Alpha<C, T>

Returns the “default value” for a type. Read more
source§

impl<T: Mul + Clone, C: Mul<T>> Mul<T> for Alpha<C, T>

§

type Output = Alpha<<C as Mul<T>>::Output, <T as Mul>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, c: T) -> Self::Output

Performs the * operation. Read more
source§

impl<Wp, T> From<Lch<Wp, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Lch<Wp, T>) -> Self

Converts to this type from the input type.
source§

impl<'de, C, T> Deserialize<'de> for Alpha<C, T>
where C: Deserialize<'de>, T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<Wp, T> From<Lab<Wp, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Lab<Wp, T>) -> Self

Converts to this type from the input type.
source§

impl<T: DivAssign + Copy, C: DivAssign<T>> DivAssign<T> for Alpha<C, T>

source§

fn div_assign(&mut self, c: T)

Performs the /= operation. Read more
source§

impl<C, T> LowerHex for Alpha<C, T>
where T: LowerHex, C: LowerHex,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<C: ComponentWise<Scalar = T>, T: Clone> ComponentWise for Alpha<C, T>

§

type Scalar = T

The scalar type for color components.
source§

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.
source§

fn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Alpha<C, T>

Perform a unary operation on this color.
source§

impl<C, T> Deref for Alpha<C, T>

§

type Target = C

The resulting type after dereferencing.
source§

fn deref(&self) -> &C

Dereferences the value.
source§

impl<Wp, T> From<Alpha<Yxy<Wp, T>, T>> for Alpha<Xyz<Wp, T>, T>

source§

fn from(color: Alpha<Yxy<Wp, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<Wp, T, _S> From<Alpha<Rgb<_S, T>, T>> for Alpha<Xyz<Wp, T>, T>
where T: Component + Float + Component + _FloatTrait, Wp: WhitePoint, _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = Wp>,

source§

fn from(color: Alpha<Rgb<_S, T>, T>) -> Self

Converts to this type from the input type.
source§

impl<C, T: Component> From<C> for Alpha<C, T>

source§

fn from(color: C) -> Alpha<C, T>

Converts to this type from the input type.
source§

impl<T: Add + Clone, C: Add<T>> Add<T> for Alpha<C, T>

§

type Output = Alpha<<C as Add<T>>::Output, <T as Add>::Output>

The resulting type after applying the + operator.
source§

fn add(self, c: T) -> Self::Output

Performs the + operation. Read more