SkCoverageModePriv.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2018 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 SkCoverageModePriv_DEFINED
  8. #define SkCoverageModePriv_DEFINED
  9. #include "include/core/SkBlendMode.h"
  10. #include "include/core/SkCoverageMode.h"
  11. SkBlendMode SkUncorrelatedCoverageModeToBlendMode(SkCoverageMode);
  12. #if 0
  13. // Experimental idea to extend to overlap types
  14. Master calculation = X(S,D) + Y(S,D) + Z(S,D)
  15. enum class SkCoverageOverlap {
  16. // X Y Z
  17. kUncorrelated, // S*D S*(1-D) D*(1-S)
  18. kConjoint, // min(S,D) max(S-D,0) max(D-S,0)
  19. kDisjoint, // max(S+D-1,0) min(S,1-D) min(D,1-S)
  20. kLast = kDisjoint
  21. };
  22. // The coverage modes each have a set of coefficients to be applied to the general equation (above)
  23. //
  24. // e.g.
  25. // kXor+conjoint = max(S-D,0) + max(D-S,0) ==> abs(D-S)
  26. //
  27. kUnion, // 1,1,1
  28. kIntersect, // 1,0,0
  29. kDifference, // 0,1,0
  30. kReverseDifference, // 0,0,1
  31. kXor, // 0,1,1
  32. #endif
  33. #endif