PDF Reference sixth edition, Adobe Portable Document Format Version 1.7 (book 1) — page 7

249
SECTION 4.5
Color Spaces
The transformation defined by the Gamma and Matrix entries in the CalRGB color
space dictionary is
GR
GG
GB
X = L = XA × A
+
XB × B
+
XC × C
GR
GG
GB
Y = M = YA × A
+
YB × B
+
YC × C
GR
GG
GB
Z = N = ZA × A
+
ZB × B
+
ZC × C
In other words, the A, B, and C components are first decoded individually by the
gamma functions. The results are treated as a three-element vector and multi-
plied by Matrix (a 3-by-3 matrix) to obtain the L, M, and N components of the in-
termediate representation. Since there is no second stage, these are also the X, Y,
and Z components of the final representation.
Example 4.7 shows an example of a CalRGB color space for the CCIR XA/11-
recommended D65 white point with 1.8 gammas and Sony Trinitron phosphor
chromaticities.
Example 4.7
[
/CalRGB
<< /WhitePoint [ 0.9505 1.0000 1.0890 ]
/Gamma [ 1.8000 1.8000 1.8 000]
/Matrix [
0.4497 0.2446 0.0252
0.3163 0.6720 0.1412
0.1845 0.0833 0.9227
]
>>
]
In some cases, the parameters of a CalRGB color space may be specified in terms
of the CIE 1931 chromaticity coordinates (xR , yR ), (xG , yG ), (xB , yB ) of the red,
green, and blue phosphors, respectively, and the chromaticity (xW, yW ) of the dif-
fuse white point corresponding to some linear RGB value (R, G, B), where usually
R = G = B = 1.0. Note that standard CIE notation uses lowercase letters to specify
250
CHAPTER 4
Graphics
chromaticity coordinates and uppercase letters to specify tristimulus values. Giv-
en this information, Matrix and WhitePoint can be found as follows:
z
=
yW ×((xG xB yR (xR xB yG + (xR xGyB
)
yR
(
xG xB
yW
(
xW xB
yG
+
(
xW xG
yB
YA
=
-----
× ---------------------------------------------------------------------------------------------------------------------------------
R
z
xR
⎛1
-
xR
XA = YA
× -----
ZA = YA
×
--------------
- 1
y
yR
R
yG
(
xR xB
yW
(
xW xB
yR
+
(
xW xR
yB
YB
=
- -----
× -------------------------------------------------------------------------------------------------------------------------------
G
z
xG
⎛1
-
xG
XB = YB
× ------
ZB = YB
×
---------------
- 1
y
yG
G
yB
(
xR xG
yW
(
xW xG
yR
+
(
xW xR
yG
YC
=
-----
× ---------------------------------------------------------------------------------------------------------------------------------
B
z
xB
⎛1
-
xB
XC = YC
× -----
ZC = YC
×
--------------
- 1
y
yB
B
XW = XA × R + XB × G + XC × B
YW = YA × R + YB × G + YC × B
ZW = ZA × R + ZB × G + ZC × B
Lab Color Spaces
A Lab color space is a CIE-based ABC color space with two transformation stages
(see Figure 4.14 on page 245). In this type of space, A, B, and C represent the L*,
a*, and b* components of a CIE 1976 L*a*b* space. The range of the first (L*)
component is always 0 to 100; the ranges of the second and third (a* and b*)
components are defined by the Range entry in the color space dictionary (see
Table 4.15).
Plate 3 illustrates the coordinates of a typical Lab color space; Plate 4 compares
the gamuts (ranges of representable colors) for L*a*b*, RGB, and CMYK spaces.
251
SECTION 4.5
Color Spaces
TABLE 4.15 Entries in a Lab color space dictionary
KEY
TYPE
VALUE
WhitePoint
array
(Required) An array of three numbers [ XW YW ZW ] specifying the tristimulus value,
in the CIE 1931 XYZ space, of the diffuse white point; see “CalRGB Color Spaces” on
page 247 for further discussion. The numbers XW and ZW must be positive, and YW
must be equal to 1.0.
BlackPoint
array
(Optional) An array of three numbers [ XB YB ZB ] specifying the tristimulus value, in
the CIE 1931 XYZ space, of the diffuse black point; see “CalRGB Color Spaces” on
page 247 for further discussion. All three of these numbers must be non-negative.
Default value: [ 0.0 0.0 0.0 ].
Range
array
(Optional) An array of four numbers [ amin amax bmin bmax ] specifying the range of
valid values for the a* and b* (B and C) components of the color space—that is,
amin a* amax
and
bmin b* bmax
Component values falling outside the specified range are adjusted to the nearest valid
value without error indication. Default value: [ 100 100 100 100 ].
A Lab color space does not specify explicit decoding functions or matrix coef-
ficients for either stage of the transformation from L*a*b* space to XYZ space
(denoted by “Decode ABC,” “Matrix ABC,” “Decode LMN,” and “Matrix LMN” in
Figure 4.14 on page 245). Instead, these parameters have constant implicit values.
The first transformation stage is defined by the equations
L = L*+16
+ --------
116
500
M = L*+16
116
N = L*+16
- --------
116
200
The second transformation stage is given by
X = XW × g(L)
Y = YW × g(M)
Z = ZW × g(N)
252
CHAPTER 4
Graphics
where the function g (x) is defined as
-
g(x)
=
x3
if x
---
29
108
-
g(x)
=
×
x
- ---
otherwise
841
29⎠
Example 4.8 defines the CIE
1976 L*a*b* space with the CCIR XA/11-
recommended D65 white point. The a* and b* components, although theoretical-
ly unbounded, are defined to lie in the useful range −128 to +127.
Example 4.8
[
/Lab
<< /WhitePoint [ 0.9505 1.0000 1.0890 ]
/Range [ −128 127 −128 127 ]
>>
]
ICCBased Color Spaces
ICCBased color spaces (PDF 1.3) are based on a cross-platform color profile as
defined by the International Color Consortium (ICC). Unlike the CalGray,
CalRGB, and Lab color spaces, which are characterized by entries in the color
space dictionary, an ICCBased color space is characterized by a sequence of bytes
in a standard format. Details of the profile format can be found in the ICC speci-
fication (see the Bibliography).
An ICCBased color space is specified as an array:
[ /ICCBased stream ]
The stream contains the ICC profile. Besides the usual entries common to all
streams (see Table 3.4 on page 62), the profile stream has the additional entries
listed in Table 4.16.
253
SECTION 4.5
Color Spaces
TABLE 4.16 Additional entries specific to an ICC profile stream dictionary
KEY
TYPE
VALUE
N
integer
(Required) The number of color components in the color space described by the ICC
profile data. This number must match the number of components actually in the ICC
profile. As of PDF 1.4, N must be 1, 3, or 4.
Alternate
array or
(Optional) An alternate color space to be used in case the one specified in the stream
name
data is not supported (for example, by applications designed for earlier versions of
PDF). The alternate space may be any valid color space (except a Pattern color space)
that has the number of components specified by N. If this entry is omitted and the ap-
plication does not understand the ICC profile data, the color space used is
DeviceGray, DeviceRGB, or DeviceCMYK, depending on whether the value of N is 1, 3,
or 4, respectively.
Note: There is no conversion of source color values, such as a tint transformation, when
using the alternate color space. Color values within the range of the ICCBased color space
might not be within the range of the alternate color space. In this case, the nearest values
within the range of the alternate space are substituted.
Range
array
(Optional) An array of 2 × N numbers [ min0 max0 min1 max1 ] specifying the min-
imum and maximum valid values of the corresponding color components. These val-
ues must match the information in the ICC profile. Default value:
[ 0.0 1.0
0.0
1.0
… ].
Metadata
stream
(Optional; PDF 1.4) A metadata stream containing metadata for the color space (see
Section 10.2.2, “Metadata Streams”).
The ICC specification is an evolving standard. Table 4.17 shows the versions of
the ICC specification on which the ICCBased color spaces supported by PDF ver-
sions 1.3 and later are based. (Earlier versions of the ICC specification are also
supported.)
TABLE 4.17 ICC specification versions supported by ICCBased color spaces
PDF VERSION ICC SPECIFICATION VERSION
1.3
3.3
1.4
ICC.1:1998-09 and its addendum ICC.1A:1999-04
1.5
ICC.1:2001-12
1.6
ICC.1:2003-09
254
CHAPTER 4
Graphics
PDF VERSION ICC SPECIFICATION VERSION
1.7
ICC.1:2004-10
PDF producers and consumers should follow these guidelines:
A consumer that supports a given PDF version is required to support ICC pro-
files conforming to the corresponding version (and earlier versions) of the ICC
specification, as described above. It may optionally support later ICC versions.
For the most predictable and consistent results, a producer of a given PDF ver-
sion should embed only profiles conforming to the corresponding version of
the ICC specification.
A PDF producer may embed profiles conforming to a later ICC version, with
the understanding that the results will vary depending on the capabilities of the
consumer. The consumer might process the profile while ignoring newer
features, or it might fail altogether to process the profile. Therefore, it is recom-
mended that the producer provide an alternate color space (Alternate entry in
the ICCBased color space dictionary) containing a profile that is appropriate for
the PDF version.
PDF supports only the profile types shown in Table 4.18; other types may be sup-
ported in the future. (In particular, note that XYZ and 16-bit L*a*b* profiles are
not supported.) Each of the indicated fields must have one of the values listed for
that field in the second column of the table. (Profiles must satisfy both the criteria
shown in the table.) The terminology is taken from the ICC specifications.
TABLE 4.18 ICC profile types
HEADER FIELD
REQUIRED VALUE
deviceClass
icSigInputClass ('scnr')
icSigDisplayClass ('mntr')
icSigOutputClass ('prtr')
icSigColorSpaceClass ('spac')
colorSpace
icSigGrayData ('GRAY')
icSigRgbData ('RGB ')
icSigCmykData ('CMYK')
icSigLabData ('Lab ')
255
SECTION 4.5
Color Spaces
The terminology used in PDF color spaces and ICC color profiles is similar, but
sometimes the same terms are used with different meanings. For example, the
default value for each component in an ICCBased color space is 0. The range of
each color component is a function of the color space specified by the profile and
is indicated in the ICC specification. The ranges for several ICC color spaces are
shown in Table 4.19.
TABLE 4.19 Ranges for typical ICC color spaces
ICC COLOR SPACE
COMPONENT RANGES
Gray
[ 0.0
1.0 ]
RGB
[ 0.0
1.0 ]
CMYK
[ 0.0
1.0 ]
L*a*b*
L*: [ 0 100 ]; a* and b*: [ −128 127 ]
Since the ICCBased color space is being used as a source color space, only the “to
CIE” profile information (AToB in ICC terminology) is used; the “from CIE”
(BToA) information is ignored when present. An ICC profile may also specify a
rendering intent, but PDF consumer applications ignore this information; the ren-
dering intent is specified in PDF by a separate parameter (see “Rendering Intents”
on page 260).
Note: The requirements stated above apply to an ICCBased color space that is used
to specify the source colors of graphics objects. When such a space is used as the
blending color space for a transparency group in the transparent imaging model
(see Sections 7.2.3, “Blending Color Space”; 7.3, “Transparency Groups”; and 7.5.5,
“Transparency Group XObjects”), it must have both “to CIE” (AToB) and “from
CIE” (BToA) information. This is because the group color space is used as both the
destination for objects being painted within the group and the source for the
group’s results. ICC profiles are also used in specifying output intents for matching
the color characteristics of a PDF document with those of a target output device or
production environment. When used in this context, they are subject to still other
constraints on the “to CIE” and “from CIE” information; see Section 10.10.4,
“Output Intents,” for details.
The representations of ICCBased color spaces are less compact than CalGray,
CalRGB, and Lab, but can represent a wider range of color spaces. In those cases
where a given color space can be expressed by more than one of the CIE-based
256
CHAPTER 4
Graphics
color space families, the resulting colors are expected to be rendered similarly,
regardless of the method selected for representation.
One particular color space is the so-called “standard RGB” or sRGB, defined in
the International Electrotechnical Commission (IEC) document Colour Measure-
ment and Management in Multimedia Systems and Equipment (see the Bibliogra-
phy). In PDF, the sRGB color space can be expressed precisely only as an
ICCBased space, although it can be approximated by a CalRGB space.
Example 4.9 shows an ICCBased color space for a typical three-component RGB
space. The profile’s data has been encoded in hexadecimal representation for
readability; in actual practice, a lossless decompression filter such as FlateDecode
should be used.
Example 4.9
10 0 obj
% Color space
[ /ICCBased 15 0 R ]
endobj
15 0 obj
% ICC profile stream
<< /N 3
/Alternate /DeviceRGB
/Length 1605
/Filter
/ASCIIHexDecode
>>
stream
00 00 02 0C 61 70 70 6C 02 00 00 00 6D 6E 74 72
52 47 42 20 58 59 5A 20 07 CB 00 02 00 16 00 0E
00 22 00 2C 61 63 73 70 41 50 50 4C 00 00 00 00
61 70 70 6C 00 00 04 01 00 00 00 00 00 00 00 02
00 00 00 00 00 00 F6 D4 00 01 00 00 00 00 D3 2B
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 09 64 65 73 63 00 00 00 F0 00 00 00 71
72 58 59 5A 00 00 01 64 00 00 00 14 67 58 59 5A
00 00 01 78 00 00 00 14 62 58 59 5A 00 00 01 8C
00 00 00 14 72 54 52 43 00 00 01 A0 00 00 00 0E
67 54 52 43 00 00 01 B0 00 00 00 0E 62 54 52 43
00 00 01 C0 00 00 00 0E 77 74 70 74 00 00 01 D0
00 00 00 14 63 70 72 74 00 00 01 E4 00 00 00 27
64 65 73 63 00 00 00 00 00 00 00 17 41 70 70 6C
257
SECTION 4.5
Color Spaces
65 20 31 33 22 20 52 47 42 20 53 74 61 6E 64 61
72 64 00 00 00 00 00 00 00 00 00 00 00 17 41 70
70 6C 65 20 31 33 22 20 52 47 42 20 53 74 61 6E
64 61 72 64 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 58 59 5A 58 59 5A 20 00 00 00 00 00 00 63 0A
00 00 35 0F 00 00 03 30 58 59 5A 20 00 00 00 00
00 00 53 3D 00 00 AE 37 00 00 15 76 58 59 5A 20
00 00 00 00 00 00 40 89 00 00 1C AF 00 00 BA 82
63 75 72 76 00 00 00 00 00 00 00 01 01 CC 63 75
63 75 72 76 00 00 00 00 00 00 00 01 01 CC 63 75
63 75 72 76 00 00 00 00 00 00 00 01 01 CC 58 59
58 59 5A 20 00 00 00 00 00 00 F3 1B 00 01 00 00
00 01 67 E7 74 65 78 74 00 00 00 00 20 43 6F 70
79 72 69 67 68 74 20 41 70 70 6C 65 20 43 6F 6D
70 75 74 65 72 73 20 31 39 39 34 00 >
endstream
endobj
Default Color Spaces
Colors that are specified in a device color space (DeviceGray, DeviceRGB, or
DeviceCMYK) are device-dependent. By setting default color spaces (PDF 1.1), a
PDF document can request that such colors be systematically transformed
(remapped) into device-independent CIE-based color spaces. This capability can
be useful in a variety of circumstances:
A document originally intended for one output device is redirected to a differ-
ent device.
A document is intended to be compatible with applications designed for earlier
versions of PDF and thus cannot specify CIE-based colors directly.
Color corrections or rendering intents need to be applied to device colors (see
“Rendering Intents” on page 260).
A color space is selected for painting each graphics object. This is either the cur-
rent color space parameter in the graphics state or a color space given as an entry
in an image XObject, inline image, or shading dictionary. Regardless of how the
color space is specified, it may be subject to remapping as described below.
258
CHAPTER 4
Graphics
When a device color space is selected, the ColorSpace subdictionary of the cur-
rent resource dictionary (see Section 3.7.2, “Resource Dictionaries”) is checked
for the presence of an entry designating a corresponding default color space
(DefaultGray, DefaultRGB, or DefaultCMYK, corresponding to DeviceGray,
DeviceRGB, or DeviceCMYK, respectively). If such an entry is present, its value is
used as the color space for the operation currently being performed. (If the appli-
cation does not recognize this color space, no remapping occurs; the original de-
vice color space is used.)
Color values in the original device color space are passed unchanged to the
default color space, which must have the same number of components as the
original space. The default color space should be chosen to be compatible with
the original, taking into account the components’ ranges and whether the compo-
nents are additive or subtractive. If a color value lies outside the range of the de-
fault color space, it is adjusted to the nearest valid value.
Note: Any color space other than a Lab, Indexed, or Pattern color space may be used
as a default color space provided that it is compatible with the original device color
space as described above.
If the selected space is a special color space based on an underlying device color
space, the default color space is used in place of the underlying space. This applies
to the following color spaces:
The underlying color space of a Pattern color space
The base color space of an Indexed color space
The alternate color space of a Separation or DeviceN color space (but only if the
alternate color space is actually selected)
See Section 4.5.5, “Special Color Spaces,” for details on these color spaces.
Note: There is no conversion of color values, such as a tint transformation, when us-
ing the default color space. Color values that are within the range of the device color
space might not be within the range of the default color space (particularly if the de-
fault is an ICCBased color space). In this case, the nearest values within the range of
the default space are used. For this reason, a Lab color space is not permitted as the
DefaultRGB color space.
259
SECTION 4.5
Color Spaces
Implicit Conversion of CIE-Based Color Spaces
In workflows in which PDF documents are intended for rendering on a specific
target output device (such as a printing press with particular inks and media), it is
often useful to specify the source colors for some or all of a document’s objects in
a CIE-based color space that matches the calibration of the intended device. The
resulting document, although tailored to the specific characteristics of the target
device, remains device-independent and will produce reasonable results if re-
targeted to a different output device. However, the expectation is that if the docu-
ment is printed on the intended target device, source colors that have been
specified in a color space matching the calibration of the device will pass through
unchanged, without conversion to and from the intermediate CIE 1931 XYZ
space as depicted in Figure 4.14 on page 245.
In particular, when colors intended for a CMYK output device are specified in an
ICCBased color space using a matching CMYK printing profile, converting such
colors from four components to three and back is unnecessary and results in a
loss of fidelity in the black component. In such cases, PDF consumer applications
may provide the ability for the user to specify a particular calibration to use for
printing, proofing, or previewing. This calibration is then considered to be that of
the native color space of the intended output device (typically DeviceCMYK), and
colors expressed in a CIE-based source color space matching it can be treated as if
they were specified directly in the device’s native color space. Note that the condi-
tions under which such implicit conversion is done cannot be specified in PDF,
since nothing in PDF describes the calibration of the output device (although an
output intent dictionary, if present, may suggest such a calibration; see Section
10.10.4, “Output Intents”). The conversion is completely hidden by the applica-
tion and plays no part in the interpretation of PDF color spaces.
When this type of implicit conversion is done, all of the semantics of the device
color space should also apply, even though they do not apply to CIE-based spaces
in general. In particular:
The nonzero overprint mode (see Section 4.5.6, “Overprint Control”) deter-
mines the interpretation of color component values in the space.
If the space is used as the blending color space for a transparency group in the
transparent imaging model (see Sections 7.2.3, “Blending Color Space”; 7.3,
“Transparency Groups”; and 7.5.5, “Transparency Group XObjects”), compo-
nents of the space, such as Cyan, can be selected in a Separation or DeviceN col-
260
CHAPTER 4
Graphics
or space used within the group (see “Separation Color Spaces” on page 264 and
“DeviceN Color Spaces” on page 268).
Likewise, any uses of device color spaces for objects within such a transparency
group have well-defined conversions to the group color space.
Note: A source color space can be specified directly (for example, with an ICCBased
color space) or indirectly using the default color space mechanism (for example,
DefaultCMYK; see “Default Color Spaces” on page 257). The implicit conversion of a
CIE-based color space to a device space should not depend on whether the CIE-
based space is specified directly or indirectly.
Rendering Intents
Although CIE-based color specifications are theoretically device-independent,
they are subject to practical limitations in the color reproduction capabilities of
the output device. Such limitations may sometimes require compromises to be
made among various properties of a color specification when rendering colors for
a given device. Specifying a rendering intent (PDF 1.1) allows a PDF file to set pri-
orities regarding which of these properties to preserve and which to sacrifice. For
example, the PDF file might request that colors falling within the output device’s
gamut (the range of colors it can reproduce) be rendered exactly while sacrificing
the accuracy of out-of-gamut colors, or that a scanned image such as a photo-
graph be rendered in a perceptually pleasing manner at the cost of strict colori-
metric accuracy.
Rendering intents are specified with the ri operator (see Section 4.3.3, “Graphics
State Operators”), the RI entry in a graphics state parameter dictionary (see Sec-
tion 4.3.4), and with the Intent entry in image dictionaries (Section 4.8.4, “Image
Dictionaries”). The value is a name identifying the rendering intent. Table 4.20
lists the standard rendering intents recognized in the initial release of PDF viewer
applications from Adobe Systems; Plate 5 illustrates their effects. These intents
have been deliberately chosen to correspond closely to those defined by the Inter-
national Color Consortium (ICC), an industry organization that has developed
standards for device-independent color. Note, however, that the exact set of ren-
dering intents supported may vary from one output device to another; a particu-
lar device may not support all possible intents or may support additional ones
beyond those listed in the table. If the application does not recognize the speci-
fied name, it uses the RelativeColorimetric intent by default.
261
SECTION 4.5
Color Spaces
See Section 7.6.4, “Rendering Parameters and Transparency,” and in particular
“Rendering Intent and Color Conversions” on page 574, for further discussion of
the role of rendering intents in the transparent imaging model.
TABLE 4.20 Rendering intents
NAME
DESCRIPTION
AbsoluteColorimetric
Colors are represented solely with respect to the light source; no
correction is made for the output medium’s white point (such as
the color of unprinted paper). Thus, for example, a monitor’s
white point, which is bluish compared to that of a printer’s pa-
per, would be reproduced with a blue cast. In-gamut colors are
reproduced exactly; out-of-gamut colors are mapped to the
nearest value within the reproducible gamut. This style of repro-
duction has the advantage of providing exact color matches
from one output medium to another. It has the disadvantage of
causing colors with Y values between the medium’s white point
and 1.0 to be out of gamut. A typical use might be for logos and
solid colors that require exact reproduction across different me-
dia.
RelativeColorimetric
Colors are represented with respect to the combination of the
light source and the output medium’s white point (such as the
color of unprinted paper). Thus, for example, a monitor’s white
point would be reproduced on a printer by simply leaving the
paper unmarked, ignoring color differences between the two
media. In-gamut colors are reproduced exactly; out-of-gamut
colors are mapped to the nearest value within the reproducible
gamut. This style of reproduction has the advantage of adapting
for the varying white points of different output media. It has the
disadvantage of not providing exact color matches from one me-
dium to another. A typical use might be for vector graphics.
Saturation
Colors are represented in a manner that preserves or emphasizes
saturation. Reproduction of in-gamut colors may or may not be
colorimetrically accurate. A typical use might be for business
graphics, where saturation is the most important attribute of the
color.
262
CHAPTER 4
Graphics
NAME
DESCRIPTION
Perceptual
Colors are represented in a manner that provides a pleasing per-
ceptual appearance. To preserve color relationships, both in-
gamut and out-of-gamut colors are generally modified from
their precise colorimetric values. A typical use might be for
scanned images.
4.5.5
Special Color Spaces
Special color spaces add features or properties to an underlying color space.
There are four special color space families: Pattern, Indexed, Separation, and
DeviceN.
Pattern Color Spaces
A Pattern color space (PDF 1.2) enables a PDF content stream to paint an area
with a pattern rather than a single color. The pattern may be either a tiling pattern
(type 1) or a shading pattern (type 2). Section 4.6, “Patterns,” discusses patterns in
detail.
Indexed Color Spaces
An Indexed color space allows a PDF content stream to use small integers as indi-
ces into a color map or color table of arbitrary colors in some other space. A PDF
consumer application treats each sample value as an index into the color table
and uses the color value it finds there. This technique can considerably reduce the
amount of data required to represent a sampled image—for example, by using
8-bit index values as samples instead of 24-bit RGB color values.
An Indexed color space is defined by a four-element array:
[ /Indexed base hival lookup ]
The first element is the color space family name Indexed. The remaining ele-
ments are parameters that an Indexed color space requires; their meanings are
discussed below. Setting the current stroking or nonstroking color space to an
Indexed color space initializes the corresponding current color to 0.
263
SECTION 4.5
Color Spaces
The base parameter is an array or name that identifies the base color space in
which the values in the color table are to be interpreted. It can be any device or
CIE-based color space or (in PDF 1.3) a Separation or DeviceN space, but not a
Pattern space or another Indexed space. For example, if the base color space is
DeviceRGB, the values in the color table are to be interpreted as red, green, and
blue components; if the base color space is a CIE-based ABC space such as a
CalRGB or Lab space, the values are to be interpreted as A, B, and C components.
Note: Attempting to use a Separation or DeviceN color space as the base for an
Indexed color space generates an error in PDF 1.2.
The hival parameter is an integer that specifies the maximum valid index value. In
other words, the color table is to be indexed by integers in the range 0 to hival.
hival can be no greater than 255, which is the integer required to index a table
with 8-bit index values.
The color table is defined by the lookup parameter, which can be either a stream
or (in PDF 1.2) a byte string. It provides the mapping between index values and
the corresponding colors in the base color space.
The color table data must be m × (hival + 1) bytes long, where m is the number of
color components in the base color space. Each byte is an unsigned integer in the
range 0 to 255 that is scaled to the range of the corresponding color component in
the base color space; that is, 0 corresponds to the minimum value in the range for
that component, and 255 corresponds to the maximum.
Note: PostScript uses a different interpretation of an Indexed color space’s color ta-
ble. In PostScript, the component value is always scaled to the range 0.0 to 1.0, re-
gardless of the range of color values in the base color space.
The color components for each entry in the table appear consecutively in the
string or stream. For example, if the base color space is DeviceRGB and the
indexed color space contains two colors, the order of bytes in the string or stream
is R0 G0 B0 R1 G1 B1 , where letters denote the color component and numeric
subscripts denote the table entry.
Example 4.10 illustrates the specification of an Indexed color space that maps
8-bit index values to three-component color values in the DeviceRGB color space.
264
CHAPTER 4
Graphics
Example 4.10
[
/Indexed
/DeviceRGB
255
< 000000 FF0000 00FF00 0000FF B57342 … >
]
The example shows only the first five color values in the lookup string; in all, there
should be 256 color values and the string should be 768 bytes long. Having
established this color space, the program can now specify colors as single-compo-
nent values in the range 0 to 255. For example, a color value of 4 selects an RGB
color whose components are coded as the hexadecimal integers B5, 73, and 42.
Dividing these by 255 and scaling the results to the range 0.0 to 1.0 yields a color
with red, green, and blue components of 0.710, 0.451, and 0.259, respectively.
Although an Indexed color space is useful mainly for images, index values can
also be used with the color selection operators SC, SCN, sc, and scn. For example:
123 sc
selects the same color as does an image sample value of 123. The index value
should be an integer in the range 0 to hival. If the value is a real number, it is
rounded to the nearest integer; if it is outside the range 0 to hival, it is adjusted to
the nearest value within that range.
Separation Color Spaces
Color output devices produce full color by combining primary or process
colorants in varying amounts. On an additive color device such as a display, the
primary colorants consist of red, green, and blue phosphors; on a subtractive de-
vice such as a printer, they typically consist of cyan, magenta, yellow, and some-
times black inks. In addition, some devices can apply special colorants, often
called spot colorants, to produce effects that cannot be achieved with the standard
process colorants alone. Examples include metallic and fluorescent colors and
special textures.
When printing a page, most devices produce a single composite page on which all
process colorants (and spot colorants, if any) are combined. However, some de-
vices, such as imagesetters, produce a separate, monochromatic rendition of the
page, called a separation, for each colorant. When the separations are later com-
265
SECTION 4.5
Color Spaces
bined—on a printing press, for example—and the proper inks or other colorants
are applied to them, the result is a full-color page.
A Separation color space (PDF 1.2) provides a means for specifying the use of
additional colorants or for isolating the control of individual color components of
a device color space for a subtractive device. When such a space is the current
color space, the current color is a single-component value, called a tint, that con-
trols the application of the given colorant or color components only.
Note: The term separation is often misused as a synonym for an individual device
colorant. In the context of this discussion, a printing system that produces separa-
tions generates a separate piece of physical medium (generally film) for each color-
ant. It is these pieces of physical medium that are correctly referred to as separations.
A particular colorant properly constitutes a separation only if the device is generat-
ing physical separations, one of which corresponds to the given colorant. The
Separation color space is so named for historical reasons, but it has evolved to the
broader purpose of controlling the application of individual colorants in general, re-
gardless of whether they are actually realized as physical separations.
Note also that the operation of a Separation color space itself is independent of the
characteristics of any particular output device. Depending on the device, the space
may or may not correspond to a true, physical separation or to an actual colorant.
For example, a Separation color space could be used to control the application of a
single process colorant (such as cyan) on a composite device that does not produce
physical separations, or could represent a color (such as orange) for which no specif-
ic colorant exists on the device. A Separation color space provides consistent, pre-
dictable behavior, even on devices that cannot directly generate the requested color.
A Separation color space is defined as follows:
[ /Separation name alternateSpace tintTransform ]
In other words, it is a four-element array whose first element is the color space
family name Separation. The remaining elements are parameters that a
Separation color space requires; their meanings are discussed below.
A color value in a Separation color space consists of a single tint component in
the range 0.0 to 1.0. The value 0.0 represents the minimum amount of colorant
that can be applied; 1.0 represents the maximum. Tints are always treated as
subtractive colors, even if the device produces output for the designated compo-
nent by an additive method. Thus, a tint value of 0.0 denotes the lightest color
266
CHAPTER 4
Graphics
that can be achieved with the given colorant, and 1.0 is the darkest. (This conven-
tion is the same as for DeviceCMYK color components but opposite to the one for
DeviceGray and DeviceRGB.) The initial value for both the stroking and non-
stroking color in the graphics state is 1.0. The SCN and scn operators respectively
set the current stroking and nonstroking color to a tint value. A sampled image
with single-component samples can also be used as a source of tint values.
The name parameter is a name object specifying the name of the colorant that
this Separation color space is intended to represent (or one of the special names
All or None; see below). Such colorant names are arbitrary, and there can be any
number of them, subject to implementation limits.
The special colorant name All refers collectively to all colorants available on an
output device, including those for the standard process colorants. When a
Separation space with this colorant name is the current color space, painting
operators apply tint values to all available colorants at once. This is useful for pur-
poses such as painting registration targets in the same place on every separation.
Such marks are typically painted as the last step in composing a page to ensure
that they are not overwritten by subsequent painting operations.
The special colorant name None never produces any visible output. Painting op-
erations in a Separation space with this colorant name have no effect on the cur-
rent page.
All devices support Separation color spaces with the colorant names All and
None, even if they do not support any others. Separation spaces with either of
these colorant names ignore the alternateSpace and tintTransform parameters (dis-
cussed below), although valid values must still be provided.
At the moment the color space is set to a Separation space, the consumer applica-
tion determines whether the device has an available colorant corresponding to
the name of the requested space. If so, the application ignores the alternateSpace
and tintTransform parameters; subsequent painting operations within the space
apply the designated colorant directly, according to the tint values supplied.
Note: The preceding paragraph applies only to subtractive output devices such as
printers and imagesetters. For an additive device such as a computer display, a
Separation color space never applies a process colorant directly; it always reverts to
the alternate color space as described below. This is because the model of applying
process colorants independently does not work as intended on an additive device; for
267
SECTION 4.5
Color Spaces
instance, painting tints of the Red component on a white background produces a
result that varies from white to cyan.
Note that this exception applies only to colorants for additive devices, not to the spe-
cific names Red, Green, and Blue. In contrast, a printer might have a (subtractive)
ink named, for example, Red, which should work as a Separation color space just
the same as any other supported colorant.
If the colorant name associated with a Separation color space does not cor-
respond to a colorant available on the device, the application arranges for subse-
quent painting operations to be performed in an alternate color space. The
intended colors can be approximated by colors in a device or CIE-based color
space, which are then rendered with the usual primary or process colorants:
The alternateSpace parameter must be an array or name object that identifies
the alternate color space, which can be any device or CIE-based color space but
not another special color space (Pattern, Indexed, Separation, or DeviceN).
The tintTransform parameter must be a function (see Section 3.9, “Functions”).
During subsequent painting operations, an application calls this function to
transform a tint value into color component values in the alternate color space.
The function is called with the tint value and must return the corresponding
color component values. That is, the number of components and the interpre-
tation of their values depend on the alternate color space.
Note: Painting in the alternate color space may produce a good approximation of
the intended color when only opaque objects are painted. However, it does not cor-
rectly represent the interactions between an object and its backdrop when the object
is painted with transparency or when overprinting (see Section 4.5.6, “Overprint
Control”) is enabled.
Example 4.11 illustrates the specification of a Separation color space (object 5)
that is intended to produce a color named LogoGreen. If the output device has no
colorant corresponding to this color, DeviceCMYK is used as the alternate color
space, and the tint transformation function (object 12) maps tint values linearly
into shades of a CMYK color value approximating the LogoGreen color.
268
CHAPTER 4
Graphics
Example 4.11
5 0 obj
% Color space
[
/Separation
/LogoGreen
/DeviceCMYK
12 0 R
]
endobj
12 0 obj
% Tint transformation function
<< /FunctionType 4
/Domain [ 0.0 1.0 ]
/Range [ 0.0 1.0
0.0
1.0
0.0
1.0
0.0 1.0 ]
/Length 62
>>
stream
{ dup 0.84 mul
exch 0.00 exch dup 0.44 mul
exch 0.21 mul
}
endstream
endobj
See Section 7.6.2, “Spot Colors and Transparency,” for further discussion of the
role of Separation color spaces in the transparent imaging model.
DeviceN Color Spaces
DeviceN color spaces (PDF 1.3) can contain an arbitrary number of color compo-
nents. They provide greater flexibility than is possible with standard device color
spaces such as DeviceCMYK or with individual Separation color spaces. For ex-
ample, it is possible to create a DeviceN color space consisting of only the cyan,
magenta, and yellow color components, with the black component excluded.
DeviceN color spaces are used in applications such as these:
High-fidelity color is the use of more than the standard CMYK process colo-
rants to produce an extended gamut, or range of colors. A popular example is
269
SECTION 4.5
Color Spaces
the PANTONE Hexachrome system, which uses six colorants: the usual cyan,
magenta, yellow, and black, plus orange and green.
Multitone color systems use a single-component image to specify multiple color
components. In a duotone, for example, a single-component image can be used
to specify both the black component and a spot color component. The tone
reproduction is generally different for the different components. For example,
the black component might be painted with the exact sample data from the sin-
gle-component image; the spot color component might be generated as a
nonlinear function of the image data in a manner that emphasizes the shadows.
Plate 6 shows an example that uses black and magenta color components. In
Plate 7, a single-component grayscale image is used to generate a quadtone re-
sult that uses four colorants: black and three PANTONE spot colors. See Exam-
ple 4.21 on page 282 for the code used to generate this image.
DeviceN was designed to represent color spaces containing multiple components
that correspond to colorants of some target device. As with Separation color
spaces, PDF consumer applications must be able to approximate the colorants if
they are not available on the current output device, such as a display. To accom-
plish this, the color space definition provides a tint transformation function that
can be used to convert all the components to an alternate color space.
PDF 1.6 extends the meaning of DeviceN to include color spaces that are referred
to as NChannel color spaces. Such color spaces may contain an arbitrary number
of spot and process components, which may or may not correspond to specific
device colorants (the process components must be from a single process color
space). They provide information about each component that allows applications
more flexibility in converting colors. For example, they may use their own blend-
ing algorithms for on-screen viewing and composite printing, rather than being
required to use a specified tint transformation function. These color spaces are
identified by a value of NChannel for the Subtype entry of the attributes dictio-
nary (see Table 4.21). A value of DeviceN for the Subtype entry, or no value,
means that only the previous features are supported. PDF consumer applications
that do not support PDF 1.6 treat these color spaces as normal DeviceN color
spaces and use the tint transformation function as appropriate. Producer applica-
tions using the NChannel features should follow certain guidelines, as noted
throughout this section, to achieve good backward compatibility.
DeviceN color spaces are defined in a similar way to Separation color spaces—in
fact, a Separation color space can be defined as a DeviceN color space with only
one component.
270
CHAPTER 4
Graphics
A DeviceN color space is specified as follows:
[ /DeviceN names alternateSpace tintTransform ]
or
[ /DeviceN names alternateSpace tintTransform attributes ]
It is a four- or five-element array whose first element is the color space family
name DeviceN. The remaining elements are parameters that a DeviceN color
space requires.
The names parameter is an array of name objects specifying the individual color
components. The length of the array determines the number of components in
the DeviceN color space, which is subject to an implementation limit; see Appen-
dix C.The component names must all be different from one another, except for
the name None, which can be repeated as described later in this section. (The
special name All, used by Separation color spaces, is not allowed.)
Color values are tint components in the range 0.0 to 1.0:
For DeviceN color spaces that do not have a subtype of NChannel, 0.0 always
represents the minimum amount of colorant; 1.0 represents the maximum.
Tints are always treated as subtractive colors, even if the device produces out-
put for the designated component by an additive method. Thus, a tint value of
0.0 denotes the lightest color that can be achieved with the given colorant, and
1.0 the darkest. (This convention is the same one as for DeviceCMYK color
components but opposite to the one for DeviceGray and DeviceRGB.)
For NChannel color spaces, values for additive process colors (such as RGB) are
specified in their natural form, where 1.0 represents maximum intensity of col-
or.
When this space is set to the current color space (using the CS or cs operators),
each component is given an initial value of 1.0. The SCN and scn operators re-
spectively set the current stroking and nonstroking color. Operand values sup-
plied to SCN or scn are interpreted as color component values in the order in
which the colors are given in the names array, as are the values in a sampled im-
age that uses a DeviceN color space.
The alternateSpace parameter is an array or name object that can be any device or
CIE-based color space but not another special color space (Pattern, Indexed,
Separation, or DeviceN). When the color space is set to a DeviceN space, if any of
271
SECTION 4.5
Color Spaces
the component names in the color space do not correspond to a colorant avail-
able on the device, the PDF consumer application can perform subsequent paint-
ing operations in the alternate color space specified by this parameter.
Note: For NChannel color spaces, the components are evaluated individually; that
is, only the ones not present on the output device use the alternate color space.
The tintTransform parameter specifies a function (see Section 3.9, “Functions”)
that is used to transform the tint values into the alternate color space. It is called
with n tint values and returns m color component values, where n is the number
of components needed to specify a color in the DeviceN color space and m is the
number required by the alternate color space.
Note: Painting in the alternate color space may produce a good approximation of
the intended color when only opaque objects are painted. However, it does not cor-
rectly represent the interactions between an object and its backdrop when the object
is painted with transparency or when overprinting (see Section 4.5.6, “Overprint
Control”) is enabled.
The color component name None, which may be present only for DeviceN color
spaces that do not have the NChannel subtype, indicates that the corresponding
color component is never painted on the page, as in a Separation color space for
the None colorant. (However, see implementation note 48 in Appendix H.) When
a DeviceN color space is painting the named device colorants directly, color com-
ponents corresponding to None colorants are discarded. However, when the
DeviceN color space reverts to its alternate color space, those components are
passed to the tint transformation function, which can use them as desired.
Note: A DeviceN color space whose component colorant names are all None always
discards its output, just the same as a Separation color space for None; it never
reverts to the alternate color space. Reversion occurs only if at least one color com-
ponent (other than None) is specified and is not available on the device.
The optional attributes parameter is a dictionary (see Table 4.21) containing addi-
tional information about the components of color space that PDF consumer ap-
plications may use. PDF consumers are not required to use the alternateSpace and
tintTransform parameters, and may instead use custom blending algorithms, along
with other information provided in the attributes dictionary if present. (If the val-
ue of the Subtype entry in the attributes dictionary is NChannel, such informa-
tion must be present.) However, alternateSpace and tintTransform must always be
provided for applications that want to use them or do not support PDF 1.6.
272
CHAPTER 4
Graphics
TABLE 4.21 Entries in a DeviceN color space attributes dictionary
KEY
TYPE
VALUE
Subtype
name
(Optional; PDF 1.6) A name specifying the preferred treatment for the color
space. Possible values are DeviceN and NChannel. Default value: DeviceN.
Colorants
dictionary
(Required if Subtype is NChannel and the color space includes spot colorants; other-
wise optional) A dictionary describing the individual colorants used in the
DeviceN color space. For each entry in this dictionary, the key is a colorant name
and the value is an array defining a Separation color space for that colorant (see
“Separation Color Spaces” on page 264). The key must match the colorant name
given in that color space.
This dictionary provides information about the individual colorants that may be
useful to some applications. In particular, the alternate color space and tint trans-
formation function of a Separation color space describe the appearance of that
colorant alone, whereas those of a DeviceN color space describe only the appear-
ance of its colorants in combination.
If Subtype is NChannel, this dictionary must have entries for all spot colorants in
this color space. This dictionary may also include additional colorants not used
by this color space.
Process
dictionary
(Required if Subtype is NChannel and the color space includes components of a pro-
cess color space, otherwise optional; PDF 1.6) A dictionary (see Table 4.22) that de-
scribes the process color space whose components are included in this color
space.
MixingHints
dictionary
(Optional; PDF 1.6) A dictionary (see Table 4.23) that specifies optional attributes
of the inks to be used in blending calculations when used as an alternative to the
tint transformation function.
A value of NChannel for the Subtype entry indicates that some of the other en-
tries in this dictionary are required rather than optional. The Colorants entry
specifies a colorants dictionary that contains entries for all the spot colorants in
the color space; they are defined using individual Separation color spaces. The
Process entry specifies a process dictionary (see Table 4.22) that identifies the pro-
cess color space that is used by this color space and the names of its components.
It must be present if Subtype is NChannel and the color space has process color
components. (An NChannel color space may contain components from at most
one process color space.)
273
SECTION 4.5
Color Spaces
For color spaces that have a value of NChannel for the Subtype entry in the at-
tributes dictionary (see Table 4.21), the following restrictions apply to process
colors:
There can be color components from at most one process color space, which
can be any device or CIE-based color space.
For a non-CMYK color space, the names of the process components must ap-
pear sequentially in the names array, in the normal color space order (for exam-
ple, Red, Green, and Blue). However, the names in the names array need not
match the actual color space names (for example, a Red component need not be
named Red).The mapping of names is specified in the process dictionary (see
Table 4.22 and discussion below), which is required to be present.
Definitions for process colorants should not appear in the colorants dictionary.
Any such definition should be ignored if the colorant is also present in the pro-
cess dictionary. Any component not specified in the process dictionary is con-
sidered to be a spot colorant.
For a CMYK color space, a subset of the components may be present, and they
may appear in any order in the names array. The reserved names Cyan,
Magenta, Yellow, and Black are always considered to be process colors, which
do not necessarily correspond to the colorants of a specific device; they are not
required to have entries in the process dictionary.
The values associated with the process components must be stored in their nat-
ural form (that is, subtractive color values for CMYK and additive color values
for RGB), since they are interpreted directly as process values by consumers
making use of the process dictionary. (For additive color spaces, this is the re-
verse of how color values are specified for DeviceN, as described above in the
discussion of the names parameter.)
The MixingHints entry in the attributes dictionary specifies a mixing hints dictio-
nary (see Table 4.23) that provides information about the characteristics of colo-
rants that can be used in blending calculations when the actual colorants are not
available on the target device. Applications are not required to use this informa-
tion.
274
CHAPTER 4
Graphics
TABLE 4.22 Entries in a DeviceN process dictionary
KEY
TYPE
VALUE
ColorSpace name or
(Required) A name or array identifying the process color space, which may be any
array
device or CIE-based color space. If an ICCBased color space is specified, it must
provide calibration information appropriate for the process color components
specified in the names array of the DeviceN color space.
Components array
(Required) An array of component names that correspond, in order, to the com-
ponents of the process color space specified in ColorSpace. For example, an RGB
color space must have three names corresponding to red, green, and blue. The
names may be arbitrary (that is, not the same as the standard names for the color
space components) and must match those specified in the names array of the
DeviceN color space, even if all components are not present in the names array.
TABLE 4.23 Entries in a DeviceN mixing hints dictionary
KEY
TYPE
VALUE
Solidities
dictionary
(Optional) A dictionary specifying the solidity of inks to be used in blending
calculations when used as an alternative to the tint transformation function.
For each entry, the key is a colorant name, and the value is a number between
0.0 and 1.0. This dictionary need not contain entries for all colorants used in
this color space; it may also include additional colorants not used by this color
space.
A value of 1.0 simulates an ink that completely covers the inks beneath; a value
of 0.0 simulates a transparent ink that completely reveals the inks beneath. An
entry with a key of Default specifies a value to be used by all components in the
associated DeviceN color space for which a solidity value is not explicitly pro-
vided. If Default is not present, the default value for unspecified colorants is
0.0; applications may choose to use other values.
If this entry is present, PrintingOrder must also be present.
PrintingOrder
array
(Required if Solidities is present) An array of colorant names, specifying the or-
der in which inks are laid down. Each component in the names array of the
DeviceN color space must appear in this array (although the order is unrelated
to the order specified in the names array). This entry may also list colorants
unused by this specific DeviceN instance.
275
SECTION 4.5
Color Spaces
KEY
TYPE
VALUE
DotGain
dictionary
(Optional) A dictionary specifying the dot gain of inks to be used in blending
calculations when used as an alternative to the tint transformation function.
Dot gain (or loss) represents the amount by which a printer’s halftone dots
change as the ink spreads and is absorbed by paper.
For each entry, the key is a colorant name, and the value is a function that maps
values in the range 0 to 1 to values in the range 0 to 1. The dictionary may list
colorants unused by this specific DeviceN instance and need not list all colo-
rants. An entry with a key of Default specifies a function to be used by all colo-
rants for which a dot gain function is not explicitly specified.
PDF consumer applications may ignore values in this dictionary when other
sources of dot gain information are available, such as ICC profiles associated
with the process color space or tint transformation functions associated with
individual colorants.
Each entry in the mixing hints dictionary refers to colorant names, which include
spot colorants referenced by the Colorants dictionary. Under some circumstanc-
es, they may also refer to one or more individual process components called
Cyan, Magenta, Yellow, or Black when DeviceCMYK is specified as the process col-
or space in the process dictionary. However, applications should ignore these pro-
cess component entries if they can obtain the information from an ICC profile.
Note: The mixing hints subdictionaries (as well as the colorants dictionary) may
specify colorants that are not used in any given instance of a DeviceN color space.
This allows them to be referenced from multiple DeviceN color spaces, which can
produce smaller file sizes as well as consistent color definitions across instances.
For consistency of color, PDF consumers should follow these guidelines:
The consumer should apply either the specified tint transformation function or
invoke the same alternative blending algorithm for all DeviceN instances in the
document.
Note: When the tint transformation function is used, the burden is on the produc-
er to guarantee that the individual function definitions chosen for all DeviceN in-
stances produce similar color appearances throughout the document.
Blending algorithms should produce a similar appearance for colors when they
are used as separation colors or as a component of a DeviceN color space.
276
CHAPTER 4
Graphics
Example 4.12 shows a DeviceN color space consisting of three color components
named Orange, Green, and None. In this example, the DeviceN color space,
object 30, has an attributes dictionary whose Colorants entry is an indirect refer-
ence to object 45 (which might also be referenced by attributes dictionaries of
other DeviceN color spaces). tintTransform1, whose definition is not shown, maps
three color components (tints of the colorants Orange, Green, and None) to four
color components in the alternate color space, DeviceCMYK. tintTransform2 maps
a single color component (an orange tint) to four components in DeviceCMYK.
Likewise, tintTransform3 maps a green tint to DeviceCMYK, and tintTransform4
maps a tint of PANTONE 131 to DeviceCMYK.
Example 4.12
30 0 obj
% Color space
[
/DeviceN
[ /Orange /Green /None ]
/DeviceCMYK
tintTransform1
<< /Colorants 45 0 R >>
]
endobj
45 0 obj
% Colorants dictionary
<< /Orange [ /Separation
/Orange
/DeviceCMYK
tintTransform2
]
/Green [ /Separation
/Green
/DeviceCMYK
tintTransform3
]
/PANTONE#20131 [ /Separation
/PANTONE#20131
/DeviceCMYK
tintTransform4
]
>>
endobj
277
SECTION 4.5
Color Spaces
Examples 4.13 through 4.16 show the use of NChannel color spaces. Example 4.13
shows the use of calibrated CMYK process components. Example 4.14 shows the
use of Lab process components.
Example 4.13
10 0 obj
% Color space
[
/DeviceN
[/Magenta /Spot1 /Yellow /Spot2]
alternateSpace
tintTransform1
<<
% Attributes dictionary
/Subtype /NChannel
/Process
<< /ColorSpace [/ICCBased CMYK_ICC profile ]
/Components [/Cyan /Magenta /Yellow /Black]
>>
/Colorants
<< /Spot1 [/Separation /Spot1 alternateSpace tintTransform2]
/Spot2 [/Separation /Spot2 alternateSpace tintTransform3]
>>
>>
]
endobj
Example 4.14
10 0 obj
% Color space
[ /DeviceN
[/L /a /b /Spot1 /Spot2]
alternateSpace
tintTransform1
<<
% Attributes dictionary
/Subtype /NChannel
/Process
<< /ColorSpace [ /Lab << /WhitePoint ... /Range ... >> ]
/Components [/L /a /b]
>>
/Colorants
<< /Spot1 [/Separation /Spot1 alternateSpace tintTransform2 ]
/Spot2 [/Separation /Spot2 alternateSpace tintTransform3]
>>
>>
]
278
CHAPTER 4
Graphics
Example 4.15 shows the recommended convention for dealing with situations
where a spot colorant and a process color component have the same name. Since
the names array may not have duplicate names, the process colors should be given
different names, which are mapped to process components in the Components
entry of the process dictionary. In this case, Red refers to a spot colorant;
ProcessRed, ProcessGreen, and ProcessBlue are mapped to the components of an
RGB color space.
Example 4.15
10 0 obj
% Color space
[ /DeviceN
[/ProcessRed /ProcessGreen /ProcessBlue /Red]
alternateSpace
tintTransform1
<<
% Attributes dictionary
/Subtype /NChannel
/Process
<< /ColorSpace [ /ICCBased RGB_ICC profile ]
/Components [/ProcessRed /ProcessGreen /ProcessBlue]
>>
/Colorants
<< /Red [/Separation /Red alternateSpace tintTransform2 ] >>
>>
]
Example 4.16 shows the use of a mixing hints dictionary.
Example 4.16
10 0 obj
% Color space
[/DeviceN
[/Magenta /Spot1 /Yellow /Spot2]
alternateSpace
tintTransform1
<<
/Subtype /NChannel
/Process
<< /ColorSpace [ /ICCBased CMYK_ICC profile ]
/Components [/Cyan /Magenta /Yellow /Black]
>>
/Colorants
<< /Spot1 [/Separation /Spot1 alternateSpace tintTransform2 ]
/Spot2 [/Separation /Spot2 alternateSpace tintTransform2 ]
279
SECTION 4.5
Color Spaces
>>
/MixingHints
<<
/Solidities
<< /Spot1 1.0
/Spot2 0.0
>>
/DotGain
<< /Spot1 function1
/Spot2 function2
/Magenta function3
/Yellow function4
>>
/PrintingOrder [/Magenta /Yellow /Spot1 /Spot2]
>>
>>
]
See Section 7.6.2, “Spot Colors and Transparency,” for further discussion of the
role of DeviceN color spaces in the transparent imaging model.
Multitone Examples
The following examples illustrate various interesting and useful special cases of
the use of Indexed and DeviceN color spaces in combination to produce multi-
tone colors.
Examples 4.17 and 4.18 illustrate the use of DeviceN to create duotone color spac-
es. In Example 4.17, an Indexed color space maps index values in the range 0 to
255 to a duotone DeviceN space in cyan and black. In effect, the index values are
treated as if they were tints of the duotone space, which are then mapped into
tints of the two underlying colorants. Only the beginning of the lookup table
string for the Indexed color space is shown; the full table would contain 256 two-
byte entries, each specifying a tint value for cyan and black, for a total of 512
bytes. If the alternate color space of the DeviceN space is selected, the tint trans-
formation function (object 15 in the example) maps the two tint components for
cyan and black to the four components for a DeviceCMYK color space by supply-
ing zero values for the other two components. Example 4.18 shows the definition
of another duotone color space, this time using black and gold colorants (where
gold is a spot colorant) and using a CalRGB space as the alternate color space. This
could be defined in the same way as in the preceding example, with a tint trans-
280
CHAPTER 4
Graphics
formation function that converts from the two tint components to colors in the
alternate CalRGB color space.
Example 4.17
10 0 obj
% Color space
[
/Indexed
[ /DeviceN
[ /Cyan /Black ]
/DeviceCMYK
15 0 R
]
255
< 6605 6806 6907 6B09 6C0A … >
]
endobj
15 0 obj
% Tint transformation function
<< /FunctionType 4
/Domain [ 0.0 1.0
0.0 1.0 ]
/Range [ 0.0 1.0
0.0
1.0
0.0
1.0
0.0 1.0 ]
/Length 16
>>
stream
{ 0
0 3 −1 roll }
endstream
endobj
Example 4.18
30 0 obj
% Color space
[
/Indexed
[
/DeviceN
[ /Black
/Gold ]
[
/CalRGB
<< /WhitePoint [ 1.0 1.0 1.0 ]
/Gamma [ 2.2 2.2 2.2 ]
>>
]
35 0 R
% Tint transformation function
]
255
… Lookup table…
]
endobj
281
SECTION 4.5
Color Spaces
Given a formula for converting any combination of black and gold tints to cali-
brated RGB, a 2-in, 3-out type 4 (PostScript calculator) function could be used for
the tint transformation. Alternatively, a type 0 (sampled) function could be used,
but this would require a large number of sample points to represent the function
accurately; for example, sampling each input variable for 256 tint values between
0.0 and 1.0 would require 256 2 = 65,536 samples. But since the DeviceN color
space is being used as the base of an Indexed color space, there are actually only
256 possible combinations of black and gold tint values. A more compact way to
represent this information is to put the alternate color values directly into the
lookup table alongside the DeviceN color values, as in Example 4.19.
Example 4.19
10 0 obj
% Color space
[
/Indexed
[
/DeviceN
[ /Black
/Gold /None /None /None ]
[
/CalRGB
<< /WhitePoint [ 1.0 1.0 1.0 ]
/Gamma [ 2.2 2.2 2.2 ]
>>
]
20 0 R
% Tint transformation function
]
255
… Lookup table…
]
endobj
In this example, each entry in the lookup table has five components: two for the
black and gold colorants and three more (specified as None) for the equivalent
CalRGB color components. If the black and gold colorants are available on the
output device, the None components are ignored; if black and gold are not
available, the tint transformation function is used to convert a five-component
color into a three-component equivalent in the alternate CalRGB color space.
But because, by construction, the third, fourth, and fifth components are the
CalRGB components, the tint transformation function can merely discard the
first two components and return the last three. This can be easily expressed
with a type 4 (PostScript calculator) function, as shown in Example 4.20.
282
CHAPTER 4
Graphics
Example 4.20
20 0 obj
% Tint transformation function
<< /FunctionType 4
/Domain [ 0.0 1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0 1.0 ]
/Range [ 0.0 1.0
0.0
1.0
0.0 1.0 ]
/Length 27
>>
stream
{ 5
3 roll pop pop }
endstream
endobj
Example 4.21 uses an extension of the techniques described above to produce the
quadtone (four-component) image shown in Plate 7.
Example 4.21
5 0 obj
% Image XObject
<< /Type /XObject
/Subtype /Image
/Width 288
/Height 288
/ColorSpace 10 0 R
/BitsPerComponent 8
/Length 105278
/Filter
/ASCII85Decode
>>
stream
… Data for grayscale image…
endstream
endobj
10 0 obj
% Indexed color space for image
[
/Indexed
15 0 R
% Base color space
255
% Table has 256 entries
30 0 R
% Lookup table
]
endobj
283
SECTION 4.5
Color Spaces
15 0 obj
% Base color space ( DeviceN ) for Indexed space
[
/DeviceN
[
/Black
% Four colorants (black plus three spot colors)
/PANTONE#20216#20CVC
/PANTONE#20409#20CVC
/PANTONE#202985#20CVC
/None
% Three components for alternate space
/None
/None
]
16 0 R
% Alternate color space
20 0 R
% Tint transformation function
]
endobj
16 0 obj
% Alternate color space for DeviceN space
[
/CalRGB
<< /WhitePoint [ 1.0 1.0 1.0 ] >>
]
endobj
20 0 obj
% Tint transformation function for DeviceN space
<< /FunctionType 4
/Domain [ 0.0 1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0 1.0 ]
/Range [ 0.0 1.0
0.0
1.0
0.0 1.0 ]
/Length 44
>>
stream
{
7 3 roll
% Just discard first four values
pop pop pop pop
}
endstream
endobj
30 0 obj
% Lookup table for Indexed color space
<< /Length 1975
/Filter
[ /ASCII85Decode /FlateDecode ]
>>
stream
8;T1BB2"M7*!"psYBt1k\gY1T<D&tO]r*F7Hga*
… Additional data ( seven components for each table entry )…
endstream
endobj
284
CHAPTER 4
Graphics
As in the preceding examples, an Indexed color space based on a DeviceN space is
used to paint the grayscale image shown on the left in the plate with four colo-
rants: black and three PANTONE spot colors. The alternate color space is a sim-
ple calibrated RGB. Thus, the DeviceN color space has seven components: the
four desired colorants plus the three components of the alternate space. The ex-
ample shows the image XObject (see Section 4.8.4, “Image Dictionaries”) repre-
senting the quadtone image, followed by the color space used to interpret the
image data. (See implementation note 49 in Appendix H.)
4.5.6
Overprint Control
The graphics state contains an overprint parameter, controlled by the OP and op
entries in a graphics state parameter dictionary. Overprint control is useful main-
ly on devices that produce true physical separations, but it is available on some
composite devices as well. Although the operation of this parameter is device-
dependent, it is described here rather than in the chapter on color rendering,
because it pertains to an aspect of painting in device color spaces that is impor-
tant to many applications.
Any painting operation marks some specific set of device colorants, depending
on the color space in which the painting takes place. In a Separation or DeviceN
color space, the colorants to be marked are specified explicitly; in a device or
CIE-based color space, they are implied by the process color model of the output
device (see Chapter 6). The overprint parameter is a boolean flag that determines
how painting operations affect colorants other than those explicitly or implicitly
specified by the current color space.
If the overprint parameter is false (the default value), painting a color in any color
space causes the corresponding areas of unspecified colorants to be erased (paint-
ed with a tint value of 0.0). The effect is that the color at any position on the page
is whatever was painted there last, which is consistent with the normal painting
behavior of the opaque imaging model.
If the overprint parameter is true and the output device supports overprinting, no
such erasing actions are performed; anything previously painted in other colo-
rants is left undisturbed. Consequently, the color at a given position on the page
may be a combined result of several painting operations in different colorants.
The effect produced by such overprinting is device-dependent and is not defined
by the PDF language.
285
SECTION 4.5
Color Spaces
Note: Not all devices support overprinting. Furthermore, many PostScript printers
support it only when separations are being produced, and not for composite output.
If overprinting is not supported, the value of the overprint parameter is ignored.
An additional graphics state parameter, the overprint mode (PDF 1.3), affects the
interpretation of a tint value of 0.0 for a color component in a DeviceCMYK color
space when overprinting is enabled. This parameter is controlled by the OPM
entry in a graphics state parameter dictionary; it has an effect only when the over-
print parameter is true, as described above.
When colors are specified in a DeviceCMYK color space and the native color space
of the output device is also DeviceCMYK, each of the source color components
controls the corresponding device colorant directly. Ordinarily, each source color
component value replaces the value previously painted for the corresponding de-
vice colorant, no matter what the new value is; this is the default behavior, speci-
fied by overprint mode 0.
When the overprint mode is 1 (also called nonzero overprint mode), a tint value of
0.0 for a source color component leaves the corresponding component of the
previously painted color unchanged. The effect is equivalent to painting in a
DeviceN color space that includes only those components whose values are non-
zero. For example, if the overprint parameter is true and the overprint mode is 1,
the operation
0. 2
0. 3
0.0
1.0 k
is equivalent to
0. 2
0. 3
1.0 scn
in the color space shown in Example 4.22.
Example 4.22
10 0 obj
% Color space
[
/DeviceN
[ /Cyan /Magenta /Black ]
/DeviceCMYK
15 0 R
]
endobj
286
CHAPTER 4
Graphics
15 0 obj
% Tint transformation function
<< /FunctionType 4
/Domain [ 0.0 1.0
0.0
1.0
0.0 1.0 ]
/Range [ 0.0 1.0
0.0
1.0
0.0
1.0
0.0 1.0 ]
/Length 13
>>
stream
{ 0 exch }
endstream
endobj
Nonzero overprint mode applies only to painting operations that use the current
color in the graphics state when the current color space is DeviceCMYK (or is im-
plicitly converted to DeviceCMYK; see “Implicit Conversion of CIE-Based Color
Spaces” on page 259). It does not apply to the painting of images or to any colors
that are the result of a computation, such as those in a shading pattern or conver-
sions from some other color space. It also does not apply if the device’s native col-
or space is not DeviceCMYK; in that case, source colors must be converted to the
device’s native color space, and all components participate in the conversion,
whatever their values. (This is shown explicitly in the alternate color space and
tint transformation function of the DeviceN color space in Example 4.22.)
See Section 7.6.3, “Overprinting and Transparency,” for further discussion of the
role of overprinting in the transparent imaging model.
4.5.7
Color Operators
Table 4.24 lists the PDF operators that control color spaces and color values. (Also
color-related is the graphics state operator ri, listed in Table 4.7 on page 219 and
discussed under “Rendering Intents” on page 260.) Color operators may appear at
the page description level or inside text objects (see Figure 4.1 on page 197).
287
SECTION 4.5
Color Spaces
TABLE 4.24 Color operators
OPERANDS
OPERATOR
DESCRIPTION
name
CS
(PDF 1.1) Set the current color space to use for stroking operations. The operand
name must be a name object. If the color space is one that can be specified by a
name and no additional parameters (DeviceGray, DeviceRGB, DeviceCMYK, and
certain cases of Pattern), the name may be specified directly. Otherwise, it must
be a name defined in the ColorSpace subdictionary of the current resource dic-
tionary (see Section 3.7.2, “Resource Dictionaries”); the associated value is an
array describing the color space (see Section 4.5.2, “Color Space Families”).
Note: The names DeviceGray, DeviceRGB, DeviceCMYK, and Pattern always iden-
tify the corresponding color spaces directly; they never refer to resources in the
ColorSpace subdictionary.
The CS operator also sets the current stroking color to its initial value, which de-
pends on the color space:
In a DeviceGray, DeviceRGB, CalGray, or CalRGB color space, the initial color
has all components equal to 0.0.
In a DeviceCMYK color space, the initial color is [ 0.0 0.0 0.0 1.0 ].
In a Lab or ICCBased color space, the initial color has all components equal to
0.0 unless that falls outside the intervals specified by the space’s Range entry,
in which case the nearest valid value is substituted.
In an Indexed color space, the initial color value is 0.
In a Separation or DeviceN color space, the initial tint value is 1.0 for all colo-
rants.
In a Pattern color space, the initial color is a pattern object that causes nothing
to be painted.
name
cs
(PDF 1.1) Same as CS but used for nonstroking operations.
c1 c
SC
(PDF 1.1) Set the color to use for stroking operations in a device, CIE-based
n
(other than ICCBased), or Indexed color space. The number of operands re-
quired and their interpretation depends on the current stroking color space:
For DeviceGray, CalGray, and Indexed color spaces, one operand is required
(n = 1).
For DeviceRGB, CalRGB, and Lab color spaces, three operands are required
(n = 3).
For DeviceCMYK, four operands are required (n = 4).
288
CHAPTER 4
Graphics
OPERANDS
OPERATOR
DESCRIPTION
c
SCN
(PDF 1.2) Same as SC but also supports Pattern, Separation, DeviceN, and
1 cn
c
name
SCN
ICCBased color spaces.
1 cn
If the current stroking color space is a Separation, DeviceN, or ICCBased color
space, the operands c
1 cn are numbers. The number of operands and their in-
terpretation depends on the color space.
If the current stroking color space is a Pattern color space, name is the name of
an entry in the Pattern subdictionary of the current resource dictionary (see
Section
3.7.2,
“Resource Dictionaries”). For an uncolored tiling pattern
(PatternType = 1 and PaintType = 2), c
1 cn are component values specifying a
color in the pattern’s underlying color space. For other types of patterns, these
operands must not be specified.
c
sc
(PDF 1.1) Same as SC but used for nonstroking operations.
1 cn
c
scn
(PDF 1.2) Same as SCN but used for nonstroking operations.
1 cn
c
name
scn
1 cn
gray
G
Set the stroking color space to DeviceGray (or the DefaultGray color space; see
“Default Color Spaces” on page 257) and set the gray level to use for stroking op-
erations. gray is a number between 0.0 (black) and 1.0 (white).
gray
g
Same as G but used for nonstroking operations.
r g b
RG
Set the stroking color space to DeviceRGB (or the DefaultRGB color space; see
“Default Color Spaces” on page 257) and set the color to use for stroking opera-
tions. Each operand must be a number between 0.0 (minimum intensity) and 1.0
(maximum intensity).
r g b
rg
Same as RG but used for nonstroking operations.
c m y k
K
Set the stroking color space to DeviceCMYK (or the DefaultCMYK color space; see
“Default Color Spaces” on page 257) and set the color to use for stroking opera-
tions. Each operand must be a number between 0.0 (zero concentration) and 1.0
(maximum concentration). The behavior of this operator is affected by the over-
print mode (see Section 4.5.6, “Overprint Control”).
c m y k
k
Same as K but used for nonstroking operations.
Invoking operators that specify colors or other color-related parameters in the
graphics state is restricted in certain circumstances. This restriction occurs when
289
SECTION 4.6
Patterns
defining graphical figures whose colors are to be specified separately each time
they are used. Specifically, the restriction applies in these circumstances:
In any glyph description that uses the d1 operator (see Section 5.5.4, “Type 3
Fonts”)
In the content stream of an uncolored tiling pattern (see “Uncolored Tiling Pat-
terns” on page 298)
In these circumstances, the following actions cause an error:
Invoking any of the following operators:
CS
scn
K
cs
G
k
SC
g
ri
SCN
RG
sh
sc
rg
Invoking the gs operator with any of the following entries in the graphics state
parameter dictionary:
TR
BG
UCR
TR2
BG2
UCR2
HT
Painting an image. However, painting an image mask (see “Stencil Masking” on
page 350) is permitted because it does not specify colors; instead, it designates
places where the current color is to be painted.
4.6
Patterns
When operators such as S (stroke), f (fill), and Tj (show text) paint an area of the
page with the current color, they ordinarily apply a single color that covers the
area uniformly. However, it is also possible to apply “paint” that consists of a re-
peating graphical figure or a smoothly varying color gradient instead of a simple
color. Such a repeating figure or smooth gradient is called a pattern. Patterns are
quite general, and have many uses; for example, they can be used to create various
graphical textures, such as weaves, brick walls, sunbursts, and similar geometrical
and chromatic effects. (See implementation note 50 in Appendix H.)

Была ли эта страница вам полезна?
Да!Нет
3 посетителя считают эту страницу полезной.
Большое спасибо!
Ваше мнение очень важно для нас.

Нет комментариевНе стесняйтесь поделиться с нами вашим ценным мнением.

Текст

Политика конфиденциальности