blendMode property

BlendMode blendMode

A blend mode to apply when a shape is drawn or a layer is composited.

The source colors are from the shape being drawn (e.g. from Canvas.drawPath) or layer being composited (the graphics that were drawn between the Canvas.saveLayer and Canvas.restore calls), after applying the colorFilter, if any.

The destination colors are from the background onto which the shape or layer is being composited.

Defaults to BlendMode.srcOver.

See also:


BlendMode get blendMode {
  final int encoded = _data.getInt32(_kBlendModeOffset, _kFakeHostEndian);
  return BlendMode.values[encoded ^ _kBlendModeDefault];
void blendMode= (BlendMode value)


set blendMode(BlendMode value) {
  assert(value != null); // ignore: unnecessary_null_comparison
  final int encoded = value.index ^ _kBlendModeDefault;
  _data.setInt32(_kBlendModeOffset, encoded, _kFakeHostEndian);