Skia
2D Graphics Library
SkPathOps.h File Reference
#include "include/core/SkPath.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTDArray.h"
Include dependency graph for SkPathOps.h:

Go to the source code of this file.

Classes

class  SkOpBuilder
 Perform a series of path operations, optimized for unioning many paths together. More...
 

Enumerations

enum  SkPathOp {
  kDifference_SkPathOp , kIntersect_SkPathOp , kUnion_SkPathOp , kXOR_SkPathOp ,
  kReverseDifference_SkPathOp
}
 The logical operations that can be performed when combining two paths. More...
 

Functions

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 operand). More...
 
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. More...
 
bool SK_API TightBounds (const SkPath &path, SkRect *result)
 Set the resulting rectangle to the tight bounds of the path. More...
 
bool SK_API AsWinding (const SkPath &path, SkPath *result)
 Set the result with fill type winding to area equivalent to path. More...
 

Enumeration Type Documentation

◆ SkPathOp

enum SkPathOp

The logical operations that can be performed when combining two paths.

Enumerator
kDifference_SkPathOp 

subtract the op path from the first path

kIntersect_SkPathOp 

intersect the two paths

kUnion_SkPathOp 

union (inclusive-or) the two paths

kXOR_SkPathOp 

exclusive-or the two paths

kReverseDifference_SkPathOp 

subtract the first path from the op path

Function Documentation

◆ AsWinding()

bool SK_API AsWinding ( const SkPath path,
SkPath result 
)

Set the result with fill type winding to area equivalent to path.

Returns true if successful. Does not detect if path contains contours which contain self-crossings or cross other contours; in these cases, may return true even though result does not fill same area as path.

Returns true if operation was able to produce a result; otherwise, result is unmodified. The result may be the input.

Parameters
pathThe path typically with fill type set to even odd.
resultThe equivalent path with fill type set to winding.
Returns
True if winding path was set.

◆ 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 operand).

The resulting path will be constructed from non-overlapping contours. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.

Returns true if operation was able to produce a result; otherwise, result is unmodified.

Parameters
oneThe first operand (for difference, the minuend)
twoThe second operand (for difference, the subtrahend)
opThe operator to apply.
resultThe product of the operands. The result may be one of the inputs.
Returns
True if the operation succeeded.

◆ 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.

The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.

Returns true if operation was able to produce a result; otherwise, result is unmodified.

Parameters
pathThe path to simplify.
resultThe simplified path. The result may be the input.
Returns
True if simplification succeeded.

◆ TightBounds()

bool SK_API TightBounds ( const SkPath path,
SkRect result 
)

Set the resulting rectangle to the tight bounds of the path.

Parameters
pathThe path measured.
resultThe tight bounds of the path.
Returns
True if the bounds could be computed.