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

Support even-odd winding rule for fills #281

Closed
systemed opened this issue Sep 24, 2011 · 1 comment
Closed

Support even-odd winding rule for fills #281

systemed opened this issue Sep 24, 2011 · 1 comment

Comments

@systemed
Copy link

At present Prawn fills using the 'f' and 'b' operators. For nested shapes, this will use the default PDF "non-zero winding rule" to determine what's inside the fill and what isn't.

For some purposes, the alternative "even-odd" rule is useful. In particular, where you have one shape inside another (a hole), the even-odd rule will ensure the hole isn't filled without having to worry about the clockwiseness of each shape.

It would be good if Prawn provided an option to use the even-odd rule.

The only difference in PDF output is that you use the 'f_' and 'b_' operators rather than 'f' and 'b'. (Section 4.4.2 of the PDF spec if it helps!) I can of course use pdf.add_content("f*") for the interim, but an option would be neater. :)

@bradediger
Copy link
Member

Good idea. I've added this via an option to the fill / fill_and_stroke operators: just pass in :fill_rule => :even_odd.

I also added a page to the manual with a visual example of the difference between the two rules.

Thanks!

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

No branches or pull requests

2 participants