0

As a follow-up to Where is the time going with my ImageMagick rotations?, I'd like to understand if/how/where the following Java code is making use of hardware acceleration on my Macbook Air running Java 6:

BufferedImage image = ImageIO.read(inputFile);
AffineTransform transform = AffineTransform.getRotateInstance(Math.toRadians(10));
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
rotated = op.filter(image, null);

From browsing various SO questions, I gather this is going through the Java 2D library which in turn is going through an Apple-supplied JavaVM implementation.

Can someone provide guidance on to how I might determine this? (Note: My assumption is that it is making use of hardware acceleration because it can rotate a letter size, full-color 300 dpi image in about 50 milliseconds).

Update #1: I tried running the Java 2D trace option, but the lack of any trace output suggests that the above primitives aren't part of Java 2D or aren't considered "graphics primitives".

MacbookAir1:tmp palfvin$ java -Dsun.java2d.trace=log,timestamp,count,verbose MyApp foo.png
GraphicsPrimitive logging enabled
GraphicsPrimitive timetamps enabled
GraphicsPrimitive invocation counts enabled
GraphicsPrimitive trace output to System.err
MacbookAir1:tmp palfvin$
Community
  • 1
  • 1
Peter Alfvin
  • 28,599
  • 8
  • 68
  • 106
  • Short of running with [DTrace](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dtrace.1.html), you might check the [FAQ](http://www.oracle.com/technetwork/java/index-137037.html#Q_What_kinds_of_graphics_hardwar) where you would have seen `-Dsun.java2d.trace=[log[,timestamp]],[count],[out:],[help],[verbose]`. – Elliott Frisch Jan 27 '14 at 19:26
  • @ElliottFrisch Thanks for the suggestions. Will look at DTrace next, but see question update for experience with the second suggestion. – Peter Alfvin Jan 27 '14 at 20:05
  • Not sure if this will help, but I assume Java 6 is using hardware acceleration, since Java 2D in Oracle's JRE 7 is [painfully slow](http://stackoverflow.com/questions/20108866/slow-java2d-bilinear-interpolation-in-java-7-on-mac-os-x). – martinez314 Jan 27 '14 at 22:44

0 Answers0