1 //========================================================================
5 // Copyright 1996 Derek B. Noonburg
7 //========================================================================
26 struct GfxFontEncoding16;
31 //------------------------------------------------------------------------
33 //------------------------------------------------------------------------
44 tchkNum, // number (integer or real)
48 tchkProps, // properties (dictionary or name)
49 tchkSCN, // scn/SCN args (number of name)
50 tchkNone // used to avoid empty initializer lists
58 TchkType tchk[maxArgs];
59 void (Gfx::*func)(Object args[], int numArgs);
65 GfxResources(Dict *resDict, GfxResources *next);
68 GfxFont *lookupFont(char *name);
69 GBool lookupXObject(char *name, Object *obj);
70 GBool lookupXObjectNF(char *name, Object *obj);
71 void lookupColorSpace(char *name, Object *obj);
72 GfxPattern *lookupPattern(char *name);
73 GBool lookupGState(char *name, Object *obj);
75 GfxResources *getNext() { return next; }
81 Object colorSpaceDict;
90 // Constructor for regular output.
91 Gfx(OutputDev *out1, int pageNum, Dict *resDict,
92 double dpi, double x1, double y1, double x2, double y2, GBool crop,
93 double cropX1, double cropY1, double cropX2, double cropY2,
99 // Interpret a stream or array of streams.
100 void display(Object *obj, GBool topLevel = gTrue);
102 void doWidgetForm(Object *str, double xMin, double yMin,
103 double xMax, double yMax);
107 OutputDev *out; // output device
108 GfxResources *res; // resource stack
110 GfxState *state; // current graphics state
111 GBool fontChanged; // set if font or text matrix has changed
112 GfxClipType clip; // do a clip?
113 int ignoreUndef; // current BX/EX nesting level
114 double baseMatrix[6]; // default matrix for most recent
117 Parser *parser; // parser for page content stream(s)
119 static Operator opTab[]; // table of operators
121 void go(GBool topLevel);
122 void execOp(Object *cmd, Object args[], int numArgs);
123 Operator *findOp(char *name);
124 GBool checkArg(Object *arg, TchkType type);
127 // graphics state operators
128 void opSave(Object args[], int numArgs);
129 void opRestore(Object args[], int numArgs);
130 void opConcat(Object args[], int numArgs);
131 void opSetDash(Object args[], int numArgs);
132 void opSetFlat(Object args[], int numArgs);
133 void opSetLineJoin(Object args[], int numArgs);
134 void opSetLineCap(Object args[], int numArgs);
135 void opSetMiterLimit(Object args[], int numArgs);
136 void opSetLineWidth(Object args[], int numArgs);
137 void opSetExtGState(Object args[], int numArgs);
138 void opSetRenderingIntent(Object args[], int numArgs);
141 void opSetFillGray(Object args[], int numArgs);
142 void opSetStrokeGray(Object args[], int numArgs);
143 void opSetFillCMYKColor(Object args[], int numArgs);
144 void opSetStrokeCMYKColor(Object args[], int numArgs);
145 void opSetFillRGBColor(Object args[], int numArgs);
146 void opSetStrokeRGBColor(Object args[], int numArgs);
147 void opSetFillColorSpace(Object args[], int numArgs);
148 void opSetStrokeColorSpace(Object args[], int numArgs);
149 void opSetFillColor(Object args[], int numArgs);
150 void opSetStrokeColor(Object args[], int numArgs);
151 void opSetFillColorN(Object args[], int numArgs);
152 void opSetStrokeColorN(Object args[], int numArgs);
154 // path segment operators
155 void opMoveTo(Object args[], int numArgs);
156 void opLineTo(Object args[], int numArgs);
157 void opCurveTo(Object args[], int numArgs);
158 void opCurveTo1(Object args[], int numArgs);
159 void opCurveTo2(Object args[], int numArgs);
160 void opRectangle(Object args[], int numArgs);
161 void opClosePath(Object args[], int numArgs);
163 // path painting operators
164 void opEndPath(Object args[], int numArgs);
165 void opStroke(Object args[], int numArgs);
166 void opCloseStroke(Object args[], int numArgs);
167 void opFill(Object args[], int numArgs);
168 void opEOFill(Object args[], int numArgs);
169 void opFillStroke(Object args[], int numArgs);
170 void opCloseFillStroke(Object args[], int numArgs);
171 void opEOFillStroke(Object args[], int numArgs);
172 void opCloseEOFillStroke(Object args[], int numArgs);
173 void opShFill(Object args[], int numArgs);
174 void doPatternFill(GBool eoFill);
177 // path clipping operators
178 void opClip(Object args[], int numArgs);
179 void opEOClip(Object args[], int numArgs);
181 // text object operators
182 void opBeginText(Object args[], int numArgs);
183 void opEndText(Object args[], int numArgs);
185 // text state operators
186 void opSetCharSpacing(Object args[], int numArgs);
187 void opSetFont(Object args[], int numArgs);
188 void opSetTextLeading(Object args[], int numArgs);
189 void opSetTextRender(Object args[], int numArgs);
190 void opSetTextRise(Object args[], int numArgs);
191 void opSetWordSpacing(Object args[], int numArgs);
192 void opSetHorizScaling(Object args[], int numArgs);
194 // text positioning operators
195 void opTextMove(Object args[], int numArgs);
196 void opTextMoveSet(Object args[], int numArgs);
197 void opSetTextMatrix(Object args[], int numArgs);
198 void opTextNextLine(Object args[], int numArgs);
200 // text string operators
201 void opShowText(Object args[], int numArgs);
202 void opMoveShowText(Object args[], int numArgs);
203 void opMoveSetShowText(Object args[], int numArgs);
204 void opShowSpaceText(Object args[], int numArgs);
205 void doShowText(GString *s);
206 int getNextChar16(GfxFontEncoding16 *enc, Guchar *p, int *c16);
209 void opXObject(Object args[], int numArgs);
210 void doImage(Object *ref, Stream *str, GBool inlineImg);
211 void doForm(Object *str);
212 void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox);
214 // in-line image operators
215 void opBeginImage(Object args[], int numArgs);
216 Stream *buildImageStream();
217 void opImageData(Object args[], int numArgs);
218 void opEndImage(Object args[], int numArgs);
220 // type 3 font operators
221 void opSetCharWidth(Object args[], int numArgs);
222 void opSetCacheDevice(Object args[], int numArgs);
224 // compatibility operators
225 void opBeginIgnoreUndef(Object args[], int numArgs);
226 void opEndIgnoreUndef(Object args[], int numArgs);
228 // marked content operators
229 void opBeginMarkedContent(Object args[], int numArgs);
230 void opEndMarkedContent(Object args[], int numArgs);
231 void opMarkPoint(Object args[], int numArgs);