Canvas API Feedback.

joe andresen joseph.andresen at
Fri May 11 10:22:17 PDT 2012

Hello All,

We would like to thank all of you for your input on the recent Canvas 
API. We received a lot of great feedback and made several changes. The 
following is a list.

(PS. We are not providing docs now because once this gets pushed into 
the open source runtime (hopefully soon) you can view it there)

1. Added a FillRule Property

2. Added getters with a copy-in copy-out rule for mutable objects 
(transforms and effects).

3. 3. Canvas will not be automatically resized by layout managers (that 
is, Canvas.isResizable() will be false), however we plan to provide an 
example of how one would implement this functionality.

4. We are sticking with an application controlled immediate mode drawing 
API for Canvas, similar to the likes of HTML 5 canvas. The rendering 
will be triggered by the application, and not by a paint callback.

5. We are making the GraphicsContext class final. We are not ready to 
provide a generic graphics interface as of JavaFX 2.2. This is out of 
scope for the Canvas feature, and is also something we might not want to 
base off of something like GraphicsContext anyway (and if we do provide 
this kind of interface, GraphicsContext could implement it). By not 
allowing subclassing in this first release, we have more flexibility to 
evolve the GraphicsContext over time.

6. Removed public double measureText(string text) from the API. There 
were actually many reasons we decided to do this. First off, we knew 
that the current spec and the names chosen implied that TextMetrics 
would contain more than just a double (if you look at the working draft 
of the spec last updated May 8th you will 
see that it indeed contains more information). Instead, our developers 
can use a text node to get the information they need, and we will 
provide a more general metrics class for text not limited to the Canvas 
package in the future.

Thanks again,

More information about the openjfx-dev mailing list