1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
29 class GfxAxialShading;
30 class GfxRadialShading;
35 //------------------------------------------------------------------------
37 //------------------------------------------------------------------------
48 tchkNum, // number (integer or real)
52 tchkProps, // properties (dictionary or name)
53 tchkSCN, // scn/SCN args (number of name)
54 tchkNone // used to avoid empty initializer lists
62 TchkType tchk[maxArgs];
63 void (Gfx::*func)(Object args[], int numArgs);
69 GfxResources(XRef *xref, Dict *resDict, GfxResources *nextA);
72 GfxFont *lookupFont(char *name);
73 GBool lookupXObject(char *name, Object *obj);
74 GBool lookupXObjectNF(char *name, Object *obj);
75 void lookupColorSpace(char *name, Object *obj);
76 GfxPattern *lookupPattern(char *name);
77 GfxShading *lookupShading(char *name);
78 GBool lookupGState(char *name, Object *obj);
80 GfxResources *getNext() { return next; }
86 Object colorSpaceDict;
96 // Constructor for regular output.
97 Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, double dpi,
98 PDFRectangle *box, GBool crop, PDFRectangle *cropBox, int rotate,
99 GBool printCommandsA);
101 // Constructor for a sub-page object.
102 Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
103 PDFRectangle *box, GBool crop, PDFRectangle *cropBox);
107 // Interpret a stream or array of streams.
108 void display(Object *obj, GBool topLevel = gTrue);
110 // Display an annotation, given its appearance (a Form XObject) and
111 // bounding box (in default user space).
112 void doAnnot(Object *str, double xMin, double yMin,
113 double xMax, double yMax);
115 void pushResources(Dict *resDict);
120 XRef *xref; // the xref table for this PDF file
121 OutputDev *out; // output device
122 GBool subPage; // is this a sub-page object?
123 GBool printCommands; // print the drawing commands (for debugging)
124 GfxResources *res; // resource stack
127 GfxState *state; // current graphics state
128 GBool fontChanged; // set if font or text matrix has changed
129 GfxClipType clip; // do a clip?
130 int ignoreUndef; // current BX/EX nesting level
131 double baseMatrix[6]; // default matrix for most recent
134 Parser *parser; // parser for page content stream(s)
136 static Operator opTab[]; // table of operators
138 void go(GBool topLevel);
139 void execOp(Object *cmd, Object args[], int numArgs);
140 Operator *findOp(char *name);
141 GBool checkArg(Object *arg, TchkType type);
144 // graphics state operators
145 void opSave(Object args[], int numArgs);
146 void opRestore(Object args[], int numArgs);
147 void opConcat(Object args[], int numArgs);
148 void opSetDash(Object args[], int numArgs);
149 void opSetFlat(Object args[], int numArgs);
150 void opSetLineJoin(Object args[], int numArgs);
151 void opSetLineCap(Object args[], int numArgs);
152 void opSetMiterLimit(Object args[], int numArgs);
153 void opSetLineWidth(Object args[], int numArgs);
154 void opSetExtGState(Object args[], int numArgs);
155 void opSetRenderingIntent(Object args[], int numArgs);
158 void opSetFillGray(Object args[], int numArgs);
159 void opSetStrokeGray(Object args[], int numArgs);
160 void opSetFillCMYKColor(Object args[], int numArgs);
161 void opSetStrokeCMYKColor(Object args[], int numArgs);
162 void opSetFillRGBColor(Object args[], int numArgs);
163 void opSetStrokeRGBColor(Object args[], int numArgs);
164 void opSetFillColorSpace(Object args[], int numArgs);
165 void opSetStrokeColorSpace(Object args[], int numArgs);
166 void opSetFillColor(Object args[], int numArgs);
167 void opSetStrokeColor(Object args[], int numArgs);
168 void opSetFillColorN(Object args[], int numArgs);
169 void opSetStrokeColorN(Object args[], int numArgs);
171 // path segment operators
172 void opMoveTo(Object args[], int numArgs);
173 void opLineTo(Object args[], int numArgs);
174 void opCurveTo(Object args[], int numArgs);
175 void opCurveTo1(Object args[], int numArgs);
176 void opCurveTo2(Object args[], int numArgs);
177 void opRectangle(Object args[], int numArgs);
178 void opClosePath(Object args[], int numArgs);
180 // path painting operators
181 void opEndPath(Object args[], int numArgs);
182 void opStroke(Object args[], int numArgs);
183 void opCloseStroke(Object args[], int numArgs);
184 void opFill(Object args[], int numArgs);
185 void opEOFill(Object args[], int numArgs);
186 void opFillStroke(Object args[], int numArgs);
187 void opCloseFillStroke(Object args[], int numArgs);
188 void opEOFillStroke(Object args[], int numArgs);
189 void opCloseEOFillStroke(Object args[], int numArgs);
190 void doPatternFill(GBool eoFill);
191 void opShFill(Object args[], int numArgs);
192 void doAxialShFill(GfxAxialShading *shading);
193 void doRadialShFill(GfxRadialShading *shading);
196 // path clipping operators
197 void opClip(Object args[], int numArgs);
198 void opEOClip(Object args[], int numArgs);
200 // text object operators
201 void opBeginText(Object args[], int numArgs);
202 void opEndText(Object args[], int numArgs);
204 // text state operators
205 void opSetCharSpacing(Object args[], int numArgs);
206 void opSetFont(Object args[], int numArgs);
207 void opSetTextLeading(Object args[], int numArgs);
208 void opSetTextRender(Object args[], int numArgs);
209 void opSetTextRise(Object args[], int numArgs);
210 void opSetWordSpacing(Object args[], int numArgs);
211 void opSetHorizScaling(Object args[], int numArgs);
213 // text positioning operators
214 void opTextMove(Object args[], int numArgs);
215 void opTextMoveSet(Object args[], int numArgs);
216 void opSetTextMatrix(Object args[], int numArgs);
217 void opTextNextLine(Object args[], int numArgs);
219 // text string operators
220 void opShowText(Object args[], int numArgs);
221 void opMoveShowText(Object args[], int numArgs);
222 void opMoveSetShowText(Object args[], int numArgs);
223 void opShowSpaceText(Object args[], int numArgs);
224 void doShowText(GString *s);
227 void opXObject(Object args[], int numArgs);
228 void doImage(Object *ref, Stream *str, GBool inlineImg);
229 void doForm(Object *str);
230 void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox);
232 // in-line image operators
233 void opBeginImage(Object args[], int numArgs);
234 Stream *buildImageStream();
235 void opImageData(Object args[], int numArgs);
236 void opEndImage(Object args[], int numArgs);
238 // type 3 font operators
239 void opSetCharWidth(Object args[], int numArgs);
240 void opSetCacheDevice(Object args[], int numArgs);
242 // compatibility operators
243 void opBeginIgnoreUndef(Object args[], int numArgs);
244 void opEndIgnoreUndef(Object args[], int numArgs);
246 // marked content operators
247 void opBeginMarkedContent(Object args[], int numArgs);
248 void opEndMarkedContent(Object args[], int numArgs);
249 void opMarkPoint(Object args[], int numArgs);