1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +00:00

LibGfx: Handle filling complex shapes better

This allows the painter to render filled complex shapes better, by
constructing a path graph for (interesting) intersecting lines and
omitting lines from the containing segments if they are detected
to take no part in defining the edges of a shape.

This approach would still fail if there are multiple logical shapes
that are confined to the collection of lines.
For instance, two polygons intersecting each other in a way that one
vertex of polygon A ends up inside polygon B.
we would detect that polygon A's edges are part of the shape
(technically correct) even though they are not a part of polygon B at
all.
This commit is contained in:
AnotherTest 2020-05-08 10:03:01 +04:30 committed by Andreas Kling
parent 14ee090f25
commit 677568e3d4
3 changed files with 201 additions and 13 deletions

View file

@ -1154,7 +1154,7 @@ void Painter::stroke_path(const Path& path, Color color, int thickness)
void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
{
const auto& segments = path.split_lines();
const auto& segments = path.split_lines(Path::Simple);
if (segments.size() == 0)
return;