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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.