CompositeOperation

Enum CompositeOperation 

Source
#[repr(u8)]
pub enum CompositeOperation {
Show 26 variants SourceOver = 0, SourceIn = 1, SourceOut = 2, SourceAtop = 3, DestinationOver = 4, DestinationIn = 5, DestinationOut = 6, DestinationAtop = 7, Lighter = 8, Copy = 9, Xor = 10, Multiply = 11, Screen = 12, Overlay = 13, Darken = 14, Lighten = 15, ColorDodge = 16, ColorBurn = 17, HardLight = 18, SoftLight = 19, Difference = 20, Exclusion = 21, Hue = 22, Saturation = 23, Color = 24, Luminosity = 25,
}

Variants§

§

SourceOver = 0

This is the default setting and draws new shapes on top of the existing canvas content.

§

SourceIn = 1

The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent.

§

SourceOut = 2

The new shape is drawn where it doesn’t overlap the existing canvas content.

§

SourceAtop = 3

The new shape is only drawn where it overlaps the existing canvas content.

§

DestinationOver = 4

New shapes are drawn behind the existing canvas content.

§

DestinationIn = 5

The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.

§

DestinationOut = 6

The existing content is kept where it doesn’t overlap the new shape.

§

DestinationAtop = 7

The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.

§

Lighter = 8

Where both shapes overlap the color is determined by adding color values.

§

Copy = 9

Only the new shape is shown.

§

Xor = 10

Shapes are made transparent where both overlap and drawn normal everywhere else.

§

Multiply = 11

The pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result.

§

Screen = 12

The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)

§

Overlay = 13

A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.

§

Darken = 14

Retains the darkest pixels of both layers.

§

Lighten = 15

Retains the lightest pixels of both layers.

§

ColorDodge = 16

Divides the bottom layer by the inverted top layer.

§

ColorBurn = 17

Divides the inverted bottom layer by the top layer, and then inverts the result.

§

HardLight = 18

A combination of multiply and screen like overlay, but with top and bottom layer swapped.

§

SoftLight = 19

A softer version of hardLight. Pure black or white does not result in pure black or white.

§

Difference = 20

Subtracts the bottom layer from the top layer or the other way round to always get a positive value.

§

Exclusion = 21

Like difference, but with lower contrast.

§

Hue = 22

Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.

§

Saturation = 23

Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.

§

Color = 24

Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.

§

Luminosity = 25

Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.

Trait Implementations§

Source§

impl Clone for CompositeOperation

Source§

fn clone(&self) -> CompositeOperation

Returns a duplicate 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 Debug for CompositeOperation

Source§

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

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

impl Hash for CompositeOperation

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for CompositeOperation

Source§

fn cmp(&self, other: &CompositeOperation) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for CompositeOperation

Source§

fn eq(&self, other: &CompositeOperation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for CompositeOperation

Source§

fn partial_cmp(&self, other: &CompositeOperation) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for CompositeOperation

Source§

impl Eq for CompositeOperation

Source§

impl StructuralPartialEq for CompositeOperation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.