1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/pathops/SkPathOps.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +/* 1.5 + * Copyright 2012 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 +#ifndef SkPathOps_DEFINED 1.11 +#define SkPathOps_DEFINED 1.12 + 1.13 +#include "SkPreConfig.h" 1.14 + 1.15 +class SkPath; 1.16 + 1.17 +// FIXME: move everything below into the SkPath class 1.18 +/** 1.19 + * The logical operations that can be performed when combining two paths. 1.20 + */ 1.21 +enum SkPathOp { 1.22 + kDifference_PathOp, //!< subtract the op path from the first path 1.23 + kIntersect_PathOp, //!< intersect the two paths 1.24 + kUnion_PathOp, //!< union (inclusive-or) the two paths 1.25 + kXOR_PathOp, //!< exclusive-or the two paths 1.26 + kReverseDifference_PathOp, //!< subtract the first path from the op path 1.27 +}; 1.28 + 1.29 +/** Set this path to the result of applying the Op to this path and the 1.30 + specified path: this = (this op operand). 1.31 + The resulting path will be constructed from non-overlapping contours. 1.32 + The curve order is reduced where possible so that cubics may be turned 1.33 + into quadratics, and quadratics maybe turned into lines. 1.34 + 1.35 + Returns true if operation was able to produce a result; 1.36 + otherwise, result is unmodified. 1.37 + 1.38 + @param one The first operand (for difference, the minuend) 1.39 + @param two The second operand (for difference, the subtrahend) 1.40 + @param result The product of the operands. The result may be one of the 1.41 + inputs. 1.42 + @return True if operation succeeded. 1.43 + */ 1.44 +bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); 1.45 + 1.46 +/** Set this path to a set of non-overlapping contours that describe the 1.47 + same area as the original path. 1.48 + The curve order is reduced where possible so that cubics may 1.49 + be turned into quadratics, and quadratics maybe turned into lines. 1.50 + 1.51 + Returns true if operation was able to produce a result; 1.52 + otherwise, result is unmodified. 1.53 + 1.54 + @param path The path to simplify. 1.55 + @param result The simplified path. The result may be the input. 1.56 + @return True if simplification succeeded. 1.57 + */ 1.58 +bool SK_API Simplify(const SkPath& path, SkPath* result); 1.59 + 1.60 +#endif