CHAPTER 4
308
Graphics
ShadingType
entry. The following sections describe the available shading types
and the dictionary entries specific to each.
Type 1 (Function-Based) Shadings
In type 1 (function-based) shadings, the color at every point in the domain is
defined by a specified mathematical function. The function need not be smooth
or continuous. This type is the most general of the available shading types and is
useful for shadings that cannot be adequately described with any of the other
types. Table 4.29 shows the shading dictionary entries specific to this type of
shading, in addition to those common to all shading dictionaries (Table 4.28).
Note:
This type of shading cannot be used with an
Indexed
color space.
TABLE 4.29 Additional entries specific to a type 1 shading dictionary
KEY
TYPE
VALUE
Domain
array
(Optional)
An array of four numbers
[
x
min
x
max
y
min
y
max
]
specifying the
rectangular domain of coordinates over which the color function(s) are defined.
Default value:
[ 0.0 1.0 0.0 1.0 ]
.
(Optional)
An array of six numbers specifying a transformation matrix mapping
the coordinate space specified by the
Domain
entry into the shading’s target co-
ordinate space. For example, to map the domain rectangle
[ 0.0 1.0 0.0 1.0 ]
to a
1-inch square with lower-left corner at coordinates (100, 100) in default user
space, the
Matrix
value would be
[ 72 0 0 72 100 100 ]
. Default value: the iden-
tity matrix
[ 1 0 0 1 0 0 ]
.
(Required)
A 2-in,
n-out
function or an array of
n
2-in, 1-out functions (where
n
is the number of color components in the shading dictionary’s color space). Each
function’s domain must be a superset of that of the shading dictionary. If the val-
ue returned by the function for a given color component is out of range, it is ad-
justed to the nearest valid value.
Matrix
array
Function
function
The domain rectangle (
Domain
) establishes an internal coordinate space for the
shading that is independent of the target coordinate space in which it is to be
painted. The color function(s) (
Function
) specify the color of the shading at each
point within this domain rectangle. The transformation matrix (
Matrix
) then
maps the domain rectangle into a corresponding rectangle or parallelogram in
the target coordinate space. Points within the shading’s bounding box (
BBox
) that
fall outside this transformed domain rectangle are painted with the shading’s