Area
object stores and manipulates a resolution-independent description of an enclosed area of 2-dimensional space. Area
objects can be transformed and can perform various Constructive Area Geometry (CAG) operations when combined with other Area
objects. The CAG operations include area {@link #add addition}, {@link #subtract subtraction}, {@link #intersect intersection}, and {@link #exclusiveOr exclusive or}. See the linked method documentation for examples of the various operations. The Area
class implements the Shape
interface and provides full support for all of its hit-testing and path iteration facilities, but an Area
is more specific than a generalized path in a number of ways:
Area
objects constructed from unclosed paths are implicitly closed during construction as if those paths had been filled by the Graphics2D.fill
method. Area
resembles the path from which it was constructed only in that it describes the same enclosed 2-dimensional area, but may use entirely different types and ordering of the path segments to do so. Area
include: Area
from an unclosed (open) Shape
results in a closed outline in the Area
object. Area
from a Shape
which encloses no area (even when "closed") produces an empty Area
. A common example of this issue is that producing an Area
from a line will be empty since the line encloses no area. An empty Area
will iterate no geometry in its PathIterator
objects. Shape
may be split into two (or more) sub-paths each enclosing one of the non-intersecting portions of the original path. Area
may take more path segments to describe the same geometry even when the original outline is simple and obvious. The analysis that the Area
class must perform on the path may not reflect the same concepts of "simple and obvious" as a human being perceives.
|
|
|
|