How will resolution independence be handled in jdk8?
Hendrik Schreiber
hs at tagtraum.com
Mon Apr 29 03:26:54 PDT 2013
On Apr 29, 2013, at 12:15 PM, Artem Ananiev wrote:
>
> On 4/27/2013 1:42 AM, Hendrik Schreiber wrote:
>> On Apr 23, 2013, at 8:55 PM, Hendrik Schreiber wrote:
>>
>> BTW - something like this will be a necessity. Just think of images
>> in JButtons. You have to be able to pass some image into the button,
>> and the button needs to be able to correctly draw either a low or a
>> high resolution version. Automatically. Because it is close to
>> impossible to mess around with the actual drawing mechanism inside of
>> the ButtonUI...
>
> As you wrote above, @2x looks like a hack. Although we can support something like this in JDK7/8, I would prefer to have clear API to handle different scale factors. For example, API to listen for Window's graphics configuration changes and getter for the current scale factor value. In this case, application will be able to load a new image for the new scale factor and assign it to the button. A little piece of trivial code vs magic NSImage:// images.
>
> Of course, if we decide to provide any new public APIs, it can only be done in JDK8 or later. JDK7 API is frozen.
Sure a nice API is always preferable. But please don't forget to build in something that solves the JButton use case described above. You simply don't always have a way to manipulate the drawing pipeline, i.e. the Graphics2D object, when you are using Swing. Often you can only pass in an Image without being able to specify width and height.
It would be nice, if this made it into Java8. Then I wouldn't have to skip Java7 *and* Java8 to ship an app that looks decent on Retina.
Thank you.
-hendrik
More information about the macosx-port-dev
mailing list