ipycanvas
ipycanvas copied to clipboard
Use devicePixelRatio for improved rendering on Retina and other higher-density displays
On displays with a higher pixel density (e.g. MacBook Pro Retina displays), HTML canvas looks slightly fuzzy and pixellated by default.
Can be fixed by using the window's devicePixelRatio
, and scale the context and canvas sizes accordingly - see example.
I've found exactly the same issue. Any progress?
You can create a canvas with more pixels than actually displayed on the screen:
canvas = Canvas(width=600, height=600, layout=dict(width='300px', height='300px'))
Accessing the devicePixelRatio
is not possible, and it's unlikely that I'll implement this, as it does not quite make sense (what do you do when there are two clients connected? Which pixel ratio should be used?)
Hi — sorry for the late reply, and thank you for your comment.
Yes, the above works perfectly! Again, thank you!