Retina

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tessman
Experienced Solver
Experienced Solver
Posts: 99
Joined: Tue Oct 06, 2009 5:25 pm

Retina

Post by tessman » Fri Jun 22, 2012 1:11 am

So is it too early to ask if anyone's begun to develop any theories/strategies for handling images on a Retina display?

wxMac 2.8/2.9

tessman
Experienced Solver
Experienced Solver
Posts: 99
Joined: Tue Oct 06, 2009 5:25 pm

Re: Retina

Post by tessman » Tue Jun 26, 2012 7:23 pm

All right. I'll start.

I've been looking into this a bit, and there are a couple of things that (currently) seem to be standing in the way.

First off is that I'm still using wxMac 2.8, due to the fact that 2.9 is buggy in ways that I haven't yet been able to work around.

The problem with 2.8 of course is that it uses, for instance, things like CGImage extensively (and you don't get automatic Retina handling of multiple-resolution/density images with CGImage the way that you do with NSImage).

Actually, for that matter, the 2.9 code seems — although I haven't looked at it as extensively — to suffer from some of the same problems in an architectural kind of way. For instance, a button in 2.9 is constructed something along the lines of:

Code: Select all

    wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
    if (bitmap.IsOk())
        [v setImage:bitmap.GetNSImage() ];
where bitmap is a standard (i.e., single-resolution/density) wxBitmap.

Essentially, to get free implementation of @2x images, you'd need to replace all uses of that sort with NSImage (created using one of the methods that automatically handles @2x images). But then that's going to mean rewriting a ton of code.

The alternative would be to subclass just those things that you needed (for instance, a bitmap button) and #ifdef some OS X drawing code that handles Retina scaling (although that can get tricky too, based on my experience with how well the Mac port does or doesn't handle scaling depending on what you're trying to do).

User avatar
doublemax
Moderator
Moderator
Posts: 14079
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Retina

Post by doublemax » Tue Jun 26, 2012 8:53 pm

I think you should discuss this on the wx-dev mailing list. But as not even the code from last years GSoC has been merged into the current trunk, i personally gave up hope that wxWidgets will be usable for iOS development in the near future (meaning the next 18 months).
Use the source, Luke!

tessman
Experienced Solver
Experienced Solver
Posts: 99
Joined: Tue Oct 06, 2009 5:25 pm

Re: Retina

Post by tessman » Fri Jun 29, 2012 4:43 am

I'll do that, thanks. (Although it's actually the Retina MacBook I'm interested in, not iOS — currently wxWidgets applications look pretty unspectacular on one of those.)

dcheng
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Sep 26, 2012 9:05 pm

Re: Retina

Post by dcheng » Thu Sep 27, 2012 3:11 pm

Any updates on this? I'm hoping to use wxWidgets/wxPython in an upcoming project and I need retina/hidpi support on the mac. I created a simple "Hello World" app, using a wx.StaticText on wxPython2.9.4.0-cocoa-py2.7 and noticed that the text was pixellated. Also, the close/hide/maximize buttons on the window were pixellated. I thought wxWidgets was using native controls underneath? I'd love to use wxPython or wxWidgets but the lack of retina support is a deal breaker.

Kind of curious: I noticed that Google Drive and Dropbox Mac clients both use wxPython, but both of their preferences dialogs properly support retina/hidpi. I wonder how they pulled that off if wxWidgets/wxPython doesn't support retina.

Post Reply