-
-
Notifications
You must be signed in to change notification settings - Fork 38
Use platform specific bitmaps for rendering plots, where applicable #51
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
Conversation
The 2D and 3D plot commands from the "no-gui" library have been updated to use `make-bitmap`, while the corresponding commands from the GUI library have been now use `make-platform-bitmap`. `make-platform-bitmap` will create a bitmap optimized for being displayed on the screen, with the correct backing scale for the monitor -- the `draw-bitmap/supersampling` always used a backing scale of 2 which resulted in blurred text for non-HiDPI screens, also Windows uses a backing scale of 1.5 by default on HiDPI displays. The non-gui plot commands were already using `make-bitmap` via a call to `draw-bitmap` but `draw-bitmap` and `draw-bitmap/supersampling` have been removed from "draw.rkt", as they were no longer used, and they were not providing much abstraction anyway -- also `make-platform-bitmap` is only available in the GUI library.
Hi @bennn , can you please review this pull request or ask someone else in the Racket team to review it? Thanks, Alex. |
Thanks for the reminder. I will look at both pull requests this week. |
Does this work for plots that use an alpha channel on Windows? I'm asking because I read this sentence in the docs (link):
|
My code uses Now, there are a few things that need clarifying:
I could however change the bitmap to use a (define bm (make-bitmap width height #t #:backing-scale (or (get-display-backing-scale) 1.0))) I am not sure which one is better, the documentation is not very clear on that the differences are between |
Edit: nevermind, I mis-read the docs ... they suggest copying to work-around the GDI limit on Windows. If that doesn't work well, then I think it's best to use |
Wouldn't drawing to Using Using (Meanwhile, it appears that text-rendering changes on Mojave have eliminated the difference between |
@bennn I will update the code to just use Ideally, I would like the plot snips to draw directly to the canvas, as I believe the intermediate step of drawing to a bitmap than copying it to the canvas is somewhat inefficient (of course, I would have to copy the bitmap out of the canvas to avoid performance degradation on redraw). But this is a project for another day. |
…nips Since `make-screen-bitmap` and `make-platform-bitmap` don't use an alpha channel and have other limitations, the code that creates the bitmaps for the snip objects now use `make-bitmap` but it constructs it with a display specific backing scale, rather than using the default 2.0 (on W32 platforms, the backing scale is 1.5, for example).
HI @bennn , I changed the code to use |
The 2D and 3D plot commands from the "no-gui" library have been updated to use
make-bitmap
, while the corresponding commands from the GUI library have beennow use
make-platform-bitmap
.make-platform-bitmap
will create a bitmap optimized for being displayed onthe screen, with the correct backing scale for the monitor -- the
draw-bitmap/supersampling
always used a backing scale of 2 which resulted inblurred text for non-HiDPI screens, also Windows uses a backing scale of 1.5
by default on HiDPI displays.
The non-gui plot commands were already using
make-bitmap
via a call todraw-bitmap
butdraw-bitmap
anddraw-bitmap/supersampling
have beenremoved from "draw.rkt", as they were no longer used, and they were not
providing much abstraction anyway -- also
make-platform-bitmap
is onlyavailable in the GUI library.