PDA

View Full Version : Invert a path and splite the result into multiple polygons



DEADBEEF
3rd November 2015, 14:29
Hi all!

I’m working with QT in order to create a selection path. But now I would like to invert it, like the photoshop tool you know.

I used the subtracted method to manage to get the invert selection BUT I got only one path. I would like to splite this path into small path/polygons since I use a personal class to print the selections.

I know the methods ToFillPolygons & ToSubpathPolygons exist but they don’t give me what I need.

Here is few drawing to understand what I need:

First, the selections the user do in black:
11492


Then, in red, the result of the subtracted method:
11493


And here is what I’m looking for: How can I get only the 2 red polygons like this
11494


In a perfect world I would like to get 5 polygons because I cannot deal with hole inside my polygons for the moment, I mean I cannot remove the line which connect outer and inner polygons and I have something like this:
11495


Now you can understand why I cannot use ToFillPolygons & ToSubpathPolygons method which give me the following result:
11496


Thanks for your help