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