pub struct BlendMode {
pub color: BlendComponent,
pub alpha: BlendComponent,
}
Expand description
Describes the blend mode used when drawing images.
Fields§
§color: BlendComponent
The blend mode for the color channels.
alpha: BlendComponent
The blend mode for the alpha channel.
Implementations§
source§impl BlendMode
impl BlendMode
sourcepub const ADD: Self = _
pub const ADD: Self = _
When combining two fragments, add their values together, saturating at 1.0
sourcepub const SUBTRACT: Self = _
pub const SUBTRACT: Self = _
When combining two fragments, subtract the source value from the destination value
sourcepub const ALPHA: Self = _
pub const ALPHA: Self = _
When combining two fragments, add the value of the source times its alpha channel with the value of the destination multiplied by the inverse of the source alpha channel. Has the usual transparency effect: mixes the two colors using a fraction of each one specified by the alpha of the source.
sourcepub const INVERT: Self = _
pub const INVERT: Self = _
When combining two fragments, subtract the destination color from a constant color using the source color as weight. Has an invert effect with the constant color as base and source color controlling displacement from the base color. A white source color and a white value results in plain invert. The output alpha is same as destination alpha.
sourcepub const MULTIPLY: Self = _
pub const MULTIPLY: Self = _
When combining two fragments, multiply their values together (including alpha)
sourcepub const REPLACE: Self = _
pub const REPLACE: Self = _
When combining two fragments, choose the source value (including source alpha)
sourcepub const PREMULTIPLIED: Self = _
pub const PREMULTIPLIED: Self = _
When using premultiplied alpha, use this.
You usually want to use this blend mode for drawing canvases containing semi-transparent imagery. For an explanation on this see: https://github.com/ggez/ggez/issues/694#issuecomment-853724926
Trait Implementations§
source§impl PartialEq<BlendMode> for BlendMode
impl PartialEq<BlendMode> for BlendMode
impl Copy for BlendMode
impl Eq for BlendMode
impl StructuralEq for BlendMode
impl StructuralPartialEq for BlendMode
Auto Trait Implementations§
impl RefUnwindSafe for BlendMode
impl Send for BlendMode
impl Sync for BlendMode
impl Unpin for BlendMode
impl UnwindSafe for BlendMode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.