Java Reference
In-Depth Information
Figure 7-21.
Select Transformation from the Demo menu to view the transformation
demonstration.
Composite Rule
Graphics2D
declares
void setComposite(Composite comp)
for setting
the composite rule attribute. Pass any object whose class implements the
java.awt.Composite
interfaceto
comp
.Call
Composite getComposite()
to return the current composite rule.
The only class that implements this interface is
java.awt.AlphaComposite
,
which implements basic alpha composite rules for combining source and destination
colorstoachieveblendingandtransparencyeffectswithgraphicsandimages.Thespe-
cificrulesimplementedbythisclassarethebasicsetof12rulesdescribedinT.Porter's
AlphaComposite
declares
CLEAR
,
DST
,
DST_ATOP
,
DST_IN
,
DST_OUT
,
DST_OVER
,
SRC
,
SRC_ATOP
,
SRC_IN
,
SRC_OUT
,
SRC_OVER
, and
XOR
integer
constants that describe these rules—
SRC_OVER
is the default. It also declares precre-