<Swing Dev> <AWT Dev> [10] Review request for 8182043: Access to Windows Large Icons
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Oct 5 22:20:54 UTC 2017
On 9/29/17 16:08, Semyon Sadetsky wrote:
> On 9/29/2017 3:15 PM, Sergey Bylokhov wrote:
>> On 9/29/17 12:39, Semyon Sadetsky wrote:
>>>>> Why 128 pixels? Windows shell usually provides icons up to 256
>>>>> pixels, for example there are 256×256 icons for folders and generic
>>>>> file type.
>>>>
>>>> It is limitation of our implementation:
>>>> https://bugs.openjdk.java.net/browse/JDK-8151385
>>>> http://mail.openjdk.java.net/pipermail/awt-dev/2016-March/010777.html
>>>>
>>> Sergey, it is not clear how those links are related to the icon size
>>> returned by Windows?
>>
>> It was a fix where the MAX_ICON_SIZE=128 was added.
> Actually it limits nothing. We told about the Extract call which may
> return any size.
I do not understand how it could be "that it limits nothing". The method
"makeIcon(long hIcon, int bsize)" is the only place where we create
BufferedImage which contains the data of icon, and this content cannot
be bigger than 128x128 pixels because of MAX_ICON_SIZE=128
>>
>> And every time we will try to make an icon it will be limited to
>> 128x128. But it is not critical.
>>
>> The issue is that this api, as you said, will depends from some
>> general "current scale". which is unrelated to the transform of the
>> screen in java.
>>
>> If the user will want to use FILE_ICON_LARGE, then to work properly he
>> will need to use this code every time in the the paint():
>> Icon icon = getSystemIcon(file, FILE_ICON_LARGE);
>> Icon hicon = getSystemIcon(file, icon.getIconWidth()*currentScreenScale);
> This is just wrong. The first line is the correct one for both HiDPI and
> nonHiDPI. If you want to have icons like in native apps. For custom
> behavior - please use the second line.
Why it is wrong? If the native application will request the large icon,
get the icon of size=32 and draw it to the screen, then the user will
see the icon inside 32x32 pixels on the screen. If the same steps will
be done in java the the user will see the icon inside 64x64 pixels,
because we will apply the java scale on top of the native scale. In case
of different dpi for a different screens we will get the similar bug,
because the icon which include the native scale is not applicable for
the low-dpi screen.
--
Best regards, Sergey.
More information about the swing-dev
mailing list