Java Reference
In-Depth Information
Figure 10-14.
The MeshCubePickDemo program
Understanding the Canvas and Image Ops APIs
The Canvas and Image Ops APIs allow you to manipulate the 2D graphical content of an on-screen canvas or an
off-screen image.
Understanding the Canvas API
The Canvas API consists of two public classes,
Canvas
and
GraphicsContext
in the
javafx.scene.canvas
package.
Canvas
is a
Node
that can be added to a
Scene
.
The
Canvas
class includes two public constructors:
Canvas()
•
Canvas(double width, double height)
The default constructor creates a
Canvas
with zero
width
and zero
height
. The two-parameter constructor
creates a
Canvas
with the specified
width
and
height
.
The
Canvas
class includes the following public methods:
•
GraphicsContext getGraphicsContext2D()
•
void setWidth(double width)
•
double getWidth()
•
Search WWH ::
Custom Search