SkBlendMode.h 3.9 KB

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