Previous Next
309
SECTION 4.6 Patterns
background color (Background); if the shading dictionary has no Background
entry, such points are left unpainted. If the function is undefined at any point
within the declared domain rectangle, an error may occur, even if the corre-
sponding transformed point falls outside the shading’s bounding box.
Type 2 (Axial) Shadings
Type 2 (axial) shadings define a color blend that varies along a linear axis be-
tween two endpoints and extends indefinitely perpendicular to that axis. The
shading may optionally be extended beyond either or both endpoints by continu-
ing the boundary colors indefinitely. Table 4.30 shows the shading dictionary en-
tries 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.30 Additional entries specific to a type 2 shading dictionary
KEY TYPE VALUE
Coords array (Required) An array of four numbers [ x0 y0 x1 y1 ] specifying the starting and
ending coordinates of the axis, expressed in the shading’s target coordinate
space.
Domain array (Optional) An array of two numbers [ t0 t1 ] specifying the limiting values of a
parametric variable t. The variable is considered to vary linearly between these
two values as the color gradient varies between the starting and ending points of
the axis. The variable t becomes the input argument to the color function(s). De-
fault value: [ 0.0 1.0 ].
Function function (Required) A 1-in, n-out function or an array of n 1-in, 1-out functions (where n
is the number of color components in the shading dictionary’s color space). The
function(s) are called with values of the parametric variable t in the domain de-
fined by the Domain entry. Each function’s domain must be a superset of that of
the shading dictionary. If the value returned by the function for a given color
component is out of range, it is adjusted to the nearest valid value.
Extend array (Optional) An array of two boolean values specifying whether to extend the
shading beyond the starting and ending points of the axis, respectively. Default
value: [ false false ].
The color blend is accomplished by linearly mapping each point (x, y) along the
axis between the endpoints (x0 , y0 ) and (x1 , y1 ) to a corresponding point in the
Previous Next