Previous Next
240
CHAPTER 4 Graphics
A color space is defined by an array object whose first element is a name object
identifying the color space family. The remaining array elements, if any, are
parameters that further characterize the color space; their number and types vary
according to the particular family. For families that do not require parameters,
the color space can be specified simply by the family name itself instead of an
array.
A color space can be specified in two principal ways:
• Within a content stream, the CS or cs operator establishes the current color
space parameter in the graphics state. The operand is always a name object,
which either identifies one of the color spaces that need no additional parame-
ters (DeviceGray, DeviceRGB, DeviceCMYK, or some cases of Pattern) or is used
as a key in the ColorSpace subdictionary of the current resource dictionary (see
Section 3.7.2, “Resource Dictionaries”). In the latter case, the value of the dic-
tionary entry is in turn a color space array or name. A color space array is never
permitted inline within a content stream.
• Outside a content stream, certain objects, such as image XObjects, specify a
color space as an explicit parameter, often associated with the key ColorSpace.
In this case, the color space array or name is always defined directly as a PDF
object, not by an entry in the ColorSpace resource subdictionary. This conven-
tion also applies when color spaces are defined in terms of other color spaces.
The following operators set the current color space and current color parameters
in the graphics state:
• CS sets the stroking color space; cs sets the nonstroking color space.
• SC and SCN set the stroking color; sc and scn set the nonstroking color. De-
pending on the color space, these operators require one or more operands, each
specifying one component of the color value.
• G, RG, and K set the stroking color space implicitly and the stroking color as
specified by the operands; g, rg, and k do the same for the nonstroking color
space and color.
Previous Next