Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only try to connect discontiguous corners at the end of edges #6303

Merged
merged 2 commits into from May 28, 2022

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented May 16, 2022

Resolves #6290

During drawing, #5980 moves a point to join discontiguous corners to the rest of the shape. However, this has been applied too thoroughly, and in #6290, the attempt to join pixels together has ended up dragging pixels from the left hand side of the polygon all the way to the right, creating a gap instead.

Adding a condition to only try and join discontiguous corners at the end of edges fixes the problem.

@hugovk hugovk added the automerge Automatically merge PRs that are ready label May 28, 2022
@radarhere radarhere merged commit 71d6a7b into python-pillow:main May 28, 2022
@radarhere radarhere deleted the disconnected branch May 28, 2022 06:40
@nkinnaird
Copy link

Hi there, I ran across the scanline issue fixed in this PR myself. Reverting back to 9.0.0 worked fine for me as a fix since I didn't have an issue with the corner points which was the original motivation for these changes. I did notice however that I was also seeing spurious white "fill" points outside the polygon outline. (The spurious points would also appear in some images that don't contain the scanlines.) I'm not sure if that was also fixed in this PR, but thought I'd mention it just in case. The data points for the following polygon image are below just in case it's worth checking out. Thanks!

points = [(1497, 1510), (1500, 1506), (1505, 1509), (1509, 1512), (1513, 1518), (1516, 1522), (1516, 1527), (1515, 1531), (1512, 1534), (1510, 1536), (1507, 1539), (1504, 1542), (1502, 1542), (1498, 1542), (1496, 1540), (1494, 1537), (1490, 1534), (1488, 1529), (1489, 1523), (1492, 1518), (1494, 1514)]

Screen Shot 2022-06-07 at 11 47 36 AM

@radarhere
Copy link
Member Author

Using your points and a different fill and outline, here is Pillow 9.0.0

Pillow 9.1.1

and main

So yes, the points outside the outline should also be fixed by this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge PRs that are ready Regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression from 9.0.1 to 9.1.0 in polygon rasterization
3 participants