rive_pathops library
Edit-time boolean path operations (union, subtract, intersect, exclude) backed by packages/pathops. Editor-only: the native symbols are excluded from flutter_runtime builds, so this library must never be imported from runtime code paths.
Classes
- PathOpsPathBuffers
- Accumulates path commands into the flat verb/point buffers that cross the native boundary. Verb byte values match rive::PathVerb (move=0, line=1, quad=2, cubic=4, close=5); points are consumed per-verb on the native side (move/line=1 point, quad=2, cubic=3, close=0).
- PathOpsRawPath
- A RawPath backed by Dart-side typed data, platform-neutral (used by both the FFI and wasm pathops bindings). Verb byte values match rive::PathVerb.
- PathOpsResult
- Result of a boolean path operation: flattened, overlap-free geometry and the fill rule Skia reports for it. The path renders identically under any fill rule since all overlaps have been resolved.
Enums
- PathBooleanOp
- Boolean path operations. Values match rive::PathOp in packages/pathops/include/rive/pathops/pathops.hpp.
Properties
- pathOpsAvailable → bool
-
Whether the loaded native library carries the pathops symbols. False in
flutter_runtime builds, where pathops is excluded (editor-only); callers
(and tests) must check before using combineRawPaths/simplifyRawPath --
the lazily-initialized lookups below throw on first use otherwise.
final
Functions
-
combineRawPaths(
PathBooleanOp op, PathOpsPathBuffers a, PathFillType fillRuleA, PathOpsPathBuffers b, PathFillType fillRuleB) → PathOpsResult? - Combines two paths with a boolean operation. Returns null when the operation fails to resolve (degenerate/unsortable geometry).
-
pointsRequiredForVerbs(
Uint8List verbs) → int -
Floats consumed by
verbs(move/line = 1 point, quad = 2, cubic = 3, close = 0; two floats per point). Unknown verb bytes report -1 so a caller comparing against an actual points length fails closed. -
simplifyRawPath(
PathOpsPathBuffers path, PathFillType fillRule) → PathOpsResult? - Flattens a single path under its fill rule into overlap-free geometry. Returns null when simplification fails.