Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization
by Alejandro Terrazas, John Ostuni, Michael Barlow
Shape Primitives
So far we have only drawn rectangles in our examples, but there are, in fact, nine shape primitives available to us. These shapes are contained almost entirely in the java.awt.geom package and can be used to draw pretty much anything in two dimensions. All shape primitives implement the Shape interface, a set of methods for describing shapes that is part of the java.awt package. In addition, all shape primitives implement the PathIterator object that specifies the outline of the shape. Before explaining the PathIterator interface, we will introduce the shape primitives:
Arc2D
Area
CubicCurve2D
Ellipse2D
GeneralPath
Line2D
QuadCurve2D
Rectangle2D
RoundRectangle2D
This set of primitives can be divided into four categories based on their ...
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