Graphics Reference
In-Depth Information
Porter and Duff define other compositing operations as well; almost all have the
same form as Equation 17.4, with the values
F
U
and
F
V
varying. One can think of
each point of the pixel as being in the opaque part of neither
U
nor
V
, the opaque
part of just
U
,ofjust
V
, or of both. For each, we can think of taking the color from
U
,from
V
, or from neither, but to use the color of
V
on a point where only
U
is
opaque seems nonsensical, and similarly for the points that are transparent in both.
Writing a quadruple to describe the chosen color, we have choices like
(
0,
U
,
V
,
U
)
representing
U
over
V
and
(
0,
U
,
V
,0
)
representing
U
xor
V
(i.e., show the part of
the image that's in either
U
or
V
but not both). Figure 17.4, following Porter and
Duff, lists the possible operations, the associated quadruples, and the multipliers
F
A
and
F
B
associated to each. The table in the figure omits symmetric operations
(i.e., we show
U
over
V
, but not
V
over
U
).
Finally, there are other compositing operations that do not follow the blending-
by-
F
s rule. One of these is the
darken
operation, which makes the opaque part of
an image darker without changing the coverage:
darken
(
U
,
s
)=(
sr
U
,
sg
U
,
sb
U
,
α
U
)
.
(17.5)
Closely related is the
dissolve
operation, in which the pixel retains its color, but
the coverage is gradually reduced:
dissolve
(
U
,
s
)=(
sr
U
,
sg
U
,
sb
U
,
s
α
U
)
.
(17.6)
Operation
Quadruple
Diagram
F
U
F
V
Clear
(
0, 0, 0, 0
)
0
0
U
(
0,
U
,0,
U
)
1
0
U
over
V
(
0,
U
,
V
,
U
)
1
1
−α
U
U
in
V
(
0, 0, 0,
U
)
α
V
0
U
out
V
(
0,
U
,0,0
)
1
−α
V
0
U
atop
V
(
0, 0,
V
,
U
)
α
V
1
−α
U
U
xor
V
(
0,
U
,
V
,0
)
1
−α
V
1
−α
U
Figure 17.4: Compositing operations, and the multipliers for each, to be used with colors
premultiplied by
α
(following Porter and Duff).