<AWT Dev> Review Request JDK:-8162959 [HiDPI] screenshot artifacts using AWT Robot

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Wed Dec 14 11:48:13 UTC 2016


On 07/12/16 10:24, Prem Balakrishnan wrote:
>
> Hi Alexander,
>
> Please review updated patch as per review comments.
>
> http://cr.openjdk.java.net/~pkbalakr/8162959/webrev.03/ 
> <http://cr.openjdk.java.net/%7Epkbalakr/8162959/webrev.03/>
>
   I used a simple app [1] to create a screenshot of a frame on Mac OS X:
         Rectangle rect = frame.getBounds();
         rect.setLocation(frame.getLocationOnScreen());
         BufferedImage img = robot.createScreenCapture(rect);

   It takes only bottom right quarter of the frame [2].

   Is it possible to use some API that makes a screenshot and returns an 
NSImage on Mac OS X?
   In this case it would be possible to get a high resolution 
representation from the NSImage and return it in the same way as it is 
updated on Windows and Linux.

   [1] 
http://cr.openjdk.java.net/~alexsch/8162959/screenshot/RobotScreenshot.java
   [2] http://cr.openjdk.java.net/~alexsch/8162959/screenshot/screenshot.png

   Thanks,
   Alexandr.
>
> Regards,
>
> Prem
>
> *From:*Alexandr Scherbatiy
> *Sent:* Monday, November 21, 2016 8:10 PM
> *To:* Prem Balakrishnan; Sergey Bylokhov; awt-dev at openjdk.java.net; 
> Phil Race
> *Subject:* Re: Review Request JDK:-8162959 [HiDPI] screenshot 
> artifacts using AWT Robot
>
> On 11/16/2016 8:46 AM, Prem Balakrishnan wrote:
>
> Hi Alexander,
>
> Please review update patch as per review comments.
>
> http://cr.openjdk.java.net/~pkbalakr/8162959/webrev.02/ 
> <http://cr.openjdk.java.net/%7Epkbalakr/8162959/webrev.02/>
>
> With this patch, Robot.createScreenCapture(Rectangle) method returns a 
> scaled down image on the HiDPI display.
>
>
> - The native part on Mac OS X and Linux should be updated as well.
>
> - 416      * Returns BufferedImage for Non-HiDPI display and 
> MultiResolutionImage
>   417      * for HiDPI display with two resolution variants.
>
> There should be added an explanation what is the content of the first 
> and the second resolution variant.
>
> Thanks,
> Alexandr.
>
>
> Regards,
>
> Prem
>
> *From:*Alexandr Scherbatiy
> *Sent:* Thursday, November 03, 2016 4:05 PM
> *To:* Prem Balakrishnan; Sergey Bylokhov; awt-dev at openjdk.java.net 
> <mailto:awt-dev at openjdk.java.net>
> *Subject:* Re: Review Request JDK:-8162959 [HiDPI] screenshot 
> artifacts using AWT Robot
>
> On 11/2/2016 1:57 PM, Prem Balakrishnan wrote:
>
>
> Hi Alexander,
>
> Please review updated patch.
>
> http://cr.openjdk.java.net/~pkbalakr/8162959/webrev.01/ 
> <http://cr.openjdk.java.net/%7Epkbalakr/8162959/webrev.01/>
>
> Added a new public API “*Image createHiDPIScreenCapture(Rectangle 
> screenRect)”.*
>
> Returns an ordinary screenshot(BufferedImage) if the UI scale is 1.
>
> Returns MultiResolutionImage for HiDPI display with two resolution 
> variants,
>
> 1.Low Resolution/base image with user input width and height,  I have 
> used interpolation algorithm for scaling , adapted from JavaFX Robot 
> (http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/89a5de54b7dc),
>
> 2.High Resolution image with scaled width and height .
>
>   - Please, check that the Robot.createScreenCapture(Rectangle) method 
> returns a scaled down image on the HiDPI display
>   - Probably existing Java methods can be used for an image scaling.
>   For example, there is the Image.getScaledInstance(int width, int 
> height, int hints) method.
>   Or may be it is better just to create an image with required size 
> and draw the high-resolution image into it using a specific scale and 
> rendering hints.
>
>   Thanks,
>   Alexandr.
>
>
>
> Regards,
>
> Prem
>
> *From:*Alexander Scherbatiy
> *Sent:* Thursday, October 13, 2016 3:21 PM
> *To:* Prem Balakrishnan; Sergey Bylokhov; awt-dev at openjdk.java.net 
> <mailto:awt-dev at openjdk.java.net>
> *Subject:* Re: Review Request JDK:-8162959 [HiDPI] screenshot 
> artifacts using AWT Robot
>
> On 06/10/16 15:28, Prem Balakrishnan wrote:
>
>     Hi*,*
>
>     **
>
>     Please review fix for JDK 9,
>
>     *Bug:*https://bugs.openjdk.java.net/browse/JDK-8162959
>
>     *Webrev:*http://cr.openjdk.java.net/~pkbalakr/8162959/webrev.00/
>     <http://cr.openjdk.java.net/%7Epkbalakr/8162959/webrev.00/>
>
>     I have adapted the same fix as used for JavaFX Robot
>
>     *Bug: *JDK-8162783 <https://bugs.openjdk.java.net/browse/JDK-8162783>.
>
>     *Patch: *http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/89a5de54b7dc
>
>     New Public API ” BufferedImage createScreenCapture(Rectangle
>     screenRect, boolean isHiDPI)”is added,
>
>     Which will have a parameter to specify if HiDPI.
>
>   It is better to a add public method which returns MultiResolution 
> image on HiDPI display and  consists of two resoltion variants
>    - base image which has size requested by a user
>    - high-resolution image which creates an original screen capture
>
>   The proposed by your algorithm can be applied to the base image.
>   For more details see JDK-8020618 [macosx] java.awt.Robot makes 
> blurry screen captures on Retina
>
>   Thanks,
>   Alexandr.
>
>
>
>   
> Regards,
> Prem
>   
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20161214/02487637/attachment.html>


More information about the awt-dev mailing list