• 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 "include/core/SkTypes.h"
12 
13 enum class SkBlendMode {
14     kClear,                           //!< replaces destination with zero: fully transparent
15     kSrc,                             //!< replaces destination
16     kDst,                             //!< preserves destination
17     kSrcOver,                         //!< source over destination
18     kDstOver,                         //!< destination over source
19     kSrcIn,                           //!< source trimmed inside destination
20     kDstIn,                           //!< destination trimmed by source
21     kSrcOut,                          //!< source trimmed outside destination
22     kDstOut,                          //!< destination trimmed outside source
23     kSrcATop,                         //!< source inside destination blended with destination
24     kDstATop,                         //!< destination inside source blended with source
25     kXor,                             //!< each of source and destination trimmed outside the other
26     kPlus,                            //!< sum of colors
27     kModulate,                        //!< product of premultiplied colors; darkens destination
28     kScreen,                //!< multiply inverse of pixels, inverting result; brightens destination
29     kLastCoeffMode     = kScreen,     //!< last porter duff blend mode
30     kOverlay,                         //!< multiply or screen, depending on destination
31     kDarken,                          //!< darker of source and destination
32     kLighten,                         //!< lighter of source and destination
33     kColorDodge,                      //!< brighten destination to reflect source
34     kColorBurn,                       //!< darken destination to reflect source
35     kHardLight,                       //!< multiply or screen, depending on source
36     kSoftLight,                       //!< lighten or darken, depending on source
37     kDifference,                      //!< subtract darker from lighter with higher contrast
38     kExclusion,                       //!< subtract darker from lighter with lower contrast
39     kMultiply,                        //!< multiply source with destination, darkening image
40     kLastSeparableMode = kMultiply,   //!< last blend mode operating separately on components
41     kHue,                           //!< hue of source with saturation and luminosity of destination
42     kSaturation,                    //!< saturation of source with hue and luminosity of destination
43     kColor,                         //!< hue and saturation of source with luminosity of destination
44     kLuminosity,                    //!< luminosity of source with hue and saturation of destination
45     kLastMode          = kLuminosity, //!< last valid value
46 };
47 
48 /** Returns name of blendMode as null-terminated C string.
49 
50     @param blendMode  one of:
51                       SkBlendMode::kClear, SkBlendMode::kSrc, SkBlendMode::kDst,
52                       SkBlendMode::kSrcOver, SkBlendMode::kDstOver, SkBlendMode::kSrcIn,
53                       SkBlendMode::kDstIn, SkBlendMode::kSrcOut, SkBlendMode::kDstOut,
54                       SkBlendMode::kSrcATop, SkBlendMode::kDstATop, SkBlendMode::kXor,
55                       SkBlendMode::kPlus, SkBlendMode::kModulate, SkBlendMode::kScreen,
56                       SkBlendMode::kOverlay, SkBlendMode::kDarken, SkBlendMode::kLighten,
57                       SkBlendMode::kColorDodge, SkBlendMode::kColorBurn, SkBlendMode::kHardLight,
58                       SkBlendMode::kSoftLight, SkBlendMode::kDifference, SkBlendMode::kExclusion,
59                       SkBlendMode::kMultiply, SkBlendMode::kHue, SkBlendMode::kSaturation,
60                       SkBlendMode::kColor, SkBlendMode::kLuminosity
61     @return           C string
62 */
63 SK_API const char* SkBlendMode_Name(SkBlendMode blendMode);
64 
65 #endif
66