meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
132 stars 29 forks source link

Add functionality to bbox for... #131

Closed Sophist-UK closed 2 years ago

Sophist-UK commented 2 years ago

Optionally including the stroke-width in the bbox. Default remains to use the centreline of the stroke.

Sophist-UK commented 2 years ago

Ready for review.

Sophist-UK commented 2 years ago

In certain edge cases [sic.] e.g. flat end-caps, this can result in a stroke bounding box being slightly too big.

However this fix is intended to be used during rendering, because rendering to an image sized using centre line can (and does) result in rendering being incorrectly clipped. Using a bounding box slightly too large for rendering purposes will not have this problem.

tatarize commented 2 years ago

Hm. I thought this might be gaudy but it's apparently pretty straight forward and kind of elegant. You could code in some test cases and save me the trouble if not sometime late tomorrow.

Sophist-UK commented 2 years ago

Happy to code in some test cases - but I am away for 3 days so it will have to wait until I am back.

tatarize commented 2 years ago

I'll likely get to them before that point.