-
Notifications
You must be signed in to change notification settings - Fork 31
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
Additional export functionality #306
Conversation
f2155e3
to
5c7d8b3
Compare
|
||
def draw_polyline(self, shape): | ||
self.draw_polygon(shape, False) | ||
|
||
def draw_ellipse(self, shape): | ||
stroke_width = shape['strokeWidth'] | ||
c = self.panel_to_page_coords(shape['x'], shape['y']) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that means that we wont' be able to handle shapes covering partially the image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's always been the case with PDF export. Shapes that extend outside of the cropped image panel are drawn on the page without being confined to the panel that they come from. Haven't found a way to be able to work around that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @will-moore
Seems that the issue @jburel noticed above is due to this PR. Tried exporting same figure with script from origin/master (left) and then from this branch (right). NB: also noticed a truncation of the purple Polylline. |
The truncation is due to the large stroke width and the temporary canvas used to draw on not having enough buffer around the shape. Should be easy to resolve once I get back.
… On Aug 6, 2018, at 11:30 AM, Will Moore ***@***.***> wrote:
Seems that the issue @jburel noticed above is due to this PR. Tried exporting same figure with script from origin/master (left) and then from this branch (right). NB: also noticed a truncation of the purple Polylline.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
8ce57b3
to
1001d3a
Compare
Rebased on top of 4.0.1 and fixed the offset/cropping issue when drawing polygons |
@knabar is it ready for review? |
@jburel Yes, apologies for not explicitly stating so |
This has fixed the issue we were seeing above. The only problem I'm seeing now is that the rectangle corners are rounded in TIFF export because of the way that we're drawing polygons. For rotated rectangles (which we don't yet support in the web UI) it may be harder find a workaround so I guess it's OK to use the polygon method, but if there's no rotation then I think it would be nice to preserve the current behaviour. I also tested with a rotated image (not rotated rectangles) and it's working fine: |
@will-moore Thanks. I'll check out the rectangle issue to see if there's an easy fix for both unrotated and rotated. |
Apparently yesterday a PR was merged into Pillow to draw nicer polyline joints, but they chose rounded joints also: python-pillow/Pillow#3250 |
@will-moore @jburel I changed rectangle drawing for Pillow back to a custom method to get squared corners. Ready for another review. |
This is working nicely for me now.
Otherwise, good to merge. |
@will-moore Fixed the blank line |
This is also working on web-dev-merge now too. Good to merge. |
This PR includes additional functionality for the PDF/TIFF export:
None of these changes should impact the current export behavior for a given figure, though I need to do some more thorough testing.
Especially shape label rendering will need some more work, but opening the PR now for early review.