aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCoverageModePriv.h
blob: e8b8939ade83e2332c4320567d2868fcfdff853c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkCoverageModePriv_DEFINED
#define SkCoverageModePriv_DEFINED

#include "SkBlendMode.h"
#include "SkCoverageMode.h"

SkBlendMode SkUncorrelatedCoverageModeToBlendMode(SkCoverageMode);

#if 0
// Experimental idea to extend to overlap types

Master calculation =   X(S,D) + Y(S,D) + Z(S,D)

enum class SkCoverageOverlap {
                    // X                Y               Z
    kUncorrelated,  // S*D              S*(1-D)         D*(1-S)
    kConjoint,      // min(S,D)         max(S-D,0)      max(D-S,0)
    kDisjoint,      // max(S+D-1,0)     min(S,1-D)      min(D,1-S)

    kLast = kDisjoint
};

// The coverage modes each have a set of coefficients to be applied to the general equation (above)
//
//  e.g.
//     kXor+conjoint = max(S-D,0) + max(D-S,0) ==> abs(D-S)
//
kUnion,             // 1,1,1
kIntersect,         // 1,0,0
kDifference,        // 0,1,0
kReverseDifference, // 0,0,1
kXor,               // 0,1,1

#endif

#endif