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

Connected discontiguous polygon corners #5980

Merged
merged 1 commit into from Mar 27, 2022
Merged

Conversation

radarhere
Copy link
Member

Resolves #4347

The issue reports that for a particular polygon, the corners are not visually joined to the main shape.

image

Pillow draws this polygon is by plotting on each row where each of the edges intersect, and then going through row by row and drawing horizontal lines. If I adjust Pillow to just draw the intersections of the edges on each row, it is clearer what has happened - no point in any of the lines is wrong, the angles are just such that the corner doesn't connect to the rest of the shape visually.

points

When hitting such corners, this PR finds the two edges making up the corner, calculates where those edges intersected with the adjacent row, and then stretches out the corner to connect to it.

The test includes the polygon from the issue, and two variations I put together.
Screen Shot 2022-01-21 at 11 49 24 am

Here is the test image without this fix.

Screen Shot 2022-01-21 at 11 49 45 am

@radarhere
Copy link
Member Author

I've created google/oss-fuzz#7175 in an attempt to fix the CIFuzz error.

@radarhere
Copy link
Member Author

Ok, the CIFuzz error was instead fixed by google/oss-fuzz#7199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageDraw.Draw.polygon output is sometimes discontiguous
3 participants