/tofximage

AWT to JavaFX Image Conversion Benchmarks

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

This project compares the performance of various methods for converting an AWT image to a JavaFX image, including the public utility method SwingFXUtils.toFXImage. Although some of the methods convert the alpha values incorrectly, they are included in the tests because their conversion is correct when the source AWT image contains no transparent pixels.

Results

The results of running the benchmarks on my systems are published on the website associated with this repository.

Licenses

This project is licensed under the GNU General Public License v3.0 except for the following file, which is licensed by Oracle under the GNU General Public License v2.0 with the Classpath Exception:

The contents of the website and the file doll-dancing.gif are licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. The website style is based on Water.css.

Building

This is a Maven project that depends on the Java Microbenchmark Harness. You can build and package the application as the file target/benchmarks.jar with the commands:

$ export JAVA_HOME=$HOME/opt/jdk-14.0.1
$ mvn package

Running

Run a quick test with a command like the following:

$ java -Djava.library.path=$HOME/lib/javafx-sdk-15/lib \
    -jar target/benchmarks.jar -f 1 -i 1 -wi 1

Run the benchmarks with their default options for a more thorough test:

$ java -Djava.library.path=$HOME/lib/javafx-sdk-15/lib \
    -jar target/benchmarks.jar

The -h option prints a description of all benchmark command options:

$ java -jar target/benchmarks.jar -h