• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkTypes.h"
12 
13 enum class SkBlendMode {
14     kClear,    //!< [0, 0]
15     kSrc,      //!< [Sa, Sc]
16     kDst,      //!< [Da, Dc]
17     kSrcOver,  //!< [Sa + Da * (1 - Sa), Sc + Dc * (1 - Sa)]
18     kDstOver,  //!< [Da + Sa * (1 - Da), Dc + Sc * (1 - Da)]
19     kSrcIn,    //!< [Sa * Da, Sc * Da]
20     kDstIn,    //!< [Da * Sa, Dc * Sa]
21     kSrcOut,   //!< [Sa * (1 - Da), Sc * (1 - Da)]
22     kDstOut,   //!< [Da * (1 - Sa), Dc * (1 - Sa)]
23     kSrcATop,  //!< [Da, Sc * Da + Dc * (1 - Sa)]
24     kDstATop,  //!< [Sa, Dc * Sa + Sc * (1 - Da)]
25     kXor,      //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa)]
26     kPlus,     //!< [Sa + Da, Sc + Dc]
27     kModulate, // multiplies all components (= alpha and color)
28 
29     // Following blend modes are defined in the CSS Compositing standard:
30     // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
31     kScreen,
32     kLastCoeffMode = kScreen,
33 
34     kOverlay,
35     kDarken,
36     kLighten,
37     kColorDodge,
38     kColorBurn,
39     kHardLight,
40     kSoftLight,
41     kDifference,
42     kExclusion,
43     kMultiply,
44     kLastSeparableMode = kMultiply,
45 
46     kHue,
47     kSaturation,
48     kColor,
49     kLuminosity,
50     kLastMode = kLuminosity
51 };
52 
53 /**
54  *  Return the (c-string) name of the blendmode.
55  */
56 SK_API const char* SkBlendMode_Name(SkBlendMode);
57 
58 #endif
59