Using images with Retina display?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using images with Retina display?

Ryan Holmes
I develop a cross-platform program, and this is something that has bugged the users for a while. I should note that I basically inherited the program and did not develop the majority of the GUI. First, an image:

https://cloud.githubusercontent.com/assets/3753521/10973174/10639de8-8391-11e5-9ba6-fb1bd4c66fd6.png

The window shown at the top was a build with wxPython 3.0, which apparently has much better Retina support for text, while the overlayed window is a build with wxPython 2.8. You can see that the text is crisp in the new version (as long as we are dealing with strictly text), but you can see that images are still blurred.

Also, please be aware that I don't actually have a Retina display and don't know how to emulate one. I'm kind of trying to patch this in the dark and hope thigns work, so that why I'm here trying to get a bit of direction

1) Is there a way to fix the blurred images? This program uses a lot of 16x16 and 24x24 png files that are sourced from 32x32 or 64x64 png files - these are loaded as images, converted to bitmaps, and then displayed. We have no control over the source of these images. Would it be sufficient to just ship with the high-quality versions and use wx.Image.Scale()? Would that fix the DPI issue?

2) The text that is still blurry (in the left-hand list, the tabs, in the gauges to the right, etc) is because this is text that is drawn onto custom widgets, which are basically bitmaps that are constructed using a MemoryDC. The initial bitmap is defined with a certain resolution, and I am not sure how to define the DPI / how to fix this (perhaps defining a large resolution and scaling down?)

Any help would be appreciated


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using images with Retina display?

Florian Höch
Hi,

Am 06.11.2015 um 04:58 schrieb Ryan Holmes:
> Also, please be aware that I don't actually have a Retina display and don't know how to emulate one.

Emulation is possible but cumbersome to set up. See

http://www.tonymacx86.com/mavericks-laptop-support/133254-adding-using-hidpi-custom-resolutions.html

> 1) Is there a way to fix the blurred images? This program uses a lot of
> 16x16 and 24x24 png files that are sourced from 32x32 or 64x64 png files
> - these are loaded as images, converted to bitmaps, and then displayed.
> We have no control over the source of these images. Would it be
> sufficient to just ship with the high-quality versions and use
> wx.Image.Scale()? Would that fix the DPI issue?

Scale() will not fix the blurriness because it scales in the virtual
coordinate system (which is half the actual display resolution). I
believe wxWidgets has since had some updates that will make it use @2x
versions of the images if present, but it seems these updates are not
yet available to wxPython. I'm not sure if it's currently possible to
have crisp images on HiDPI displays using wxPython, I've not found a
solution so far.

> 2) The text that is still blurry (in the left-hand list, the tabs, in
> the gauges to the right, etc) is because this is text that is drawn onto
> custom widgets, which are basically bitmaps that are constructed using a
> MemoryDC. The initial bitmap is defined with a certain resolution, and I
> am not sure how to define the DPI / how to fix this (perhaps defining a
> large resolution and scaling down?)

I had similar problems with blurry text on custom widgets in my
application and solved it in most instances simply by using a wx.PaintDC
instead of a wx.BufferedPaintDC. Some of my widgets still need
wx.MemoryDC or other forms of buffering, so the text is still blurry there.

--
Florian Höch

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.