Canvas API maintenance

Jim Graham james.graham at
Fri May 18 12:10:48 PDT 2012

As was already mentioned, the existing (deprecated) methods on 
GraphicsContext for dealing with ImageData and writing pixels were 
preliminary and intended to be replaced by a mechanism that would be 
compatible with the FX Image Ops which were just reviewed and 
integrated.  To that end, I am proposing the following modification of 
the GraphicsContext API:

Remove deprecated methods, fields, and inner classes:

Remove Canvas.ImageData class
Remove createImageData(...) factory methods // all variants
Remove putImageData(...) // all variants

Add the following method:

      * Returns a {@link PixelWriter} object that can be used to modify
      * the pixels of the {@link Canvas} associated with this
      * {@code GraphicsContext}.
      * All coordinates in the {@code PixelWriter} methods on the returned
      * object will be in device space since they refer directly to pixels.
      * @return the {@code PixelWriter} for modifying the pixels of this
      *         {@code Canvas}
     public PixelWriter getPixelWriter();

Note that, just as it was in the draft of the Canvas API, there are no 
methods to get a PixelReader for the Canvas in this release.  Due to the 
asynchronous nature of our rendering threads it would require a bit of 
effort and documentation about blocking conditions to create such a 
mechanism.  We will try to implement that in an upcoming release, but in 
order to reduce the risk and simplify the implementation of this feature 
for this release, we are only providing similar pixel writing methods as 
were in the earlier API drafts...


More information about the openjfx-dev mailing list