Aqua Icons support on HiDPI displays.

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Wed Oct 23 08:38:33 PDT 2013


On 10/19/2013 1:21 PM, Hendrik Schreiber wrote:
> On Oct 19, 2013, at 12:45 AM, Mike Swingler wrote:
>
>> On Oct 18, 2013, at 4:49 AM, Alexander Scherbatiy <alexandr.scherbatiy at oracle.com> wrote:
>>
>>> The GetIconRef method is used in the CImage.m now to get the system icons on MacOSX.
>>>
>>> The NSImage + (id)imageNamed:(NSString *)name method can be used directly instead.
>>>
>>> There are NSImageNameFolder, NSImageNameFolderBurnable, and NSImageNameFolderSmart constants but I can't find
>>> the constant for the open folder icon.
>>> https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSImage_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Toolbar_Named_Images
>>>
>>> The same is for the alert stop system icon. There are NSImageNameInfo and NSImageNameCaution icons but I can't find
>>> the constant for the alert stop icon.
> Alexander,
>
> may I ask through which API you intend to make the icons available?

   There is a way to load system images and icons on MacOS X in Java by 
using: Toolkit.getDefaultToolkit().getImage("NSImage://NSImageName") method:
https://developer.apple.com/library/mac/documentation/java/conceptual/java14development/04-JavaUIToolkits/JavaUIToolkits.html
    This method calls [NSImage imageNamed: "NSImageName"] and we are 
going to reuse it for the system icons loading.

>   Also, will there be a way to create custom HiDPI images/icons?
> If so, how?

    There is the fix that has been recently sent to review: 
http://mail.openjdk.java.net/pipermail/awt-dev/2013-October/006133.html
     A user needs to override the getScaledInstance(width, height, 
hints)  method in Image class and returns images with necessary 
resolution according to
     the given width and height.  Images with @2x postfix should be 
automatically loaded into the ToolkitImage on MacOS X.

   Thanks,
   Alexandr.

>
> Thanks,
>
> -hendrik



More information about the macosx-port-dev mailing list