Skip to main content

BlendMethod

Enum BlendMethod 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum BlendMethod {
Show 17 variants Normal = 0, Multiply = 1, Screen = 2, Overlay = 3, Darken = 4, Lighten = 5, ColorDodge = 6, ColorBurn = 7, HardLight = 8, SoftLight = 9, Difference = 10, Exclusion = 11, Hue = 12, Saturation = 13, Color = 14, Luminosity = 15, Add = 16,
}
Expand description

Blending method for compositing paint objects.

Covers thorvg’s user-facing blend modes (Tvg_Blend_Method NORMAL..=ADD). The C enum’s TVG_BLEND_METHOD_COMPOSITION (= 255) is deliberately omitted: it is an internal value the engine uses for intermediate composition, not a mode callers select. Blend is write-only in the C API (there is no tvg_paint_get_blend_method), so the engine never hands a value back that would need mapping here — hence this enum has only to_raw and no from_raw.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Normal = 0

Source is drawn over the destination (the default, no blending).

§

Multiply = 1

Multiplies source and destination — always darkens.

§

Screen = 2

Inverse-multiplies — always lightens.

§

Overlay = 3

Multiply in dark areas, Screen in light areas.

§

Darken = 4

Keeps the darker of source and destination per channel.

§

Lighten = 5

Keeps the lighter of source and destination per channel.

§

ColorDodge = 6

Brightens the destination to reflect the source.

§

ColorBurn = 7

Darkens the destination to reflect the source.

§

HardLight = 8

Overlay with source and destination swapped.

§

SoftLight = 9

A softer variant of HardLight.

§

Difference = 10

Absolute difference of source and destination per channel.

§

Exclusion = 11

Like Difference but with lower contrast.

§

Hue = 12

Hue of the source with destination saturation and luminosity.

§

Saturation = 13

Saturation of the source with destination hue and luminosity.

§

Color = 14

Hue and saturation of the source with destination luminosity.

§

Luminosity = 15

Luminosity of the source with destination hue and saturation.

§

Add = 16

Additive blending — sums source and destination per channel.

Trait Implementations§

Source§

impl Clone for BlendMethod

Source§

fn clone(&self) -> BlendMethod

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for BlendMethod

Source§

impl Debug for BlendMethod

Source§

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

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

impl Eq for BlendMethod

Source§

impl Hash for BlendMethod

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 PartialEq for BlendMethod

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlendMethod

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.