Enum tetra::graphics::BlendFactor
source · pub enum BlendFactor {
Show 13 variants
Zero,
One,
Src,
OneMinusSrc,
SrcAlpha,
OneMinusSrcAlpha,
Dst,
OneMinusDst,
DstAlpha,
OneMinusDstAlpha,
SrcAlphaSaturated,
Constant,
OneMinusConstant,
}
Expand description
Defines a multiplier that will be applied to a color or alpha value before blending it.
Variants§
Zero
Each component will be multiplied by zero.
- Color:
r * 0
,g * 0
,b * 0
- Alpha:
a * 0
One
Each component will be multiplied by one.
- Color:
r * 1
,g * 1
,b * 1
- Alpha:
a * 1
Src
Each component will be multiplied by the source value (color or alpha, depending on the context).
- Color:
r * srcR
,g * srcG
,b * srcB
- Alpha:
a * srcA
OneMinusSrc
Each component will be multiplied by the inverse of the source value (color or alpha, depending on the context).
- Color:
r * (1 - srcR)
,g * (1 - srcG
,b * (1 - srcB)
- Alpha:
a * (1 - srcA)
SrcAlpha
Each component will be multiplied by the source alpha value.
- Color:
r * srcA
,g * srcA
,b * srcA
- Alpha:
a * srcA
OneMinusSrcAlpha
Each component will be multiplied by the inverse of the source alpha value.
- Color:
r * (1 - srcA)
,g * (1 - srcA)
,b * (1 - srcA)
- Alpha:
a * (1 - srcA)
Dst
Each component will be multiplied by the destination value (color or alpha, depending on the context).
- Color:
r * dstR
,g * dstG
,b * dstB
- Alpha:
a * dstA
OneMinusDst
Each component will be multiplied by the inverse of the destination value (color or alpha, depending on the context).
- Color:
r * (1 - dstR)
,g * (1 - dstG)
,b * (1 - dstB)
- Alpha:
a * (1 - dstA)
DstAlpha
Each component will be multiplied by the destination alpha value.
- Color:
r * dstA
,g * dstA
,b * dstA
- Alpha:
a * dstA
OneMinusDstAlpha
Each component will be multiplied by the inverse of the destination alpha value.
- Color:
r * (1 - dstA)
,g * (1 - dstA)
,b * (1 - dstA)
- Alpha:
a * dstA
SrcAlphaSaturated
Each component will be multiplied by either the source alpha value, or its inverse, whichever is greater.
When applied to an alpha value, this acts the same as BlendFactor::One
.
- Color:
r * min(dstA, 1 - dstA)
,g * min(dstA, 1 - dstA)
,b * min(dstA, 1 - dstA)
- Alpha:
a * 1
Constant
Each component will be multiplied by a constant value.
The means of setting this constant is not yet exposed in Tetra - please create an issue or a PR if you need to use this!
- Color:
r * c
,g * c
,b * c
- Alpha:
a * c
OneMinusConstant
Each component will be multiplied by the inverse of a constant value.
The means of setting this constant is not yet exposed in Tetra - please create an issue or a PR if you need to use this!
- Color:
r * (1 - c)
,g * (1 - c)
,b * (1 - c)
- Alpha:
a * (1 - c)
Trait Implementations§
source§impl Clone for BlendFactor
impl Clone for BlendFactor
source§fn clone(&self) -> BlendFactor
fn clone(&self) -> BlendFactor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BlendFactor
impl Debug for BlendFactor
source§impl PartialEq<BlendFactor> for BlendFactor
impl PartialEq<BlendFactor> for BlendFactor
source§fn eq(&self, other: &BlendFactor) -> bool
fn eq(&self, other: &BlendFactor) -> bool
self
and other
values to be equal, and is used
by ==
.