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 const SkBlendMode gUncorrelatedCoverageToBlend[] = {
15     SkBlendMode::kSrcOver,  // or DstOver
16     SkBlendMode::kSrcIn,    // or kDstIn
17     SkBlendMode::kSrcOut,
18     SkBlendMode::kDstOut,
19     SkBlendMode::kXor,
20 };
21 
22 #if 0
23 // Experimental idea to extend to overlap types
24 
25 Master calculation =   X(S,D) + Y(S,D) + Z(S,D)
26 
27 enum class SkCoverageOverlap {
28                     // X                Y               Z
29     kUncorrelated,  // S*D              S*(1-D)         D*(1-S)
30     kConjoint,      // min(S,D)         max(S-D,0)      max(D-S,0)
31     kDisjoint,      // max(S+D-1,0)     min(S,1-D)      min(D,1-S)
32 
33     kLast = kDisjoint
34 };
35 
36 // The coverage modes each have a set of coefficients to be applied to the general equation (above)
37 //
38 //  e.g.
39 //     kXor+conjoint = max(S-D,0) + max(D-S,0) ==> abs(D-S)
40 //
41 kUnion,             // 1,1,1
42 kIntersect,         // 1,0,0
43 kDifference,        // 0,1,0
44 kReverseDifference, // 0,0,1
45 kXor,               // 0,1,1
46 
47 #endif
48 
49 #endif
50