Skip to content
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

Animation by blitting place artists imprecisely at the sub-pixel level #8837

Open
anntzer opened this issue Jul 3, 2017 · 2 comments
Open
Labels
keep Items to be ignored by the “Stale” Github Action

Comments

@anntzer
Copy link
Contributor

anntzer commented Jul 3, 2017

mpl 2.0.2 and master (but most likely since ever).

Blitting-based animations place artists imprecisely at the subpixel level, as shown by the following screenshot from examples/animations/dynamic_image.py.

screenshot_20170703_154024

Note that the bottom-most and right-most row of the image does not line up with the axes; instead some earlier image "leaks" through; likewise the top and left axes are occluded.

(This is from the qt5agg backend; interestingly gtk3agg and tkagg have slightly different (but similar) artefacts.)

Removing the "blitting" flag gets rid of this issue (the image becomes correctly aligned with the axes.

I think the reason is that the way drawing (including blitting) is implemented is that Agg/Cairo renders to a temporary buffer (necessarily integer-sized), which gets transfered to the screen in a later stage (by the GUI-specific code); the screen may already have some drawings on it (especially in the case of blitting animations) and we are unable to render the image with a non-integer origin. Instead, a better way may be to grab whatever is on screen as the starting value of the buffer, and let Agg/Cairo render in top of that.

See e.g. http://doc.qt.io/qt-4.8/qpixmap.html#grabWidget or perhaps rather http://doc.qt.io/qt-4.8/qpixmap.html#grabWindow, etc.

On a similar issue, note that copy_from_bbox currently truncates the coordinates of the bbox (_backend_agg.cpp):

    agg::rect_i rect(
        (int)in_rect.x1, height - (int)in_rect.y2, (int)in_rect.x2, height - (int)in_rect.y1);

It may be better instead to expand the bbox to the nearest integer coordinates. This may accidentally overlap (at subpixel level) with some neighboring, really close object, but at least this won't truncate the bbox we were trying to grab. Likewise, the semantics of restore_region for non-integer coordinates could be clarified.

@tacaswell tacaswell added this to the 2.2 (next next feature release) milestone Jul 5, 2017
@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 14, 2023
@anntzer anntzer added the keep Items to be ignored by the “Stale” Github Action label Apr 14, 2023
@anntzer
Copy link
Contributor Author

anntzer commented Apr 14, 2023

Still present.

@rcomer rcomer removed the status: inactive Marked by the “Stale” Github Action label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep Items to be ignored by the “Stale” Github Action
Projects
None yet
Development

No branches or pull requests

3 participants