BlendMode
class BlendMode
kotlin.Any | ||
↳ | kotlin.Enum<android.graphics.BlendMode> | |
↳ | android.graphics.BlendMode |
Summary
Enum values | |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enum values
CLEAR
enum val CLEAR : BlendMode
Destination pixels covered by the source are cleared to 0.
\(\alpha_{out} = 0\)
\(C_{out} = 0\)
COLOR
enum val COLOR : BlendMode
Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged.
COLOR_BURN
enum val COLOR_BURN : BlendMode
Makes destination darker to reflect source.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\begin{equation} C_{out} = \begin{cases} C_{dst} + C_{src}*(1 - \alpha_{dst}) & C_{dst} = \alpha_{dst} \\ \alpha_{dst}*(1 - \alpha_{src}) & C_{src} = 0 \\ \alpha_{src}*(\alpha_{dst} - min(\alpha_{dst}, (\alpha_{dst} - C_{dst})*\alpha_{src}/C_{src})) + C_{src} * (1 - \alpha_{dst}) + \alpha_{dst}*(1-\alpha_{src}) & otherwise \end{cases} \end{equation}
COLOR_DODGE
enum val COLOR_DODGE : BlendMode
Makes destination brighter to reflect source.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\begin{equation} C_{out} = \begin{cases} C_{src} * (1 - \alpha_{dst}) & C_{dst} = 0 \\ C_{src} + \alpha_{dst}*(1 - \alpha_{src}) & C_{src} = \alpha_{src} \\ \alpha_{src} * min(\alpha_{dst}, C_{dst} * \alpha_{src}/(\alpha_{src} - C_{src})) + C_{src} *(1 - \alpha_{dst} + \alpha_{dst}*(1 - \alpha_{src}) & otherwise \end{cases} \end{equation}
DARKEN
enum val DARKEN : BlendMode
Retains the smallest component of the source and destination pixels.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\(C_{out} = (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst} + min(C_{src}, C_{dst})\)
DIFFERENCE
enum val DIFFERENCE : BlendMode
Subtracts darker from lighter with higher contrast.
\begin{equation} \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst} \end{equation}
\begin{equation} C_{out} = C_{src} + C_{dst} - 2 * min(C_{src} * \alpha_{dst}, C_{dst} * \alpha_{src}) \end{equation}
DST
enum val DST : BlendMode
The source pixels are discarded, leaving the destination intact.
\(\alpha_{out} = \alpha_{dst}\)
\(C_{out} = C_{dst}\)
DST_ATOP
enum val DST_ATOP : BlendMode
Discards the destination pixels that are not covered by source pixels. Draws remaining destination pixels over source pixels.
\(\alpha_{out} = \alpha_{src}\)
\(C_{out} = \alpha_{src} * C_{dst} + (1 - \alpha_{dst}) * C_{src}\)
DST_IN
enum val DST_IN : BlendMode
Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.
\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)
\(C_{out} = C_{dst} * \alpha_{src}\)
DST_OUT
enum val DST_OUT : BlendMode
Keeps the destination pixels that are not covered by source pixels. Discards destination pixels that are covered by source pixels. Discards all source pixels.
\(\alpha_{out} = (1 - \alpha_{src}) * \alpha_{dst}\)
\(C_{out} = (1 - \alpha_{src}) * C_{dst}\)
DST_OVER
enum val DST_OVER : BlendMode
The source pixels are drawn behind the destination pixels.
\(\alpha_{out} = \alpha_{dst} + (1 - \alpha_{dst}) * \alpha_{src}\)
\(C_{out} = C_{dst} + (1 - \alpha_{dst}) * C_{src}\)
EXCLUSION
enum val EXCLUSION : BlendMode
Subtracts darker from lighter with lower contrast.
\begin{equation} \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst} \end{equation}
\begin{equation} C_{out} = C_{src} + C_{dst} - 2 * C_{src} * C_{dst} \end{equation}
HARD_LIGHT
enum val HARD_LIGHT : BlendMode
Makes destination lighter or darker, depending on source.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\begin{equation} C_{out} = \begin{cases} 2*C_{src}*C_{dst} & C_{src}*(1-\alpha_{dst}) + C_{dst}*(1-\alpha_{src}) + 2*C_{src} \leq \alpha_{src} \\ \alpha_{src}*\alpha_{dst}- 2*(\alpha_{dst} - C_{dst})*(\alpha_{src} - C_{src}) & otherwise \end{cases} \end{equation}
HUE
enum val HUE : BlendMode
Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged.
LIGHTEN
enum val LIGHTEN : BlendMode
Retains the largest component of the source and destination pixel.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\(C_{out} = (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst} + max(C_{src}, C_{dst})\)
LUMINOSITY
enum val LUMINOSITY : BlendMode
Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged.
MODULATE
enum val MODULATE : BlendMode
Multiplies the source and destination pixels.
\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)
\(C_{out} = C_{src} * C_{dst}\)
MULTIPLY
enum val MULTIPLY : BlendMode
Multiplies the source and destination pixels.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\(C_{out} = C_{src} * (1 - \alpha_{dst}) + C_{dst} * (1 - \alpha_{src}) + (C_{src} * C_{dst})\)
OVERLAY
enum val OVERLAY : BlendMode
Multiplies or screens the source and destination depending on the destination color.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\(\begin{equation} C_{out} = \begin{cases} 2 * C_{src} * C_{dst} & 2 * C_{dst} \lt \alpha_{dst} \\ \alpha_{src} * \alpha_{dst} - 2 (\alpha_{dst} - C_{src}) (\alpha_{src} - C_{dst}) & otherwise \end{cases} \end{equation}\)
PLUS
enum val PLUS : BlendMode
Adds the source pixels to the destination pixels and saturates the result.
\(\alpha_{out} = max(0, min(\alpha_{src} + \alpha_{dst}, 1))\)
\(C_{out} = max(0, min(C_{src} + C_{dst}, 1))\)
SATURATION
enum val SATURATION : BlendMode
Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged.
SCREEN
enum val SCREEN : BlendMode
Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.
\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
\(C_{out} = C_{src} + C_{dst} - C_{src} * C_{dst}\)
SOFT_LIGHT
enum val SOFT_LIGHT : BlendMode
Makes destination lighter or darker, depending on source.
Where \begin{equation} m = \begin{cases} C_{dst} / \alpha_{dst} & \alpha_{dst} \gt 0 \\ 0 & otherwise \end{cases} \end{equation}
\begin{equation} g = \begin{cases} (16 * m * m + 4 * m) * (m - 1) + 7 * m & 4 * C_{dst} \leq \alpha_{dst} \\ \sqrt m - m & otherwise \end{cases} \end{equation}
\begin{equation} f = \begin{cases} C_{dst} * (\alpha_{src} + (2 * C_{src} - \alpha_{src}) * (1 - m)) & 2 * C_{src} \leq \alpha_{src} \\ C_{dst} * \alpha_{src} + \alpha_{dst} * (2 * C_{src} - \alpha_{src}) * g & otherwise \end{cases} \end{equation}
\begin{equation} \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst} \end{equation} \begin{equation} C_{out} = C_{src} / \alpha_{dst} + C_{dst} / \alpha_{src} + f \end{equation}
SRC
enum val SRC : BlendMode
The source pixels replace the destination pixels.
\(\alpha_{out} = \alpha_{src}\)
\(C_{out} = C_{src}\)
SRC_ATOP
enum val SRC_ATOP : BlendMode
Discards the source pixels that do not cover destination pixels. Draws remaining source pixels over destination pixels.
\(\alpha_{out} = \alpha_{dst}\)
\(C_{out} = \alpha_{dst} * C_{src} + (1 - \alpha_{src}) * C_{dst}\)
SRC_IN
enum val SRC_IN : BlendMode
Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.
\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)
\(C_{out} = C_{src} * \alpha_{dst}\)
SRC_OUT
enum val SRC_OUT : BlendMode
Keeps the source pixels that do not cover destination pixels. Discards source pixels that cover destination pixels. Discards all destination pixels.
\(\alpha_{out} = (1 - \alpha_{dst}) * \alpha_{src}\)
\(C_{out} = (1 - \alpha_{dst}) * C_{src}\)
SRC_OVER
enum val SRC_OVER : BlendMode
The source pixels are drawn over the destination pixels.
\(\alpha_{out} = \alpha_{src} + (1 - \alpha_{src}) * \alpha_{dst}\)
\(C_{out} = C_{src} + (1 - \alpha_{src}) * C_{dst}\)
XOR
enum val XOR : BlendMode
Discards the source and destination pixels where source pixels cover destination pixels. Draws remaining source pixels.
\(\alpha_{out} = (1 - \alpha_{dst}) * \alpha_{src} + (1 - \alpha_{src}) * \alpha_{dst}\)
\(C_{out} = (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst}\)