跳转至

8.1 概述

8.1 General

PDF内容流中使用的图形操作符描述了要在光栅输出设备上再现的页面的外观。本条款中描述的设施既适用于打印机也适用于显示应用程序。

图形操作符分为六个主要组:

  • 图形(Graphics)状态操作符操作称为图形状态的数据结构,这是其他图形操作符执行的全局框架。图形状态包括当前变换矩阵(CTM),它将PDF内容流中使用的用户空间坐标映射到输出设备坐标。它还包括当前颜色当前裁剪路径以及许多其他参数,这些参数是绘制操作符的隐式操作数。
  • 路径构造(construction)操作符指定路径,这些路径定义了形状、线条轨迹和各种区域。它们包括开始新路径、向路径添加线段和曲线以及关闭路径的操作符。
  • 路径绘制操作符(Path-painting operators)用颜色填充路径、沿路径绘制笔画或将其用作裁剪边界。
  • 其他绘制操作符(Other painting operators)绘制某些自描述的图形对象。这些包括采样图像、几何定义的渐变和整个内容流,后者又包含了一系列图形操作符序列。
  • 文本操作符(Text operators)选择并显示字体中的字符字形(用于表示文本字符的字体描述)。因为PDF将字形视为一般图形形状,许多文本操作符可以与图形状态或绘制操作符组合在一起。然而,处理字形和字体描述的数据结构和机制足够专业化,使得第9条,“文本”专注于它们。
  • 标记内容操作符(Marked-content operators)将更高级别的逻辑信息与内容流中的对象关联起来。这些信息不影响内容的渲染外观(尽管它可能决定是否应该呈现内容;见8.11,“可选内容”);它对使用PDF进行文档交换的应用程序很有用。标记内容在14.6,“标记内容”中描述。

本条款提供了关于PDF中与设备无关的图形的一般信息:PDF内容流如何描述页面的抽象外观。渲染——图形的设备依赖部分——在10条,“渲染”中介绍。参考文献列出了一些书籍,这些书籍详细介绍了这些计算机图形概念及其实现。

The graphics operators used in PDF content streams describe the appearance of pages that are to be reproduced on a raster output device. The facilities described in this clause are intended for both printer and display applications.

The graphics operators form six main groups:

  • Graphics state operators manipulate the data structure called the graphics state, the global framework within which the other graphics operators execute. The graphics state includes the current transformation matrix (CTM), which maps user space coordinates used within a PDF content stream into output device coordinates. It also includes the current colour, the current clipping path, and many other parameters that are implicit operands of the painting operators.
  • Path construction operators specify paths, which define shapes, line trajectories, and regions of various sorts. They include operators for beginning a new path, adding line segments and curves to it, and closing it.
  • Path-painting operators fill a path with a colour, paint a stroke along it, or use it as a clipping boundary.
  • Other painting operators paint certain self-describing graphics objects. These include sampled images, geometrically defined shadings, and entire content streams that in turn contain sequences of graphics operators.
  • Text operators select and show character glyphs from fonts (descriptions of typefaces for representing text characters). Because PDF treats glyphs as general graphical shapes, many of the text operators could be grouped with the graphics state or painting operators. However, the data structures and mechanisms for dealing with glyph and font descriptions are sufficiently specialized that clause 9, "Text" focuses on them.
  • Marked-content operators associate higher-level logical information with objects in the content stream. This information does not affect the rendered appearance of the content (although it may determine if the content should be presented at all; see 8.11, "Optional Content"); it is useful to applications that use PDF for document interchange. Marked content is described in 14.6, "Marked Content".

This clause presents general information about device-independent graphics in PDF: how a PDF content stream describes the abstract appearance of a page. Rendering—the device-dependent part of graphics—is covered in clause 10, "Rendering". The Bibliography lists a number of books that give details of these computer graphics concepts and their implementation.