palette::blend

Trait Compose

source
pub trait Compose {
    // Required methods
    fn over(self, other: Self) -> Self;
    fn inside(self, other: Self) -> Self;
    fn outside(self, other: Self) -> Self;
    fn atop(self, other: Self) -> Self;
    fn xor(self, other: Self) -> Self;
    fn plus(self, other: Self) -> Self;
}
Expand description

The Porter Duff composition operators, as described by W3C.

This set of operators exclude the variants where source and destination are swapped, as well as the “clear”, “copy” and “destination” operators. Those can easily be achieved using other means.

Required Methods§

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.

Object Safety§

This trait is not object safe.

Implementors§

source§

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

source§

impl<C> Compose for C

source§

impl<C, T, const N: usize> Compose for PreAlpha<C>
where C: ArrayCast<Array = [T; N]> + Premultiply<Scalar = T>, T: Real + Zero + One + Arithmetics + Clamp + Clone,