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/SkPath.h"
11 #include "include/core/SkTypes.h"
12 #include "include/private/base/SkTArray.h"
13 #include "include/private/base/SkTDArray.h"
14 
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 
86 class SK_API SkOpBuilder {
87 public:
94  void add(const SkPath& path, SkPathOp _operator);
95 
102  bool resolve(SkPath* result);
103 
104 private:
105  skia_private::TArray<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
bool SK_API AsWinding(const SkPath &path, SkPath *result)
Set the result with fill type winding to area equivalent to path.
SkPathOp
The logical operations that can be performed when combining two paths.
Definition: SkPathOps.h:22
@ kReverseDifference_SkPathOp
subtract the first path from the op path
Definition: SkPathOps.h:27
@ kDifference_SkPathOp
subtract the op path from the first path
Definition: SkPathOps.h:23
@ kIntersect_SkPathOp
intersect the two paths
Definition: SkPathOps.h:24
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition: SkPathOps.h:25
@ kXOR_SkPathOp
exclusive-or the two paths
Definition: SkPathOps.h:26
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...
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.
bool SK_API TightBounds(const SkPath &path, SkRect *result)
Set the resulting rectangle to the tight bounds of the path.
Perform a series of path operations, optimized for unioning many paths together.
Definition: SkPathOps.h:86
void add(const SkPath &path, SkPathOp _operator)
Add one or more paths and their operand.
bool resolve(SkPath *result)
Computes the sum of all paths and operands, and resets the builder to its initial state.
SkPath contain geometry.
Definition: SkPath.h:58
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582