Re: [9] Review request for 8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1

2017-01-09 Thread Alexander Zvegintsev

Sure, updated in place.

Thanks,

Alexander.

On 01/09/2017 06:09 PM, Sergey Bylokhov wrote:

Looks fine.
But it seems that this field can be removed?
private static boolean isGtkSupported =false;
After the fix for JDK-8150954 this field is not used.



Hello,

please review the fix

http://cr.openjdk.java.net/~azvegint/jdk/9/8165705/00/ 



for the issue

https://bugs.openjdk.java.net/browse/JDK-8165705

Gtk is now default option for taking screenshots with Robot.

--
Thanks,
Alexander.







Re: OS X fullscreen window and dock

2017-01-09 Thread Michael Hall
> On Jan 8, 2017, at 9:04 AM, Michael Hall  wrote:
> 
> Stack overflow or someplace like that might be better for this sort of thing, 
> feel free to point that out if so. 
> But what is the best way to get a fullscreen window, less screen offsets with 
> a hidden dock?  While still accounting for the possible dock. I generally 
> like to have my dock hidden but pop up when needed. That space at the bottom 
> of the screen is valuable real estate. However, this can occasionally be a 
> nuisance if I want to actually get to something with the mouse at the very 
> bottom of the screen and it keeps popping up the dock in the way. 
> I am currently increasing the size of the main window of one of my 
> application’s. Going for as big as I can get it sort of full screen, 
> hopefully less insets for the dock. I can’t seem to get this. 
> For example using this…
> 
> Insets insets = 
> this.getToolkit().getScreenInsets(this.getGraphicsConfiguration());


I looked at this a little more to see if there isn't some way it should work as 
I’m thinking it should.
Speaking of Stackoverflow, I found this…

https://stackoverflow.com/questions/4982656/programmatically-get-screen-size-in-mac-os-x
 


This pretty much seems to follow what java is doing in CGraphicsDevice.m 
Java_sun_awt_CGraphicsDevice_nativeGetScreenInsets

where it appears to determine the difference between the screen size and the 
visible screen size.

someone in the Stackoverflow post indicates that...

"visibleFrame excludes the region occupied by the Dock or (when the Dock is 
hidden) the show-Dock trigger region, plus the menu bar.”

I think my testing showed that this is wrong, the ‘show-Dock trigger region’ is 
not excluded when the dock is hidden by user preference. 
Whether they are mistaken or this is a bug for OS X Yosemite I don’t know. 

I guess it would not be a java bug either way.

I will simply go for a JFrame that’s height is some arbitrary distance from the 
screen bottom if the dock appears to be hidden. That is, if the bottom inset it 
set to 4.

Thanks,

Michael Hall





Re: Review Request JDK:-8162959 [HiDPI] screenshot artifacts using AWT Robot

2017-01-09 Thread Alexandr Scherbatiy


  CGWindowListCreateImage() method which is used to capture a 
screenshot on Mac OS X by Robot has imageOption argument which can have 
value: kCGWindowImageBestResolution

https://developer.apple.com/reference/coregraphics/1666230-quartz_window_services/window_image_types?language=objc
   "When capturing the window, return the best image resolution. The 
returned image size may be different than the screen size."


  Could this option help to get a high-resolution CGImageRef on HiDPI 
display?


  Thanks,
  Alexandr.

On 12/27/2016 12:14 PM, Prem Balakrishnan wrote:


Hi Alexander,

Please review updated patch,

http://cr.openjdk.java.net/~pkbalakr/8162959/webrev.04/ 



I used  wrong bounds while creating images, correct it in this patch.

Regards,

Prem

*From:*Alexander Scherbatiy
*Sent:* Wednesday, December 14, 2016 5:18 PM
*To:* Prem Balakrishnan; Sergey Bylokhov; awt-dev@openjdk.java.net; 
Philip Race
*Subject:* Re: Review Request JDK:-8162959 [HiDPI] screenshot 
artifacts using AWT Robot


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/ 



  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@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/ 



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@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/ 



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@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 rev

Re: [9] Review request for 8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1

2017-01-09 Thread Sergey Bylokhov
Looks fine.
But it seems that this field can be removed?
private static boolean isGtkSupported =  false;
After the fix for JDK-8150954 this field is not used.

> 
> Hello,
> 
> please review the fix
> 
> http://cr.openjdk.java.net/~azvegint/jdk/9/8165705/00/
> 
> for the issue
> 
> https://bugs.openjdk.java.net/browse/JDK-8165705
> 
> Gtk is now default option for taking screenshots with Robot.
> 
> -- 
> Thanks,
> Alexander.
> 



[9] Review request for 8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1

2017-01-09 Thread Alexander Zvegintsev

Hello,

please review the fix

http://cr.openjdk.java.net/~azvegint/jdk/9/8165705/00/

for the issue

https://bugs.openjdk.java.net/browse/JDK-8165705

Gtk is now default option for taking screenshots with Robot.

--
Thanks,
Alexander.