How will resolution independence be handled in jdk8?

Stephan Aßmus superstippi at
Tue Apr 23 08:33:13 PDT 2013


On 23.04.2013 17:05, Hendrik Schreiber wrote:
> I'm aware that there is an ongoing effort to support resolution independence in JDK 8.
> E.g. - I am assuming this will draw text and built-in UI elements with the native resolution.
> What I wonder, how will we as developers be able to draw images with sub-pixel resolution?
> Will we simply be able to call
> 	graphics.drawImage(img, x, y, w, h, obs);
> and if the image is twice the size of w/h (=4xarea) and a Retina display is present, the image is drawn with sub-pixel resolution? I.e. in effect not scaled, but simply drawn?
> If so, will there be a way to find out the scale factor, i.e. the factor between pixel based resolution and true display sub-pixel capability? To illustrate, for Retina this factor is 2x. After all, we need to know, what kind of images to load for a high resolution capable app.

There are situations in which it isn't so simple, unfortunately. Think 
of a window which is partly on a non-Retina-screen and partly on a 
Retina-screen. From when I have learned thus far about the Cocoa APIs, 
they will handle this situation.

> Last but not least, the bug mentioned above mentions the info.plist flag
> <key>NSHighResolutionCapable</key><true/>
> Will it be necessary to set this? What exactly does it do?

Can't remember all the details, but you can search the Mac Dev Center, 
there are some good articles on it there.

I know for a fact that you don't /need/ to set this flag to prevent your 
app to be "up-scaled". That is if you use SWT at least. Anything that 
draws into an Image to avoid flickering or somesuch will be scaled, but 
anything "directly" drawn to the screen will not be "up-scaled". Of 
cource nothing flickers in OS X, but in some instances, I had such code 
in place to avoid flickering in my Windows version.

I think this flag might be needed in relation to graphics resources 
included in your bundle.

Best regards,

More information about the macosx-port-dev mailing list