< prev index next >
src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 172,182 ****
* @return color of the pixel
*/
@Override
public int getRGBPixel(int x, int y) {
int c[] = new int[1];
! getScreenPixels(new Rectangle(x, y, 1, 1), c);
return c[0];
}
/**
* Creates an image containing pixels read from the screen.
--- 172,183 ----
* @return color of the pixel
*/
@Override
public int getRGBPixel(int x, int y) {
int c[] = new int[1];
! double scale = fDevice.getScaleFactor();
! getScreenPixels(new Rectangle(x, y, (int) scale, (int) scale), c);
return c[0];
}
/**
* Creates an image containing pixels read from the screen.
*** 196,204 ****
int buttonsState,
boolean isButtonsDownState,
boolean isMouseMove);
private native void keyEvent(int javaKeyCode, boolean keydown);
private void getScreenPixels(Rectangle r, int[] pixels){
! nativeGetScreenPixels(r.x, r.y, r.width, r.height, pixels);
}
! private native void nativeGetScreenPixels(int x, int y, int width, int height, int[] pixels);
}
--- 197,206 ----
int buttonsState,
boolean isButtonsDownState,
boolean isMouseMove);
private native void keyEvent(int javaKeyCode, boolean keydown);
private void getScreenPixels(Rectangle r, int[] pixels){
! double scale = fDevice.getScaleFactor();
! nativeGetScreenPixels(r.x, r.y, r.width, r.height, scale, pixels);
}
! private native void nativeGetScreenPixels(int x, int y, int width, int height, double scale, int[] pixels);
}
< prev index next >