<Swing Dev> [9] Review request for JDK-8150176 [hidpi] wrong resolution variant of multi-res. image is used for TrayIcon

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Thu Jun 9 15:13:08 UTC 2016


On 6/9/2016 11:55 AM, Rajeev Chamyal wrote:
>
> Hello All,
>
> Please review the following fix.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8150176
>
> Webrev: http://cr.openjdk.java.net/~rchamyal/8150176/webrev.00/ 
> <http://cr.openjdk.java.net/%7Erchamyal/8150176/webrev.00/>
>
> Issue: Wrong resolution variant image is used in Tray Icon.
>
> Fix : Applying the device transform to graphics object to select the 
> correct image.
>
     The image could be cropped on Linux because the high resolution 
icon which size is bigger that the original image is drawn to the 
buffered image with un-scaled size curW x CurH.
   It is better to get a resolution variant from the multi-resolution 
image, draw it to a buffered image with the same scaled size and then 
draw the buffered image to the paint graphics using original size:
     -------
     Image resolutionVariant = ((MultiResolutionImage) 
image).getResolutionVariant(scaleX * curW, scaleY * curH);
     BufferedImage bufImage = new BufferedImage(scaleX * curW, scaleY * 
curH, BufferedImage.TYPE_INT_ARGB);
     // ...
     gr.drawImage(image, 0, 0, scaleX * curW, scaleY * curH, observer);
     // ...
     g.drawImage(bufImage, 0, 0, curW, curH, observer); // non scaled 
width and height
     -------

   By the way, is the buffered image necessary in this case? Is it 
possible to draw the image directly to the paint graphics?
     -------
      g.drawImage(image, 0, 0, curW, curH, null);
     -------

Thanks,
Alexandr.
>
> Regards,
>
> Rajeev Chamyal
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160609/0357ddde/attachment.html>


More information about the swing-dev mailing list