Graphics Reference
In-Depth Information
so
S
=(
S r ,
S g ,
S b ,
S α ) ,
D α ) .
Notice that although defined as the fourth channel of color, the
D
=(
D r ,
D g ,
D b ,
channel cannot
affect the color of a pixel directly. Only the R , G ,and B channels can change
the color of a pixel. The
α
channel is designed to be used as the blending factor
in achieving transparency effects. For example, Figure 12.8 shows a semitrans-
α
parent circle drawn over a square. Notice that we can see through and observe
colors/objects behind the circle. The final color of pixels covered by the circle is
actually a blend of the circle color and that of the original destination pixel color:
the colors of the square and the grid. In this case, the circle is the source primitive
with color S ; before rendering the circle, the destination pixels' colors are D .In
this example, the source blending factor A s is
Figure 12.8.
Asemi-
transparent circle.
A s =
S α ,
and the destination blending factor A d is
A d =(
1
S α ) ,
whereas the blending function is the addition function
×
A d +
×
,
D
D
S
A s
× (
S α )+
×
S α ,
D
D
1
S
or
× (
S α )+
×
S α ,
D r
D r
1
S r
D g
D g × (
1
S α )+
S g ×
S α ,
(12.4)
D b
D b × (
1
S α )+
S b ×
S α ,
D α
D α × (
1
S α )+
S α ×
S α .
In this way, S α approximates the opacity effect of the circle: when
α =
1, we will
not see any color behind the circle; when
α =
0
.
5, we will see an equal blend;
0, the circle will be completely transparent.
Typical modern graphics hardware supports the following blending factors
( A d and A s ) for source and destination:
and when
α =
High-end hardware. Special-
ized graphics hardware may
support additional options for
blending factor and function
types.
Constant 0
( 0 , 0 , 0 , 0 )
Constant 1
( 1 , 1 , 1 , 1 )
Source color
( S r , S g , S b , S α )
Inverse source color
( 1 S r , 1 S g , 1 S b , 1 S α )
Source alpha
( S α , S α , S α , S α )
Inverse source alpha
(
1
S α ,
1
S α ,
1
S α ,
1
S α )
Destination alpha
( D α , D α , D α , D α )
Inverse destination alpha
( 1 D α , 1 D α , 1 D α , 1 D α )
 
Search WWH ::




Custom Search