combineRawPaths function

PathOpsResult? combineRawPaths(
  1. PathBooleanOp op,
  2. PathOpsPathBuffers a,
  3. PathFillType fillRuleA,
  4. PathOpsPathBuffers b,
  5. PathFillType fillRuleB,
)

Combines two paths with a boolean operation. Returns null when the operation fails to resolve (degenerate/unsortable geometry).

Implementation

PathOpsResult? combineRawPaths(
  PathBooleanOp op,
  PathOpsPathBuffers a,
  PathFillType fillRuleA,
  PathOpsPathBuffers b,
  PathFillType fillRuleB,
) {
  if (!a.isConsistent || !b.isConsistent) {
    // The C++ side reads points by verb with no length information; never
    // hand it a short buffer.
    return null;
  }
  final bufA = _NativeBuffers(a);
  final bufB = _NativeBuffers(b);
  try {
    return _toResult(_combinePaths(
      op.index,
      bufA.points,
      bufA.verbs,
      bufA.verbCount,
      fillRuleA.index,
      bufB.points,
      bufB.verbs,
      bufB.verbCount,
      fillRuleB.index,
    ));
  } finally {
    bufA.free();
    bufB.free();
  }
}