Skia
2D Graphics Library
SkPathOps.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 SkPathOps_DEFINED
8 #define SkPathOps_DEFINED
9 
10 #include "include/core/SkTypes.h"
11 #include "include/private/SkTArray.h"
12 #include "include/private/SkTDArray.h"
13 
14 class SkPath;
15 struct SkRect;
16 
17 
18 // FIXME: move everything below into the SkPath class
22 enum SkPathOp {
28 };
29 
46 bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result);
47 
60 bool SK_API Simplify(const SkPath& path, SkPath* result);
61 
68 bool SK_API TightBounds(const SkPath& path, SkRect* result);
69 
82 bool SK_API AsWinding(const SkPath& path, SkPath* result);
83 
87 public:
94  void add(const SkPath& path, SkPathOp _operator);
95 
102  bool resolve(SkPath* result);
103 
104 private:
105  SkTArray<SkPath> fPathRefs;
106  SkTDArray<SkPathOp> fOps;
107 
108  static bool FixWinding(SkPath* path);
109  static void ReversePath(SkPath* path);
110  void reset();
111 };
112 
113 #endif
Op
bool SK_API Op(const SkPath &one, const SkPath &two, SkPathOp op, SkPath *result)
Set this path to the result of applying the Op to this path and the specified path: this = (this op o...
SkPath
Definition: SkPath.h:44
SkOpBuilder::add
void add(const SkPath &path, SkPathOp _operator)
Add one or more paths and their operand.
Simplify
bool SK_API Simplify(const SkPath &path, SkPath *result)
Set this path to a set of non-overlapping contours that describe the same area as the original path.
kXOR_SkPathOp
@ kXOR_SkPathOp
exclusive-or the two paths
Definition: SkPathOps.h:26
SkTypes.h
kUnion_SkPathOp
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition: SkPathOps.h:25
kDifference_SkPathOp
@ kDifference_SkPathOp
subtract the op path from the first path
Definition: SkPathOps.h:23
kIntersect_SkPathOp
@ kIntersect_SkPathOp
intersect the two paths
Definition: SkPathOps.h:24
SK_API
#define SK_API
Definition: SkTypes.h:181
AsWinding
bool SK_API AsWinding(const SkPath &path, SkPath *result)
Set the result with fill type winding to area equivalent to path.
kReverseDifference_SkPathOp
@ kReverseDifference_SkPathOp
subtract the first path from the op path
Definition: SkPathOps.h:27
SkOpBuilder
Perform a series of path operations, optimized for unioning many paths together.
Definition: SkPathOps.h:86
SkOpBuilder::resolve
bool resolve(SkPath *result)
Computes the sum of all paths and operands, and resets the builder to its initial state.
TightBounds
bool SK_API TightBounds(const SkPath &path, SkRect *result)
Set the resulting rectangle to the tight bounds of the path.
SkPathOp
SkPathOp
The logical operations that can be performed when combining two paths.
Definition: SkPathOps.h:22
SkRect
Definition: SkRect.h:572