modules/graphics/src/main/native-glass/mac/GlassRobot.m

Print this page




 471                             kCGImageAlphaPremultipliedFirst);
 472 
 473                     CGColorSpaceRelease(picColorSpace);
 474 
 475                     // flip, scale, and color correct the screen image into the Java pixels
 476                     CGRect zeroBounds = { { 0, 0 }, { pixWidth, pixHeight } };
 477                     CGContextDrawImage(jPicContextRef, zeroBounds, screenImage);
 478                     CGContextFlush(jPicContextRef);
 479 
 480                     // cleanup
 481                     CGContextRelease(jPicContextRef);
 482                     (*env)->ReleaseIntArrayElements(env, pixelArray, javaPixels, 0);
 483 
 484                     jfloat scale = (*env)->CallStaticFloatMethod(env,
 485                             [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
 486                             javaIDs.Application.getScaleFactor, x, y, width, height);
 487 
 488                     // create Pixels
 489                     pixels = (*env)->CallStaticObjectMethod(env,
 490                             [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
 491                             javaIDs.Application.createPixels, pixWidth, pixHeight, pixelArray, scale);
 492                 }
 493             }
 494 
 495             CGImageRelease(screenImage);
 496         }
 497     }
 498     GLASS_POOL_EXIT;
 499 
 500     return pixels;
 501 }


 471                             kCGImageAlphaPremultipliedFirst);
 472 
 473                     CGColorSpaceRelease(picColorSpace);
 474 
 475                     // flip, scale, and color correct the screen image into the Java pixels
 476                     CGRect zeroBounds = { { 0, 0 }, { pixWidth, pixHeight } };
 477                     CGContextDrawImage(jPicContextRef, zeroBounds, screenImage);
 478                     CGContextFlush(jPicContextRef);
 479 
 480                     // cleanup
 481                     CGContextRelease(jPicContextRef);
 482                     (*env)->ReleaseIntArrayElements(env, pixelArray, javaPixels, 0);
 483 
 484                     jfloat scale = (*env)->CallStaticFloatMethod(env,
 485                             [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
 486                             javaIDs.Application.getScaleFactor, x, y, width, height);
 487 
 488                     // create Pixels
 489                     pixels = (*env)->CallStaticObjectMethod(env,
 490                             [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
 491                             javaIDs.Application.createPixels, pixWidth, pixHeight, pixelArray, scale, scale);
 492                 }
 493             }
 494 
 495             CGImageRelease(screenImage);
 496         }
 497     }
 498     GLASS_POOL_EXIT;
 499 
 500     return pixels;
 501 }