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

Allow explicit zero width to hide outline #4334

Merged
merged 1 commit into from Feb 15, 2020

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jan 5, 2020

Helps #4277

ImageDraw operations chord, ellipse, pieslice and rectangle take optional arguments outline with a default of None and width with a default of 0.

At present, specifying an outline and a width of zero stills draws the outline. The following three lines all produce the same result -

draw.rectangle(BBOX2, fill="green", outline="yellow")
draw.rectangle(BBOX2, fill="green", outline="yellow", width=0)
draw.rectangle(BBOX2, fill="green", outline="yellow", width=1)

This PR changes the behaviour so that a zero width produces no outline. For backwards compatibility, it changes the width default to 1, so that these two lines still produce the same result -

draw.rectangle(BBOX2, fill="green", outline="yellow")
draw.rectangle(BBOX2, fill="green", outline="yellow", width=1)

but

draw.rectangle(BBOX2, fill="green", outline="yellow", width=0)

does not.

@hugovk
Copy link
Member

hugovk commented Feb 15, 2020

Perhaps we should mention the default change in the release notes and docstring?

Or maybe it's not needed because the functionality has been fixed?

@radarhere
Copy link
Member Author

...I'm inclined to suggest no?

Documenting that we have changed the default argument would make you presume that we changed the default behaviour, which we haven't. draw.rectangle(BBOX2, fill="green", outline="yellow") still has the same output before and after this PR. So that might actually introduce confusion.

@hugovk hugovk merged commit 0e993c4 into python-pillow:master Feb 15, 2020
@radarhere radarhere deleted the outline_width branch February 15, 2020 12:31
@radarhere radarhere mentioned this pull request Feb 16, 2020
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.

None yet

2 participants