[][src]Module golem::blend

Various options to specify how to combine pixels with what they draw over

GPU blending follows the equation:

Output = Operation(SourceFunction(Source), DestFunction(Destination))

The Operation is controlled by BlendEquation, and the SourceFunction and DestFunction are controlled by BlendFunction. Both of these are combined to form a BlendMode, which can be applied by Context::set_blend_mode.

The default BlendMode produces the result of:

Output = Source.Alpha * Source + (1 - Source.Alpha) * Destination

and looks like:

BlendMode {
    equation: BlendEquation::Same(BlendOperation::Add),
    function: BlendFunction::Same {
        source: BlendFactor::Color {
            input: BlendInput::Source,
             channel: BlendChannel::Alpha,
             is_inverse: false,
         },
         destination: BlendFactor::Color {
             input: BlendInput::Source,
             channel: BlendChannel::Alpha,
             is_inverse: true,
         },
     },
     color: [0.0; 4]
}

For more information, see the documentation for the individual Blend enums.

Structs

BlendMode

The state of the blend pipeline

Enums

BlendChannel

Which part of the BlendInput to pull from

BlendEquation

How to combine the values when blending

BlendFactor

The various coefficients to multiply the color inputs by

BlendFunction

The blend function controls how the source and destination are transformed

BlendInput

A color to pull from when blending

BlendOperation

The operation to apply to the pixels during blending