Skip to main content

BlendMode

Enum BlendMode 

Source
pub enum BlendMode {
Show 13 variants Clear, Source, Destination, SourceOver, DestinationOver, SourceIn, DestinationIn, SourceOut, DestinationOut, SourceAtop, DestinationAtop, Xor, Plus,
}
Expand description

Supported blend modes by this crate.

All modes operate in straight alpha. See F32x4Rgba::premultiply for premultiplied support.

§Overflow

Plus can produce channel values > 1.0. Call clamp() on the result when using Plus.

Variants§

§

Clear

Destination pixels covered by the source pixels are cleared.

§

Source

Source pixels are copied to the destination.

§

Destination

Destination pixels are copied to the source.

§

SourceOver

Source pixels are copied to the destination, ignoring the alpha channel.

§

DestinationOver

Destination pixels are copied to the source, ignoring the alpha channel.

§

SourceIn

Source pixels are copied to the destination, only where the destination is opaque.

§

DestinationIn

Destination pixels are copied to the source, only where the source is opaque.

§

SourceOut

Source pixels are copied to the destination, only where the source is opaque.

§

DestinationOut

Destination pixels are copied to the source, only where the destination is opaque.

§

SourceAtop

Source pixels are copied to the destination, where both source and destination are opaque.

§

DestinationAtop

Destination pixels are copied to the source, where both source and destination are opaque.

§

Xor

Source pixels are blended with the destination using the source’s alpha channel.

§

Plus

Source pixels are added to the destination.

Note: can produce channel values > 1.0. Call clamp() on the result when clamping is needed.

Trait Implementations§

Source§

impl Clone for BlendMode

Source§

fn clone(&self) -> BlendMode

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 BlendMode

Source§

impl Debug for BlendMode

Source§

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

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

impl Default for BlendMode

Source§

fn default() -> BlendMode

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

impl Eq for BlendMode

Source§

impl Hash for BlendMode

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 BlendMode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 RgbaBlend for BlendMode

Source§

type Channel = f32

What type of channel this blend mode operates on. Read more
Source§

fn apply( &self, src: Rgba<Self::Channel>, dst: Rgba<Self::Channel>, ) -> Rgba<Self::Channel>

Blends two colors together using this blend mode.
Source§

fn apply_slice( &self, src: &[Rgba<Self::Channel>], dst: &mut [Rgba<Self::Channel>], )

Blend src over dst in place, pixel by pixel. Read more
Source§

impl StructuralPartialEq for BlendMode

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