Skia
2D Graphics Library
SkBlendMode.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkBlendMode_DEFINED
9 #define SkBlendMode_DEFINED
10 
11 #include "include/core/SkTypes.h"
12 
38 enum class SkBlendMode {
39  kClear,
40  kSrc,
41  kDst,
42  kSrcOver,
43  kDstOver,
44  kSrcIn,
45  kDstIn,
46  kSrcOut,
47  kDstOut,
48  kSrcATop,
49  kDstATop,
50  kXor,
51  kPlus,
52  kModulate,
53  kScreen,
54 
55  kOverlay,
56  kDarken,
57  kLighten,
58  kColorDodge,
59  kColorBurn,
60  kHardLight,
61  kSoftLight,
62  kDifference,
63  kExclusion,
64  kMultiply,
65 
66  kHue,
67  kSaturation,
68  kColor,
69  kLuminosity,
70 
74 };
75 
76 static constexpr int kSkBlendModeCount = static_cast<int>(SkBlendMode::kLastMode) + 1;
77 
84 enum class SkBlendModeCoeff {
85  kZero,
86  kOne,
87  kSC,
88  kISC,
89  kDC,
90  kIDC,
91  kSA,
92  kISA,
93  kDA,
94  kIDA,
97 };
98 
104 
105 
110 SK_API const char* SkBlendMode_Name(SkBlendMode blendMode);
111 
112 #endif
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
Returns name of blendMode as null-terminated C string.
SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff *src, SkBlendModeCoeff *dst)
Returns true if 'mode' is a coefficient-based blend mode (<= kLastCoeffMode).
static constexpr int kSkBlendModeCount
Definition: SkBlendMode.h:76
SkBlendMode
Blends are operators that take in two colors (source, destination) and return a new color.
Definition: SkBlendMode.h:38
@ kSrcOut
r = s * (1-da)
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kDstIn
r = d * sa
@ kModulate
r = s*d
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kLastCoeffMode
last porter duff blend mode
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLastSeparableMode
last blend mode operating separately on components
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kLastMode
last valid value
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDstOut
r = d * (1-sa)
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
@ kSrcIn
r = s * da
@ kClear
r = 0
SkBlendModeCoeff
For Porter-Duff SkBlendModes (those <= kLastCoeffMode), these coefficients describe the blend equatio...
Definition: SkBlendMode.h:84
@ kSA
inverse dst color (i.e.
@ kDC
inverse src color (i.e.
@ kIDC
dst color
@ kISA
src alpha
@ kCoeffCount
inverse dst alpha (i.e.
@ kIDA
dst alpha
@ kISC
src color
@ kDA
inverse src alpha (i.e.