Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2012 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | #ifndef SkPathOps_DEFINED |
michael@0 | 8 | #define SkPathOps_DEFINED |
michael@0 | 9 | |
michael@0 | 10 | #include "SkPreConfig.h" |
michael@0 | 11 | |
michael@0 | 12 | class SkPath; |
michael@0 | 13 | |
michael@0 | 14 | // FIXME: move everything below into the SkPath class |
michael@0 | 15 | /** |
michael@0 | 16 | * The logical operations that can be performed when combining two paths. |
michael@0 | 17 | */ |
michael@0 | 18 | enum SkPathOp { |
michael@0 | 19 | kDifference_PathOp, //!< subtract the op path from the first path |
michael@0 | 20 | kIntersect_PathOp, //!< intersect the two paths |
michael@0 | 21 | kUnion_PathOp, //!< union (inclusive-or) the two paths |
michael@0 | 22 | kXOR_PathOp, //!< exclusive-or the two paths |
michael@0 | 23 | kReverseDifference_PathOp, //!< subtract the first path from the op path |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | /** Set this path to the result of applying the Op to this path and the |
michael@0 | 27 | specified path: this = (this op operand). |
michael@0 | 28 | The resulting path will be constructed from non-overlapping contours. |
michael@0 | 29 | The curve order is reduced where possible so that cubics may be turned |
michael@0 | 30 | into quadratics, and quadratics maybe turned into lines. |
michael@0 | 31 | |
michael@0 | 32 | Returns true if operation was able to produce a result; |
michael@0 | 33 | otherwise, result is unmodified. |
michael@0 | 34 | |
michael@0 | 35 | @param one The first operand (for difference, the minuend) |
michael@0 | 36 | @param two The second operand (for difference, the subtrahend) |
michael@0 | 37 | @param result The product of the operands. The result may be one of the |
michael@0 | 38 | inputs. |
michael@0 | 39 | @return True if operation succeeded. |
michael@0 | 40 | */ |
michael@0 | 41 | bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); |
michael@0 | 42 | |
michael@0 | 43 | /** Set this path to a set of non-overlapping contours that describe the |
michael@0 | 44 | same area as the original path. |
michael@0 | 45 | The curve order is reduced where possible so that cubics may |
michael@0 | 46 | be turned into quadratics, and quadratics maybe turned into lines. |
michael@0 | 47 | |
michael@0 | 48 | Returns true if operation was able to produce a result; |
michael@0 | 49 | otherwise, result is unmodified. |
michael@0 | 50 | |
michael@0 | 51 | @param path The path to simplify. |
michael@0 | 52 | @param result The simplified path. The result may be the input. |
michael@0 | 53 | @return True if simplification succeeded. |
michael@0 | 54 | */ |
michael@0 | 55 | bool SK_API Simplify(const SkPath& path, SkPath* result); |
michael@0 | 56 | |
michael@0 | 57 | #endif |