setBlendColor method

  1. @override
void setBlendColor(
  1. Vector4 color
)
override

The constant the four constant-reading BlendFactors multiply by.

BlendFactor.blendColor and BlendFactor.oneMinusBlendColor read one channel of color per channel, BlendFactor.blendAlpha and BlendFactor.oneMinusBlendAlpha read its alpha for every channel — GL's CONSTANT_COLOR/CONSTANT_ALPHA split, which is what Metal and Vulkan spell the same way.

A pass starts with it at transparent black, whatever the pass before it set, and that is the same promise setStencilReference makes for the same reason: on a backend whose setters are global context state the next pass would otherwise inherit this one's, and the term is a multiplier, so inheriting it moves a picture rather than breaking one. Zero is the value that makes an unset constant contribute nothing.

Ask GraphicsDevice.supportsBlendColor first. A backend that answers false throws an UnsupportedError from here and from setBlend when the state names one of the four factors, rather than drawing the term as zero — flutter_gpu exposes no blend-constant setter, so the Impeller backend is that backend today.

Held by the conformance check a blend constant reaches the blend, or is refused, which draws with the constant on a backend that has one and demands the two refusals from a backend that has not.

Implementation

@override
void setBlendColor(Vector4 color) =>
    commands.add(RecordedBlendColor(color.clone()));