Java Reference
In-Depth Information
DoubleProperty widthProperty()
void setHeight(double height)
double getHeight()
DoubleProperty heightProperty()
The getGraphicsContext2D() method returns the GraphicsContext for the Canvas that you can use to perform
2D graphics operations. The same object is returned if you call getGraphicsContext2D() on the same Canvas object
multiple times. The other methods define read-write properties width and height for the Canvas .
The GraphicsContext class does not have any public constructors. The only way to obtain an instance of
GraphicsContext is from a Canvas object.
GraphicsContext supports a style of 2D operations that is similar to immediate mode 2D operations found in
other graphics toolkits such as java.awt.Canvas , javax.swing.Component , and the HTML 5 Canvas API. Unlike in
AWT or Java2D, where the drawing on the surface happens in the paint() callback method, the JavaFX Canvas's
typical usage scenario is to create the Canvas , get the GraphicsContext from it, draw on the Canvas with calls to
GraphicsContext methods, and then add the Canvas to the scene graph. You can continue calling GraphicsContext
methods after adding the Canvas to the scene graph. However, all GraphicsContext methods are considered UI
manipulating methods, and should only be called in the JavaFX Application thread after the Canvas has been added to
the scene graph.
The GraphicsContext class has a full set of public methods that allows you to perform 2D operations on the
Canvas that owns it. The following methods do not put any graphics artifacts on the Canvas ; however, they control the
state of the GraphicsContext and affect subsequent rendering calls:
void save()
void restore()
void translate(double x, double y)
void scale(double x, double y)
void rotate(double degrees)
void transform(double mxx, double myx, double mxy, double myy, double mxt,
double myt)
void transform(Affine xform)
void setTransform(double mxx, double myx, double mxy, double myy, double mxt,
double myt)
void setTransform(Affine xform)
Affine getTransform(Affine xform)
Affine getTransform()
void setGlobalAlpha(double alpha)
double getGlobalAlpha()
void setGlobalBlendMode(BlendMode op)
BlendMode getGlobalBlendMode()
void setFill(Paint p)
Paint getFill()
 
Search WWH ::




Custom Search