Graphics Programs Reference
In-Depth Information
3 0 obj Resources of current page
<<
/XObject << /X1 5 0 R >> Our XObject is called /X1
>>
endobj
5 0 obj The XObject itself
<< The XObject dictionary
/Type /XObject
/Subtype /Form
/Length 69
/BBox [0 0 792 612]
>>
stream The XObject content
2.0 w
0.5 g
250 300 m 350 400 450 500 500 300 c
450 300 350 250 y h B
endstream
endobj
Object 3 in the listing above is the page's /Resources entry. Its /XObject entry is a
dictionary listing the XObjects used in that page. We've named our XObject /X1 . Object
5 is the XObject itself. It's a stream, with the following entries in its dictionary:
• The /Type of this object is /XObject .
• The /Subtype of this XObject is /Form , distinguishing it as a form XObject.
• The /Length is the length in bytes of the stream, as usual.
• The /BBox entry gives a bounding box for the XObject, in this case the same as the
page itself.
The stream contains the code for setting up the line and width, and the shape itself.
Now, we can use the XObject from the main content stream, using the Do operator with
the XObject's name as the operand:
/X1 Do Invoke XObject /X1
0.5 0 0 0.5 0 0 cm Scale by 0.5 about the origin
/X1 Do Invoke the XObject again, at the new scale
The result is shown in Figure 5-14 .
When the Do operator is encountered, the current graphics state is saved, the /Matrix
entry (if any) from the XObject is concatenated with the CTM, the content is drawn
(clipped by the XObject's /BBox ), and the current graphics state is restored.
Image XObjects
Images are specified using separate objects, again stored in the /XObject entry in the
page's resources dictionary. They are thus separate from the graphics content stream,
and so may be reused multiple times, even across pages. To specify an image, we provide
the image data (usually compressed using one of many mechanisms such as JPEG), its
Search WWH ::




Custom Search