BlendMode Enum
How the color of a paint is mixed with the color of the pixels it is drawn on, before it is composited: the blend modes of image editors and of CSS.
public enum BlendModeRemarks
With the colors of the paint s and of the pixel d as fractions of one, a blend mode gives a color B(s, d). The paint takes the color (1 - ad) s + ad B(s, d), where ad is the alpha of the pixel: on a transparent pixel the paint keeps its color, and on an opaque one it has the blended color. It is then composited by the CompositeMode of the brush, with its own alpha, as any paint is. The formulas are those of "Compositing and Blending Level 1" of the W3C.
The blended color is computed in double precision from the sample values, and rounded to the nearest sample value, ties upward, before the paint is composited with the exact arithmetic of the operators. Only additions, multiplications, divisions and square roots are involved: the pixels are the same on every platform. The modes from BlendMode.Multiply to BlendMode.Exclusion mix each color channel on its own; the last four take a color as a whole, with the luminosity 0.3 R + 0.59 G + 0.11 B. On a grayscale frame the paint and the pixels are gray levels, which these four modes treat as colors without saturation.
Fields
| Name | Value | Description |
|---|---|---|
Normal | 0 | The color of the paint, as it is. This is the default. |
Multiply | 1 | The product of the two colors, s d: always darker, as two slides held together. White changes nothing. |
Screen | 2 | The inverse of the product of the inverses, s + d - s d: always lighter, as two projectors on one screen. Black changes nothing. |
Overlay | 3 | BlendMode.Multiply where the pixel is dark and BlendMode.Screen where it is light: BlendMode.HardLight with the two colors exchanged. |
Darken | 4 | The darker of the two colors, channel by channel. |
Lighten | 5 | The lighter of the two colors, channel by channel. |
ColorDodge | 6 | The pixel brightened to reflect the paint: min(1, d / (1 - s)). Black changes nothing. |
ColorBurn | 7 | The pixel darkened to reflect the paint: 1 - min(1, (1 - d) / s). White changes nothing. |
HardLight | 8 | BlendMode.Multiply where the paint is dark and BlendMode.Screen where it is light: a harsh spotlight. |
SoftLight | 9 | The pixel darkened where the paint is dark and lightened where it is light, without reaching black or white: a diffused spotlight. |
Difference | 10 | The difference of the two colors, |d - s|. White inverts the pixel; black changes nothing. |
Exclusion | 11 | s + d - 2 s d: like BlendMode.Difference, with less contrast. |
Hue | 12 | The hue of the paint, with the saturation and the luminosity of the pixel. |
Saturation | 13 | The saturation of the paint, with the hue and the luminosity of the pixel. |
Color | 14 | The hue and the saturation of the paint, with the luminosity of the pixel: tints a gray image. |
Luminosity | 15 | The luminosity of the paint, with the hue and the saturation of the pixel. |