Previous Next


                                         306
CHAPTER 4                                                                    Graphics



Shading types 4 to 7 are defined by a stream containing descriptive data charac-
terizing the shading’s gradient fill. In these cases, the shading dictionary is also a
stream dictionary and can contain any of the standard entries common to all
streams (see Table 3.4 on page 62). In particular, it always includes a Length en-
try, which is required for all streams.

In addition, some shading dictionaries also include a Function entry whose value
is a function object (dictionary or stream) defining how colors vary across the
area to be shaded. In such cases, the shading dictionary usually defines the geom-
etry of the shading, and the function defines the color transitions across that
geometry. The function is required for some types of shading and optional for
others. Functions are described in detail in Section 3.9, “Functions.”

Note: Discontinuous color transitions, or those with high spatial frequency, may ex-
hibit aliasing effects when painted at low effective resolutions.


Color Space: Special Considerations

Conceptually, a shading determines a color value for each individual point within
the area to be painted. In practice, however, the shading may actually be used to
compute color values only for some subset of the points in the target area, with
the colors of the intervening points determined by interpolation between the
ones computed. Consumer applications are free to use this strategy as long as the
interpolated color values approximate those defined by the shading to within the
smoothness tolerance specified in the graphics state (see Section 6.5.2, “Smooth-
ness Tolerance”). The ColorSpace entry common to all shading dictionaries not
only defines the color space in which the shading specifies its color values but
also determines the color space in which color interpolation is performed.

Note: Some shading types (4 to 7) perform interpolation on a parametric value sup-
plied as input to the shading’s color function, as described in the relevant sections
below. This form of interpolation is conceptually distinct from the interpolation
described here, which operates on the output color values produced by the color
function and takes place within the shading’s target color space.

Gradient fills between colors defined by most shadings are implemented using a
variety of interpolation algorithms, and these algorithms are sensitive to the char-
acteristics of the color space. Linear interpolation, for example, may have observ-
ably different results when applied in a DeviceCMYK color space than in a Lab
color space, even if the starting and ending colors are perceptually identical. The

Previous Next