Blending topic
The BlendMode interface generates a function that blends two pixel values together:
// Combine non-overlapping regions of colors.
final xor = BlendMode.xor.getBlend(abgr8888, abgr8888);
print(xor(0x00000000, 0xFFFFFFFF)); // 0xFFFFFFFF
Default blend modes are provided using the PorterDuff constructor:
const BlendMode srcIn = PorterDuff(
PorterDuff.dst,
PorterDuff.zero,
);
| Blend Mode | Description |
|---|---|
| clear | Sets pixels to zero. |
| src | Copies the source pixel. |
| dst | Copies the destination pixel. |
| srcIn | The source that overlaps the destination replaces the destination. |
| dstIn | The destination that overlaps the source replaces the source. |
| srcOut | The source that does not overlap the destination replaces the destination. |
| dstOut | The destination that does not overlap the source replaces the source. |
| srcAtop | The source that overlaps the destination is blended with the destination. |
| dstAtop | The destination that overlaps the source is blended with the source. |
| xor | The source and destination are combined where they do not overlap. |
| plus | The source and destination are added together. |
Classes
- BlendMode Blending
- Algorithms to use when painting on the canvas.
-
Pixels<
T> Buffers Blending - A 2-dimensional buffer of pixel data in memory.
- PorterDuff Blending
- A BlendMode that uses Porter-Duff coefficients to blend colors.