aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/pathops/SkPathOps.h
blob: 285118673f18dfb6f4485e112a0dda88cc19ffe6 (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
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SkPathOps_DEFINED
#define SkPathOps_DEFINED

class SkPath;

// FIXME: move everything below into the SkPath class
/**
  *  The logical operations that can be performed when combining two paths.
  */
enum SkPathOp {
    kDifference_PathOp,         //!< subtract the op path from the first path
    kIntersect_PathOp,          //!< intersect the two paths
    kUnion_PathOp,              //!< union (inclusive-or) the two paths
    kXOR_PathOp,                //!< exclusive-or the two paths
    kReverseDifference_PathOp,  //!< subtract the first path from the op path
};

/**
  *  Set this path to the result of applying the Op to this path and the
  *  specified path: this = (this op operand). The resulting path will be constructed
  *  from non-overlapping contours. The curve order is reduced where possible so that cubics may
  *  be turned into quadratics, and quadratics maybe turned into lines.
  */
void Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result);

/**
  *  Set this path to a set of non-overlapping contours that describe the same
  *  area as the original path. The curve order is reduced where possible so that cubics may
  *  be turned into quadratics, and quadratics maybe turned into lines.
  */
void Simplify(const SkPath& path, SkPath* result);

#endif