跳转至

10.1 概述

10.1 General

几乎所有受PDF文件控制的渲染功能都涉及颜色的再现。符合标准的阅读器应使用以下多步流程来渲染颜色。

注意 1

PDF图像模型将图形(形状和颜色的指定)与渲染(控制光栅输出设备)分离。8.6.3“颜色空间系列”中的图20和图21说明了这种划分。8“图形”描述了一种设备无关的方式来指定页面的外观。本条款描述了用于控制形状和颜色如何在光栅输出设备上渲染的功能。此处讨论的所有功能都依赖于输出设备的具体特性。旨在与设备无关的PDF文件应仅限于使用8“图形”中描述的一般图形功能。

根据当前颜色空间和设备特性,并不总是需要执行所有步骤:

a) 如果颜色是在基于CIE的颜色空间(参见8.6.5“基于CIE的颜色空间”)中指定的,则首先应将其转换为光栅输出设备的本机颜色空间(也称为其工艺颜色模型)。

b) 如果颜色是在设备颜色空间中指定的,而该颜色空间不适用于输出设备(例如,在CMYK或灰度设备上使用RGB颜色),则应调用颜色转换函数

c) 设备颜色值应通过传递函数进行映射,每个颜色分量对应一个传递函数。

注意 2

传递函数用于补偿输出设备的特性,例如非线性的灰度响应。此步骤有时称为伽马校正

d) 如果设备无法再现连续色调,而只能显示某些离散颜色(如黑白像素),则应调用半色调函数,通过像素模式来逼近所需颜色。

e) 最后,应执行扫描转换,在光栅输出设备上标记适当的像素并应用所请求的颜色。

当对页面上的所有图形对象执行完这些操作后,生成的光栅数据将用于标记物理输出介质,例如显示屏上的像素或打印页面上的墨迹。PDF文件可能对物理介质的属性几乎没有规定;符合标准的阅读器可以从以下来源获取相关信息:

  • 页面字典中的媒体框及其他几个条目(参见14.11.2“页面边界”)。
  • 当用户请求查看或打印时进行的交互对话。
  • 作业票据(job ticket),可嵌入PDF文件或单独提供,用于指定PDF页面在介质上的布局以及控制输出设备的特殊功能。作业票据的格式有多种标准,其中两种是JDF(作业定义格式)和PJTF(可移植作业票据格式),它们分别在CIP4文档《JDF规范》和Adobe技术笔记#5620《可移植作业票据格式》(参见参考文献)中有所描述。

8.4.5“图形状态参数字典”中的表58列出了可用于控制某些渲染方面的各种设备相关图形状态参数。要调用这些参数,应使用gs操作符。

Nearly all of the rendering facilities that are under the control of a PDF file pertain to the reproduction of colour. Colours shall be rendered by a conforming reader using the following multiple-step process outlined.

NOTE 1

The PDF imaging model separates graphics (the specification of shapes and colours) from rendering (controlling a raster output device). Figures 20 and 21 in 8.6.3, "Colour Space Families" illustrate this division. 8, "Graphics" describes the facilities for specifying the appearance of pages in a device-independent way. This clause describes the facilities for controlling how shapes and colours are rendered on the raster output device. All of the facilities discussed here depend on the specific characteristics of the output device. PDF files that are intended to be device-independent should limit themselves to the general graphics facilities described in 8, "Graphics".

Depending on the current colour space and on the characteristics of the device, it is not always necessary to perform every step.

a) If a colour has been specified in a CIE-based colour space (see 8.6.5, "CIE-Based Colour Spaces"), it shall first be transformed to the native colour space of the raster output device (also called its process colour model).

b) If a colour has been specified in a device colour space that is inappropriate for the output device (for example, RGB colour with a CMYK or grayscale device), a colour conversion function shall be invoked.

c) The device colour values shall now be mapped through transfer functions, one for each colour component.

NOTE 2

The transfer functions compensate for peculiarities of the output device, such as nonlinear gray-level response. This step is sometimes called gamma correction.

d) If the device cannot reproduce continuous tones, but only certain discrete colours such as black and white pixels, a halftone function shall be invoked, which approximates the desired colours by means of patterns of pixels.

e) Finally, scan conversion shall be performed to mark the appropriate pixels of the raster output device with the requested colours.

Once these operations have been performed for all graphics objects on the page, the resulting raster data shall be used to mark the physical output medium, such as pixels on a display or ink on a printed page. A PDF file may specify very little about the properties of the physical medium on which the output will be produced; that information may be obtained from the following sources by a conforming reader:

  • The media box and a few other entries in the page dictionary (see 14.11.2, "Page Boundaries").
  • An interactive dialogue conducted when the user requests viewing or printing.
  • A job ticket, either embedded in the PDF file or provided separately, that may specify detailed instructions for imposing PDF pages onto media and for controlling special features of the output device. Various standards exist for the format of job tickets. Two of them, JDF (Job Definition Format) and PJTF (Portable Job Ticket Format), are described in the CIP4 document JDF Specification and in Adobe Technical Note #5620, Portable Job Ticket Format (see the Bibliography), respectively.

Table 58 in 8.4.5, "Graphics State Parameter Dictionaries" lists the various device-dependent graphics state parameters that may be used to control certain aspects of rendering. To invoke these parameters, the gs operator shall be used.