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 
82 enum class SkBlendModeCoeff {
83  kZero,
84  kOne,
85  kSC,
86  kISC,
87  kDC,
88  kIDC,
89  kSA,
90  kISA,
91  kDA,
92  kIDA,
95 };
96 
102 
103 
108 SK_API const char* SkBlendMode_Name(SkBlendMode blendMode);
109 
110 #endif
SkBlendMode::kSaturation
@ kSaturation
saturation of source with hue and luminosity of destination
SkBlendMode::kDstIn
@ kDstIn
r = d * sa
SkBlendModeCoeff::kOne
@ kOne
0
SkBlendModeCoeff::kDC
@ kDC
inverse src color (i.e.
SkBlendMode::kLastMode
@ kLastMode
last valid value
SkBlendModeCoeff::kISA
@ kISA
src alpha
SkBlendModeCoeff::kSA
@ kSA
inverse dst color (i.e.
SkBlendMode::kLighten
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
SkTypes.h
SkBlendMode::kDstOver
@ kDstOver
r = d + (1-da)*s
SkBlendMode::kColorBurn
@ kColorBurn
darken destination to reflect source
SkBlendMode::kDst
@ kDst
r = d
SkBlendMode
SkBlendMode
Blends are operators that take in two colors (source, destination) and return a new color.
Definition: SkBlendMode.h:38
SkBlendMode::kLastCoeffMode
@ kLastCoeffMode
last porter duff blend mode
SkBlendModeCoeff::kIDC
@ kIDC
dst color
SkBlendModeCoeff
SkBlendModeCoeff
For Porter-Duff SkBlendModes (those <= kLastCoeffMode), these coefficients describe the blend equatio...
Definition: SkBlendMode.h:82
SkBlendMode::kLuminosity
@ kLuminosity
luminosity of source with hue and saturation of destination
SkBlendMode::kDarken
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
SkBlendMode::kDstATop
@ kDstATop
r = d*sa + s*(1-da)
SkBlendMode::kHardLight
@ kHardLight
multiply or screen, depending on source
SkBlendMode::kSrcOut
@ kSrcOut
r = s * (1-da)
SkBlendModeCoeff::kIDA
@ kIDA
dst alpha
SkBlendMode_Name
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
Returns name of blendMode as null-terminated C string.
SkBlendMode::kExclusion
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
SkBlendMode::kModulate
@ kModulate
r = s*d
SkBlendMode::kColor
@ kColor
hue and saturation of source with luminosity of destination
SK_API
#define SK_API
Definition: SkTypes.h:181
SkBlendModeCoeff::kISC
@ kISC
src color
SkBlendModeCoeff::kSC
@ kSC
1
SkBlendMode::kSoftLight
@ kSoftLight
lighten or darken, depending on source
SkBlendModeCoeff::kCoeffCount
@ kCoeffCount
inverse dst alpha (i.e.
SkBlendMode::kClear
@ kClear
r = 0
SkBlendMode::kXor
@ kXor
r = s*(1-da) + d*(1-sa)
SkBlendMode::kMultiply
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
SkBlendMode::kSrcATop
@ kSrcATop
r = s*da + d*(1-sa)
SkBlendMode::kSrc
@ kSrc
r = s
SkBlendMode::kHue
@ kHue
hue of source with saturation and luminosity of destination
SkBlendMode::kSrcOver
@ kSrcOver
r = s + (1-sa)*d
SkBlendMode::kScreen
@ kScreen
r = s + d - s*d
SkBlendModeCoeff::kDA
@ kDA
inverse src alpha (i.e.
SkBlendMode::kDifference
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
SkBlendMode::kPlus
@ kPlus
r = min(s + d, 1)
SkBlendMode::kColorDodge
@ kColorDodge
brighten destination to reflect source
SkBlendModeCoeff::kZero
@ kZero
SkBlendMode::kLastSeparableMode
@ kLastSeparableMode
last blend mode operating separately on components
SkBlendMode::kOverlay
@ kOverlay
multiply or screen, depending on destination
SkBlendMode::kDstOut
@ kDstOut
r = d * (1-sa)
SkBlendMode_AsCoeff
SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff *src, SkBlendModeCoeff *dst)
Returns true if 'mode' is a coefficient-based blend mode (<= kLastCoeffMode).
SkBlendMode::kSrcIn
@ kSrcIn
r = s * da