Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fix the misplacement of rasterized object inDrawingArea
in the vectorized backends#30171
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
…orrection for rasterized content
DrawingArea
in the vectorized backendsHi all, just a gentle follow-up on this PR. I'd appreciate any feedback when time permits. Let me know if there's anything I can improve or clarify. Thanks! |
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.
Sorry, review capacity is currently quite limited.
Do you have an idea how to test this?
Thanks for the feedback! I think we can test this using image comparison—by generating a target image and validating output against it. On a related note, I'm not entirely confident that my current method for checking whether the renderer is a vectorized backend is the most robust or appropriate approach. I'd really appreciate any input or suggestions on improving that part of the implementation. |
while type(actual_renderer).__name__ == 'MixedModeRenderer': | ||
actual_renderer = getattr(actual_renderer, '_renderer', actual_renderer) | ||
renderer_name = type(actual_renderer).__name__ |
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.
This approach feels quite hacky. The functionality should live in a methodMxedModeRenderer.is_vector_renderer()
. Possibly that function should be made a core featureRenderer
so that the whole_is_vector_renderer
can go away. Though I'm not sure whether there are implications for third party renders.@anntzer what do you as a backend implementer think?
I suspect whether the backend has vector output is not actually the right test here; indeed, mplcairo doesn't exhibit the#28549 bug even for vector output. Rather, the bug likely resides either in backend_{pdf,ps,svg}, or, more likely (just my guess), in MixedModeRenderer. |
Uh oh!
There was an error while loading.Please reload this page.
PR summary
This PR is trying to fix a bug when rendering rasterized Artists in
DrawingArea
, they will be misplaced in the vectorized backend.closes#28549The fix is done by enforcing correct DPI transformation during rasterization, specifically in the vectorized backends
There is no API change or documentation change associated with this PR.
PR checklist