[−][src]Struct nannou::color::blend::PreAlpha
Premultiplied alpha wrapper.
Premultiplied colors are commonly used in composition algorithms to simplify the calculations. It may also be preferred when interpolating between colors, which is one of the reasons why it's offered as a separate type. The other reason is to make it easier to avoid unnecessary computations in composition chains.
use palette::{Blend, LinSrgb, LinSrgba}; use palette::blend::PreAlpha; let a = PreAlpha::from(LinSrgba::new(0.4, 0.5, 0.5, 0.3)); let b = PreAlpha::from(LinSrgba::new(0.3, 0.8, 0.4, 0.4)); let c = PreAlpha::from(LinSrgba::new(0.7, 0.1, 0.8, 0.8)); let res = LinSrgb::from_premultiplied(a.screen(b).overlay(c));
Note that converting to and from premultiplied alpha will cause the alpha component to be clamped to [0.0, 1.0].
Fields
color: C
The premultiplied color components (original.color * original.alpha
).
alpha: T
The transparency component. 0.0 is fully transparent and 1.0 is fully opaque.
Trait Implementations
impl<C, T> AbsDiffEq<PreAlpha<C, T>> for PreAlpha<C, T> where
C: AbsDiffEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: AbsDiffEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
[src]
C: AbsDiffEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: AbsDiffEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
[src]
fn abs_diff_eq(
&self,
other: &PreAlpha<C, T>,
epsilon: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
) -> bool
[src]
&self,
other: &PreAlpha<C, T>,
epsilon: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
impl<C, T> Add<PreAlpha<C, T>> for PreAlpha<C, T> where
C: Add<C>,
T: Float,
[src]
C: Add<C>,
T: Float,
type Output = PreAlpha<<C as Add<C>>::Output, T>
The resulting type after applying the +
operator.
fn add(
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Add<PreAlpha<C, T>>>::Output
[src]
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Add<PreAlpha<C, T>>>::Output
impl<T, C> Add<T> for PreAlpha<C, T> where
C: Add<T>,
T: Float,
[src]
C: Add<T>,
T: Float,
type Output = PreAlpha<<C as Add<T>>::Output, T>
The resulting type after applying the +
operator.
fn add(self, c: T) -> <PreAlpha<C, T> as Add<T>>::Output
[src]
impl<C, T> AddAssign<PreAlpha<C, T>> for PreAlpha<C, T> where
C: AddAssign<C>,
T: AddAssign<T> + Float,
[src]
C: AddAssign<C>,
T: AddAssign<T> + Float,
fn add_assign(&mut self, other: PreAlpha<C, T>)
[src]
impl<T, C> AddAssign<T> for PreAlpha<C, T> where
C: AddAssign<T>,
T: AddAssign<T> + Float,
[src]
C: AddAssign<T>,
T: AddAssign<T> + Float,
fn add_assign(&mut self, c: T)
[src]
impl<C, T, P> AsMut<P> for PreAlpha<C, T> where
C: Pixel<T>,
P: RawPixel<T> + ?Sized,
T: Float,
[src]
C: Pixel<T>,
P: RawPixel<T> + ?Sized,
T: Float,
impl<C, T, P> AsRef<P> for PreAlpha<C, T> where
C: Pixel<T>,
P: RawPixel<T> + ?Sized,
T: Float,
[src]
C: Pixel<T>,
P: RawPixel<T> + ?Sized,
T: Float,
impl<C, T> Blend for PreAlpha<C, T> where
C: Blend<Color = C> + ComponentWise<Scalar = T>,
T: Float,
[src]
C: Blend<Color = C> + ComponentWise<Scalar = T>,
T: Float,
type Color = C
The core color type. Typically Self
for color types without alpha.
fn into_premultiplied(self) -> PreAlpha<C, T>
[src]
fn from_premultiplied(color: PreAlpha<C, T>) -> PreAlpha<C, T>
[src]
fn blend<F>(self, destination: Self, blend_function: F) -> Self where
F: BlendFunction<Self::Color>,
[src]
F: BlendFunction<Self::Color>,
fn over(self, other: Self) -> Self
[src]
fn inside(self, other: Self) -> Self
[src]
fn outside(self, other: Self) -> Self
[src]
fn atop(self, other: Self) -> Self
[src]
fn xor(self, other: Self) -> Self
[src]
fn plus(self, other: Self) -> Self
[src]
fn multiply(self, other: Self) -> Self
[src]
fn screen(self, other: Self) -> Self
[src]
fn overlay(self, other: Self) -> Self
[src]
fn darken(self, other: Self) -> Self
[src]
fn lighten(self, other: Self) -> Self
[src]
fn dodge(self, other: Self) -> Self
[src]
fn burn(self, other: Self) -> Self
[src]
fn hard_light(self, other: Self) -> Self
[src]
fn soft_light(self, other: Self) -> Self
[src]
fn difference(self, other: Self) -> Self
[src]
fn exclusion(self, other: Self) -> Self
[src]
impl<C, T> Clone for PreAlpha<C, T> where
C: Clone,
T: Clone + Float,
[src]
C: Clone,
T: Clone + Float,
impl<C, T> ComponentWise for PreAlpha<C, T> where
C: ComponentWise<Scalar = T>,
T: Float,
[src]
C: ComponentWise<Scalar = T>,
T: Float,
type Scalar = T
The scalar type for color components.
fn component_wise<F>(&self, other: &PreAlpha<C, T>, f: F) -> PreAlpha<C, T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
fn component_wise_self<F>(&self, f: F) -> PreAlpha<C, T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
impl<C, T> Copy for PreAlpha<C, T> where
C: Copy,
T: Copy + Float,
[src]
C: Copy,
T: Copy + Float,
impl<C, T> Debug for PreAlpha<C, T> where
C: Debug,
T: Debug + Float,
[src]
C: Debug,
T: Debug + Float,
impl<C, T> Default for PreAlpha<C, T> where
C: Default,
T: Float,
[src]
C: Default,
T: Float,
impl<C, T> Deref for PreAlpha<C, T> where
T: Float,
[src]
T: Float,
impl<C, T> DerefMut for PreAlpha<C, T> where
T: Float,
[src]
T: Float,
impl<C, T> Div<PreAlpha<C, T>> for PreAlpha<C, T> where
C: Div<C>,
T: Float,
[src]
C: Div<C>,
T: Float,
type Output = PreAlpha<<C as Div<C>>::Output, T>
The resulting type after applying the /
operator.
fn div(
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Div<PreAlpha<C, T>>>::Output
[src]
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Div<PreAlpha<C, T>>>::Output
impl<T, C> Div<T> for PreAlpha<C, T> where
C: Div<T>,
T: Float,
[src]
C: Div<T>,
T: Float,
type Output = PreAlpha<<C as Div<T>>::Output, T>
The resulting type after applying the /
operator.
fn div(self, c: T) -> <PreAlpha<C, T> as Div<T>>::Output
[src]
impl<C, T> DivAssign<PreAlpha<C, T>> for PreAlpha<C, T> where
C: DivAssign<C>,
T: DivAssign<T> + Float,
[src]
C: DivAssign<C>,
T: DivAssign<T> + Float,
fn div_assign(&mut self, other: PreAlpha<C, T>)
[src]
impl<T, C> DivAssign<T> for PreAlpha<C, T> where
C: DivAssign<T>,
T: DivAssign<T> + Float,
[src]
C: DivAssign<T>,
T: DivAssign<T> + Float,
fn div_assign(&mut self, c: T)
[src]
impl<C, T> From<Alpha<C, T>> for PreAlpha<C, T> where
C: ComponentWise<Scalar = T>,
T: Float,
[src]
C: ComponentWise<Scalar = T>,
T: Float,
impl<C, T> From<PreAlpha<C, T>> for Alpha<C, T> where
C: ComponentWise<Scalar = T>,
T: Float,
[src]
C: ComponentWise<Scalar = T>,
T: Float,
impl<C> Mix for PreAlpha<C, <C as Mix>::Scalar> where
C: Mix,
[src]
C: Mix,
type Scalar = <C as Mix>::Scalar
The type of the mixing factor.
fn mix(
&self,
other: &PreAlpha<C, <C as Mix>::Scalar>,
factor: <C as Mix>::Scalar
) -> PreAlpha<C, <C as Mix>::Scalar>
[src]
&self,
other: &PreAlpha<C, <C as Mix>::Scalar>,
factor: <C as Mix>::Scalar
) -> PreAlpha<C, <C as Mix>::Scalar>
impl<C, T> Mul<PreAlpha<C, T>> for PreAlpha<C, T> where
C: Mul<C>,
T: Float,
[src]
C: Mul<C>,
T: Float,
type Output = PreAlpha<<C as Mul<C>>::Output, T>
The resulting type after applying the *
operator.
fn mul(
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Mul<PreAlpha<C, T>>>::Output
[src]
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Mul<PreAlpha<C, T>>>::Output
impl<T, C> Mul<T> for PreAlpha<C, T> where
C: Mul<T>,
T: Float,
[src]
C: Mul<T>,
T: Float,
type Output = PreAlpha<<C as Mul<T>>::Output, T>
The resulting type after applying the *
operator.
fn mul(self, c: T) -> <PreAlpha<C, T> as Mul<T>>::Output
[src]
impl<C, T> MulAssign<PreAlpha<C, T>> for PreAlpha<C, T> where
C: MulAssign<C>,
T: MulAssign<T> + Float,
[src]
C: MulAssign<C>,
T: MulAssign<T> + Float,
fn mul_assign(&mut self, other: PreAlpha<C, T>)
[src]
impl<T, C> MulAssign<T> for PreAlpha<C, T> where
C: MulAssign<T>,
T: MulAssign<T> + Float,
[src]
C: MulAssign<T>,
T: MulAssign<T> + Float,
fn mul_assign(&mut self, c: T)
[src]
impl<C, T> PartialEq<PreAlpha<C, T>> for PreAlpha<C, T> where
C: PartialEq<C>,
T: PartialEq<T> + Float,
[src]
C: PartialEq<C>,
T: PartialEq<T> + Float,
impl<T, C> Pixel<T> for PreAlpha<C, T> where
C: Pixel<T>,
T: Float,
[src]
C: Pixel<T>,
T: Float,
const CHANNELS: usize
[src]
fn as_raw<P>(&self) -> &P where
P: RawPixel<T> + ?Sized,
[src]
P: RawPixel<T> + ?Sized,
fn as_raw_mut<P>(&mut self) -> &mut P where
P: RawPixel<T> + ?Sized,
[src]
P: RawPixel<T> + ?Sized,
fn into_raw<P>(self) -> P where
P: RawPixelSized<T>,
[src]
P: RawPixelSized<T>,
fn from_raw<P>(pixel: &P) -> &Self where
P: RawPixel<T> + ?Sized,
[src]
P: RawPixel<T> + ?Sized,
fn from_raw_mut<P>(pixel: &mut P) -> &mut Self where
P: RawPixel<T> + ?Sized,
[src]
P: RawPixel<T> + ?Sized,
fn from_raw_slice(slice: &[T]) -> &[Self]
[src]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]
[src]
fn into_raw_slice(slice: &[Self]) -> &[T]
[src]
fn into_raw_slice_mut(slice: &mut [Self]) -> &mut [T]
[src]
impl<C, T> RelativeEq<PreAlpha<C, T>> for PreAlpha<C, T> where
C: RelativeEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: RelativeEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
[src]
C: RelativeEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: RelativeEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
fn default_max_relative(
) -> <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
[src]
) -> <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
fn relative_eq(
&self,
other: &PreAlpha<C, T>,
epsilon: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon,
max_relative: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
) -> bool
[src]
&self,
other: &PreAlpha<C, T>,
epsilon: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon,
max_relative: <PreAlpha<C, T> as AbsDiffEq<PreAlpha<C, T>>>::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<C, T> StructuralPartialEq for PreAlpha<C, T> where
T: Float,
[src]
T: Float,
impl<C, T> Sub<PreAlpha<C, T>> for PreAlpha<C, T> where
C: Sub<C>,
T: Float,
[src]
C: Sub<C>,
T: Float,
type Output = PreAlpha<<C as Sub<C>>::Output, T>
The resulting type after applying the -
operator.
fn sub(
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Sub<PreAlpha<C, T>>>::Output
[src]
self,
other: PreAlpha<C, T>
) -> <PreAlpha<C, T> as Sub<PreAlpha<C, T>>>::Output
impl<T, C> Sub<T> for PreAlpha<C, T> where
C: Sub<T>,
T: Float,
[src]
C: Sub<T>,
T: Float,
type Output = PreAlpha<<C as Sub<T>>::Output, T>
The resulting type after applying the -
operator.
fn sub(self, c: T) -> <PreAlpha<C, T> as Sub<T>>::Output
[src]
impl<C, T> SubAssign<PreAlpha<C, T>> for PreAlpha<C, T> where
C: SubAssign<C>,
T: SubAssign<T> + Float,
[src]
C: SubAssign<C>,
T: SubAssign<T> + Float,
fn sub_assign(&mut self, other: PreAlpha<C, T>)
[src]
impl<T, C> SubAssign<T> for PreAlpha<C, T> where
C: SubAssign<T>,
T: SubAssign<T> + Float,
[src]
C: SubAssign<T>,
T: SubAssign<T> + Float,
fn sub_assign(&mut self, c: T)
[src]
impl<C, T> UlpsEq<PreAlpha<C, T>> for PreAlpha<C, T> where
C: UlpsEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: UlpsEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
[src]
C: UlpsEq<C, Epsilon = <T as AbsDiffEq<T>>::Epsilon>,
T: UlpsEq<T> + Float,
<T as AbsDiffEq<T>>::Epsilon: Copy,
Auto Trait Implementations
impl<C, T> RefUnwindSafe for PreAlpha<C, T> where
C: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<C, T> Send for PreAlpha<C, T> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<C, T> Sync for PreAlpha<C, T> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,
impl<C, T> Unpin for PreAlpha<C, T> where
C: Unpin,
T: Unpin,
C: Unpin,
T: Unpin,
impl<C, T> UnwindSafe for PreAlpha<C, T> where
C: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
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, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
fn convert_into(self) -> U
[src]
fn convert_unclamped_into(self) -> U
[src]
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[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> MemoryUsage for T where
T: Deref + Debug,
<T as Deref>::Target: MemoryUsage,
T: Deref + Debug,
<T as Deref>::Target: MemoryUsage,
fn properties_required(&self) -> Properties
fn memory_fitness(&self, properties: Properties) -> u32
fn allocator_fitness(&self, kind: Kind) -> u32
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<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, 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,