< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m
Print this page
*** 1,7 ****
/*
! * Copyright (c) 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
--- 1,7 ----
/*
! * Copyright (c) 2016, 2017, 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
*** 274,296 ****
* Signature: (IIIII[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
(JNIEnv *env, jobject peer,
! jint x, jint y, jint width, jint height, jintArray pixels)
{
JNF_COCOA_ENTER(env);
jint picX = x;
jint picY = y;
jint picWidth = width;
jint picHeight = height;
! CGRect screenRect = CGRectMake(picX, picY, picWidth, picHeight);
CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
kCGWindowListOptionOnScreenOnly,
! kCGNullWindowID, kCGWindowImageDefault);
if (screenPixelsImage == NULL) {
return;
}
--- 274,297 ----
* Signature: (IIIII[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
(JNIEnv *env, jobject peer,
! jint x, jint y, jint width, jint height, jdouble scale, jintArray pixels)
{
JNF_COCOA_ENTER(env);
jint picX = x;
jint picY = y;
jint picWidth = width;
jint picHeight = height;
! CGRect screenRect = CGRectMake(picX / scale, picY / scale,
! picWidth / scale, picHeight / scale);
CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
kCGWindowListOptionOnScreenOnly,
! kCGNullWindowID, kCGWindowImageBestResolution);
if (screenPixelsImage == NULL) {
return;
}
< prev index next >