Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
Mr-Milk wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromMr-Milk:fix-drawingarea

Conversation

Mr-Milk
Copy link
Contributor

@Mr-MilkMr-Milk commentedJun 13, 2025
edited
Loading

PR summary

This PR is trying to fix a bug when rendering rasterized Artists inDrawingArea, they will be misplaced in the vectorized backend.closes#28549

The 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

@Mr-MilkMr-Milk changed the titleEnhance the renderer support of the DrawingArea class by adding DPI correction for rasterized contentFix the misplacement of rasterized object inDrawingArea in the vectorized backendsJun 13, 2025
@Mr-MilkMr-Milk marked this pull request as ready for reviewJune 13, 2025 12:40
@Mr-Milk
Copy link
ContributorAuthor

Hi 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!

Copy link
Member

@timhoffmtimhoffm left a 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?

@Mr-Milk
Copy link
ContributorAuthor

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.

Comment on lines +50 to +52
whiletype(actual_renderer).__name__=='MixedModeRenderer':
actual_renderer=getattr(actual_renderer,'_renderer',actual_renderer)
renderer_name=type(actual_renderer).__name__
Copy link
Member

@timhoffmtimhoffmJun 18, 2025
edited
Loading

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?

@anntzer
Copy link
Contributor

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.
Therefore, I think I'd prefer if we could figure out what's wrong in MixedModeRenderer (if anything) and directly fix it there, or, if not, at least just directly test whether the renderer is a MixedModeRenderer (_is_mixedmode_renderer) and run the extra code in that case.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: Rasterized Artists inDrawingArea will be misplaced in the vectorized backend
3 participants
@Mr-Milk@anntzer@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp