A DESCRIPTION OF THE REQUEST :
Currently it is not possible to specify the PixelFormat, when creating a new WritableImage. It always uses the platform default PixelFormat.
JUSTIFICATION :
1. Awt BufferedImage has it.
See: http://docs.oracle.com/javase/8/docs/api/java/awt/image/BufferedImage.html#BufferedImage-int-int-int-
2. Our application applies a sequence of filters to Images. These filters work on non-premultiplied pixels.
They are currently applied to BufferedImages, therefore our JavaFX application must convert JavaFX-Images to and from BufferedImages, when applying filters. To increase performance and reduce memory usage, we converted our filters to apply to JavaFX-Images directly.
To our surprise the performance got worse. The reason for this is, that Writeable images are always created with premultiplied pixelformat. So to apply the filters the PixelReader must first demultiply the pixels, the filter must be applied and then the PixelWriter must again multiply the colors with the alphachannel.
All of this could be much faster, if it was possible to select a non-premultiplied PixelFormat, when creating a WritableImage.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Provide new constructor public WritableImage(int width, int height, WritablePixelFormat pixelformat), which will create a WritableImage with an internal buffer in the given pixelformat. If pixelformat is null, the platform specific default pixelformat is used.
Currently it is not possible to specify the PixelFormat, when creating a new WritableImage. It always uses the platform default PixelFormat.
JUSTIFICATION :
1. Awt BufferedImage has it.
See: http://docs.oracle.com/javase/8/docs/api/java/awt/image/BufferedImage.html#BufferedImage-int-int-int-
2. Our application applies a sequence of filters to Images. These filters work on non-premultiplied pixels.
They are currently applied to BufferedImages, therefore our JavaFX application must convert JavaFX-Images to and from BufferedImages, when applying filters. To increase performance and reduce memory usage, we converted our filters to apply to JavaFX-Images directly.
To our surprise the performance got worse. The reason for this is, that Writeable images are always created with premultiplied pixelformat. So to apply the filters the PixelReader must first demultiply the pixels, the filter must be applied and then the PixelWriter must again multiply the colors with the alphachannel.
All of this could be much faster, if it was possible to select a non-premultiplied PixelFormat, when creating a WritableImage.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Provide new constructor public WritableImage(int width, int height, WritablePixelFormat pixelformat), which will create a WritableImage with an internal buffer in the given pixelformat. If pixelformat is null, the platform specific default pixelformat is used.