1

In my android custom view, I have two path objects(for simplicity let's suppose they both represent a rectangle). Now there can be a situation when these pats intersect, and I want in those cases draw the global borders and remove the borders of intersecting parts: So suppose I have this: actual

But I need it to be drown like this: expected

I tried to join paths with the following code:

val p1: Path......
val p2: Path......
p1.addPath(p2)

Although this adds paths together, but the intersecting parts remain and I don't know how to get read of them.

Andranik
  • 2,729
  • 1
  • 29
  • 45

1 Answers1

0

Apply UNION operation between paths.

p3.op(p1, p2, Path.Op.UNION)

p1=red, p2=blue, p3=black

p1 and p2 p3

beigirad
  • 4,986
  • 2
  • 29
  • 52