Any way to "flatten" multiple subpaths into a single path?

If you create a series of subpaths with Path::addRectangle() for example, such that they all overlap, and then fill the path with a colour, it looks like one oddly shaped area. Which is what I want.

However, if you then try to stroke the path to give it an outline, you get the outlines of every single subpath - not just the outer edge of the whole irregular shape. Is there anyway to accomplish that?

Duh - just needed to reverse the order of the drawing operations. Stroke it first, with the outline color, then fill it with the main color and all the inner outlines get covered up.

But it still would be nice if there was some way to remove all of the inner points from a complex path, such that only the outer points of the perimeter remain.

There is a small library called Clipper. It’s just a .h and .cpp.
http://www.angusj.com/delphi/clipper.php

Used it once a while ago. I think it has functionality called “union”.
You provide an array of points and it magically creates a convex hull and stuff.

2 Likes

Yes, Clipper is very useful, and surprisingly fast. I’ve used the C# version quite effectively before.

Thanks!