Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization
by Alejandro Terrazas, John Ostuni, Michael Barlow
Graphics Stroking
The Graphics2D method setStroke() is yet another method for changing the graphics context. We will now examine graphics stroking in greater detail.
Whenever a shape is stroked, it is as if a virtual pen draws an outline around the shape. The virtual pen has a characteristic style defining a set of shape primitives that are combined to make the desired effect. In Java 2D, the pen style is specified in a BasicStroke object. BasicStroke implements the Stroke interface and is intended to be used as an argument to the setStroke() method of the Graphics2D object.
The BasicStroke object represents the attributes for line width, endcap, and join style in addition to attributes for specifying different types of dash patterns. Setting ...
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