Drawing on a Canvas
In this chapter, you will learn:
- What the Canvas API is
- How to create a canvas
- How to draw on a canvas such as basic shapes, text, paths, and images
- How to clear the canvas area
- How to save and restore the drawing states in a GraphicsContext
What Is the Canvas API?
Through the javafx.scene.canvas package, JavaFX provides the Canvas API that offers a drawing surface to draw shapes, images, and text using drawing commands. The API also gives pixel-level access to the drawing surface where you can write any pixels on the surface. The API consists of only two classes:
A canvas is a bitmap image, ...