Closed dodomorandi closed 10 months ago
I moved WindingOrder
and PolygonMode
to a path
module, and I also renamed PolygonMode
to PaintMode
. Because of this change I also took the opportunity of add some docs and some minor changes.
Just keep in mind that at this point we still miss the possibility of choosing between open and closed paint operations in polygons, but it probably makes sense to have a flag specifically in the Polygon
struct (because it does not make sense for rectangles and circles) and therefore it should be handled in another PR.
Let me know if it's ok for you or you would rather to change things a bit or to split this PR in two (because of the refactor).
This should improve the support to writing PDFs towards two directions:
The changes should be pretty straightforward, and I also added a few changes/fixes to the doc. Still, there are a couple of points I would like to discuss:
Mode
andWinding
specifically for therectangle
module. However, we could consider to unify those with the one available inside theline
module. TheWinding
enum cannot actually be any different, I am a bit unsure about theMode
because I don't have a clear view about other possibilities (i.e: is there a paint mode that we would like to add in the future that makes sense for aRect
but not for aPolygon
or vice versa?)into_stream_op
, I noticed thatPolygon
adds a paint end even after a stroke/fill. AFAIK (reading from the PDF specs) this should be only necessary if a path-painting operator has not been used -- and strokes/fills are actually path-painting operators. I am pointing this out just because if I am right, I don't think it should be an actual problem (probably any pdf reader does not have any trouble ignoring then
operator), but if I am wrong I should change the implementation forRect
, because I only add the path end operator only in clipping mode.Let me know what do you think, and feel free to give any suggestion I could improve the code or the doc.
Last but not least: this is a breaking change because of the new
Rect::mode
field (and cargo-semver-checks confirms that).CC @paolobarbolini