michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: #ifndef SkPathOps_DEFINED michael@0: #define SkPathOps_DEFINED michael@0: michael@0: #include "SkPreConfig.h" michael@0: michael@0: class SkPath; michael@0: michael@0: // FIXME: move everything below into the SkPath class michael@0: /** michael@0: * The logical operations that can be performed when combining two paths. michael@0: */ michael@0: enum SkPathOp { michael@0: kDifference_PathOp, //!< subtract the op path from the first path michael@0: kIntersect_PathOp, //!< intersect the two paths michael@0: kUnion_PathOp, //!< union (inclusive-or) the two paths michael@0: kXOR_PathOp, //!< exclusive-or the two paths michael@0: kReverseDifference_PathOp, //!< subtract the first path from the op path michael@0: }; michael@0: michael@0: /** Set this path to the result of applying the Op to this path and the michael@0: specified path: this = (this op operand). michael@0: The resulting path will be constructed from non-overlapping contours. michael@0: The curve order is reduced where possible so that cubics may be turned michael@0: into quadratics, and quadratics maybe turned into lines. michael@0: michael@0: Returns true if operation was able to produce a result; michael@0: otherwise, result is unmodified. michael@0: michael@0: @param one The first operand (for difference, the minuend) michael@0: @param two The second operand (for difference, the subtrahend) michael@0: @param result The product of the operands. The result may be one of the michael@0: inputs. michael@0: @return True if operation succeeded. michael@0: */ michael@0: bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); michael@0: michael@0: /** Set this path to a set of non-overlapping contours that describe the michael@0: same area as the original path. michael@0: The curve order is reduced where possible so that cubics may michael@0: be turned into quadratics, and quadratics maybe turned into lines. michael@0: michael@0: Returns true if operation was able to produce a result; michael@0: otherwise, result is unmodified. michael@0: michael@0: @param path The path to simplify. michael@0: @param result The simplified path. The result may be the input. michael@0: @return True if simplification succeeded. michael@0: */ michael@0: bool SK_API Simplify(const SkPath& path, SkPath* result); michael@0: michael@0: #endif