2.1. Graphics2D
Rendering is the process of taking a collection of shapes, text, and images and figuring out what colors the pixels should be on a screen or printer. Shapes, text, and images are called graphics primitives ; screens and printers are called output devices. If I wanted to be pompous, I'd tell you that rendering is the process of displaying graphics primitives on output devices. A rendering engine performs this work; in the 2D API, the Graphics2D class is the rendering engine. Figure 2.1 shows this process at a high level. The 2D rendering engine takes care of the details of underlying devices and can accurately reproduce the geometry and color of a drawing, regardless of the device that displays it.
Figure 2.1. Rendering, the short story

Apart from being a rendering engine, an instance of Graphics2D also represents a drawing surface, which is simply some collection of pixels, each of which holds a color. It might be the inside of a window or a page in a printer, or even an offscreen image. Each time you draw something new, the new element is added to the existing drawing represented by the Graphics2D.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access