Painting images using PixelWriter

Jim Graham james.graham at
Mon Jun 4 15:18:23 PDT 2012

Also, please do not draw any conclusions about the performance of this 
API just yet.

The version you are working with in the promoted builds is essentially 
sending the pixel data over one pixel at a time using several method 
calls per pixel, just to get the API into your hands so you can see if 
it does the things you want it to do (ignoring performance).  We are 
just now about to integrate the code that will start doing optimized 
copies of the pixel data into our internal rendering buffers and the 
performance should improve by several orders of magnitude.  In a few 
days you may have a better understanding of how its performance will 
meet your needs in addition to the form of the API...


On 6/4/2012 2:14 PM, Kevin Rushforth wrote:
> No, this is not possible since we do not expose the rendering thread,
> and anything that directly touched the copy being used for rendering
> would not be a good idea. I doubt that this extra copy will be an issue
> in most cases.
> One possible future improvement would be to have some way for you to
> pass in a buffer "by reference" with the understanding that once you do,
> you cannot touch it until it is "released". This would allow an app to
> double-buffer a pair of NIO buffers, filling one while FX was uploading
> the other to a texture.
> -- Kevin
> Tobias Bley (UltraMixer) wrote:
>> HI Jasper,
>> do you think it would be possible to change this to one shared buffer?
>> IMO thats the big advantage of NIO buffers. So we could get a much
>> better performance when showing webcam images or video frames. So I
>> could query the webcam by JNI and fill in a Java IO buffer which is
>> rendered by JavaFX. But if there is a need to copy the complete image
>> every 40ms (framerate 25fps) the performance could be poor.
>> Best regards,
>> Tobi
>> --
>> Tobias Bley
>> Geschäftsführer/ Managing Director
>> ------------------------------------------------------------------------
>> UltraMixer Digital Audio Solutions
>> Schillerstrasse 29
>> 01326 Dresden
>> -------------------------------------------------------------------------
>> info at
>> Am 04.06.2012 um 22:17 schrieb Jasper Potts:
>>> Hi,
>>> There will always be at minimum one copy operation because JavaFX
>>> runs on two threads. So at the point when you set pixels a copy will
>>> be made so it can be safe to access that new copy from our internal
>>> render thread. So you can have your own ByteBuffer access from native
>>> and every time you call setPixels a copy will be taken for the JavaFX
>>> platform to use. So you will need to make sure the content is static
>>> during that setPixels (copy) operation.
>>> Jasper
>>> On Jun 4, 2012, at 2:06 AM, Tobias Bley wrote:
>>>> Hi,
>>>> since JFX 2.2 there is the new class PixelWriter. Would it be
>>>> possible to draw Images like from a webcam using a shared ByteBuffer
>>>> (or IntBuffer)? Wo what I would like to do is to fill a shared
>>>> ByteBuffer from C (with JNI) and use the same bytebuffer for the
>>>> JavaFX Image object....
>>>> Best regards,
>>>> Tobi
>>>> --
>>>> Tobias Bley
>>>> Chief Executive Officer
>>>> --------------------------------------------------------
>>>> UltraMixer Digital Audio Solutions
>>>> Schillerstraße 29
>>>> D-01326 Dresden
>>>> Germany
>>>> --------------------------------------------------------
>>>> bley at

More information about the openjfx-dev mailing list