BlendMode
Blends are operators that take in two colors (source, destination) and return a new color.
Many of these operate the same on all 4 components: red, green, blue, alpha. For these, we just document what happens to one component, rather than naming each one separately.
Different ColorTypes have different representations for color components: 8-bit: 0..255 6-bit: 0..63 5-bit: 0..31 4-bit: 0..15 floats: 0...1
The documentation is expressed as if the component values are always 0..1 (floats).
For brevity, the documentation uses the following abbreviations s : source d : destination sa : source alpha da : destination alpha
Results are abbreviated r : if all 4 components are computed in the same manner ra : result alpha component rc : result "color": red, green, blue components
Category | enum class |
Type | hime_blend_mode_t |
This type can have following values:
kHimeBlendModeClear
- r = 0kHimeBlendModeSrc
- r = skHimeBlendModeDst
- r = dkHimeBlendModeSrcOver
- r = s + (1-sa)*dkHimeBlendModeDstOver
- r = d + (1-da)*skHimeBlendModeSrcIn
- r = s * dakHimeBlendModeDstIn
- r = d * sakHimeBlendModeSrcOut
- r = s * (1-da)kHimeBlendModeDstOut
- r = d * (1-sa)kHimeBlendModeSrcATop
- r = sda + d(1-sa)kHimeBlendModeDstATop
- r = dsa + s(1-da)kHimeBlendModeXor
- r = s*(1-da) + d*(1-sa)kHimeBlendModePlus
- r = min(s + d, 1)kHimeBlendModeModulate
- r = s*dkHimeBlendModeScreen
- r = s + d - s*dkHimeBlendModeOverlay
- Multiply or screen, depending on destination.kHimeBlendModeDarken
- rc = s + d - max(sda, dsa), ra = SrcOverkHimeBlendModeLighten
- rc = s + d - min(sda, dsa), ra = SrcOverkHimeBlendModeColorDodge
- Brighten destination to reflect source.kHimeBlendModeColorBurn
- Darken destination to reflect source.kHimeBlendModeHardLight
- Multiply or screen, depending on source.kHimeBlendModeSoftLight
- Lighten or darken, depending on source.kHimeBlendModeDifference
- rc = s + d - 2*(min(sda, dsa)), ra = SrcOverkHimeBlendModeExclusion
- rc = s + d - two(s*d), ra = SrcOverkHimeBlendModeMultiply
- r = s*(1-da) + d*(1-sa) + s*dkHimeBlendModeHue
- Hue of source with saturation and luminosity of destination.kHimeBlendModeSaturation
- Saturation of source with hue and luminosity of destination.kHimeBlendModeColor
- Hue and saturation of source with luminosity of destination.kHimeBlendModeLuminosity
- Luminosity of source with hue and saturation of destination.