1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
30 class GfxTilingPattern
;
31 class GfxShadingPattern
;
33 class GfxFunctionShading
;
34 class GfxAxialShading
;
35 class GfxRadialShading
;
41 //------------------------------------------------------------------------
43 //------------------------------------------------------------------------
54 tchkNum
, // number (integer or real)
58 tchkProps
, // properties (dictionary or name)
59 tchkSCN
, // scn/SCN args (number of name)
60 tchkNone
// used to avoid empty initializer lists
68 TchkType tchk
[maxArgs
];
69 void (Gfx::*func
)(Object args
[], int numArgs
);
75 GfxResources(XRef
*xref
, Dict
*resDict
, GfxResources
*nextA
);
78 GfxFont
*lookupFont(char *name
);
79 GBool
lookupXObject(char *name
, Object
*obj
);
80 GBool
lookupXObjectNF(char *name
, Object
*obj
);
81 void lookupColorSpace(char *name
, Object
*obj
);
82 GfxPattern
*lookupPattern(char *name
);
83 GfxShading
*lookupShading(char *name
);
84 GBool
lookupGState(char *name
, Object
*obj
);
86 GfxResources
*getNext() { return next
; }
92 Object colorSpaceDict
;
102 // Constructor for regular output.
103 Gfx(XRef
*xrefA
, OutputDev
*outA
, int pageNum
, Dict
*resDict
,
104 double hDPI
, double vDPI
, PDFRectangle
*box
, GBool crop
,
105 PDFRectangle
*cropBox
, int rotate
,
106 GBool (*abortCheckCbkA
)(void *data
) = NULL
,
107 void *abortCheckCbkDataA
= NULL
);
109 // Constructor for a sub-page object.
110 Gfx(XRef
*xrefA
, OutputDev
*outA
, Dict
*resDict
,
111 PDFRectangle
*box
, GBool crop
, PDFRectangle
*cropBox
,
112 GBool (*abortCheckCbkA
)(void *data
) = NULL
,
113 void *abortCheckCbkDataA
= NULL
);
117 // Interpret a stream or array of streams.
118 void display(Object
*obj
, GBool topLevel
= gTrue
);
120 // Display an annotation, given its appearance (a Form XObject) and
121 // bounding box (in default user space).
122 void doAnnot(Object
*str
, double xMin
, double yMin
,
123 double xMax
, double yMax
);
125 // Save graphics state.
128 // Restore graphics state.
133 XRef
*xref
; // the xref table for this PDF file
134 OutputDev
*out
; // output device
135 GBool subPage
; // is this a sub-page object?
136 GBool printCommands
; // print the drawing commands (for debugging)
137 GfxResources
*res
; // resource stack
140 GfxState
*state
; // current graphics state
141 GBool fontChanged
; // set if font or text matrix has changed
142 GfxClipType clip
; // do a clip?
143 int ignoreUndef
; // current BX/EX nesting level
144 double baseMatrix
[6]; // default matrix for most recent
148 Parser
*parser
; // parser for page content stream(s)
150 GBool
// callback to check for an abort
151 (*abortCheckCbk
)(void *data
);
152 void *abortCheckCbkData
;
154 static Operator opTab
[]; // table of operators
156 void go(GBool topLevel
);
157 void execOp(Object
*cmd
, Object args
[], int numArgs
);
158 Operator
*findOp(char *name
);
159 GBool
checkArg(Object
*arg
, TchkType type
);
162 // graphics state operators
163 void opSave(Object args
[], int numArgs
);
164 void opRestore(Object args
[], int numArgs
);
165 void opConcat(Object args
[], int numArgs
);
166 void opSetDash(Object args
[], int numArgs
);
167 void opSetFlat(Object args
[], int numArgs
);
168 void opSetLineJoin(Object args
[], int numArgs
);
169 void opSetLineCap(Object args
[], int numArgs
);
170 void opSetMiterLimit(Object args
[], int numArgs
);
171 void opSetLineWidth(Object args
[], int numArgs
);
172 void opSetExtGState(Object args
[], int numArgs
);
173 void opSetRenderingIntent(Object args
[], int numArgs
);
176 void opSetFillGray(Object args
[], int numArgs
);
177 void opSetStrokeGray(Object args
[], int numArgs
);
178 void opSetFillCMYKColor(Object args
[], int numArgs
);
179 void opSetStrokeCMYKColor(Object args
[], int numArgs
);
180 void opSetFillRGBColor(Object args
[], int numArgs
);
181 void opSetStrokeRGBColor(Object args
[], int numArgs
);
182 void opSetFillColorSpace(Object args
[], int numArgs
);
183 void opSetStrokeColorSpace(Object args
[], int numArgs
);
184 void opSetFillColor(Object args
[], int numArgs
);
185 void opSetStrokeColor(Object args
[], int numArgs
);
186 void opSetFillColorN(Object args
[], int numArgs
);
187 void opSetStrokeColorN(Object args
[], int numArgs
);
189 // path segment operators
190 void opMoveTo(Object args
[], int numArgs
);
191 void opLineTo(Object args
[], int numArgs
);
192 void opCurveTo(Object args
[], int numArgs
);
193 void opCurveTo1(Object args
[], int numArgs
);
194 void opCurveTo2(Object args
[], int numArgs
);
195 void opRectangle(Object args
[], int numArgs
);
196 void opClosePath(Object args
[], int numArgs
);
198 // path painting operators
199 void opEndPath(Object args
[], int numArgs
);
200 void opStroke(Object args
[], int numArgs
);
201 void opCloseStroke(Object args
[], int numArgs
);
202 void opFill(Object args
[], int numArgs
);
203 void opEOFill(Object args
[], int numArgs
);
204 void opFillStroke(Object args
[], int numArgs
);
205 void opCloseFillStroke(Object args
[], int numArgs
);
206 void opEOFillStroke(Object args
[], int numArgs
);
207 void opCloseEOFillStroke(Object args
[], int numArgs
);
208 void doPatternFill(GBool eoFill
);
209 void doTilingPatternFill(GfxTilingPattern
*tPat
, GBool eoFill
);
210 void doShadingPatternFill(GfxShadingPattern
*sPat
, GBool eoFill
);
211 void opShFill(Object args
[], int numArgs
);
212 void doFunctionShFill(GfxFunctionShading
*shading
);
213 void doFunctionShFill1(GfxFunctionShading
*shading
,
214 double x0
, double y0
,
215 double x1
, double y1
,
216 GfxColor
*colors
, int depth
);
217 void doAxialShFill(GfxAxialShading
*shading
);
218 void doRadialShFill(GfxRadialShading
*shading
);
221 // path clipping operators
222 void opClip(Object args
[], int numArgs
);
223 void opEOClip(Object args
[], int numArgs
);
225 // text object operators
226 void opBeginText(Object args
[], int numArgs
);
227 void opEndText(Object args
[], int numArgs
);
229 // text state operators
230 void opSetCharSpacing(Object args
[], int numArgs
);
231 void opSetFont(Object args
[], int numArgs
);
232 void opSetTextLeading(Object args
[], int numArgs
);
233 void opSetTextRender(Object args
[], int numArgs
);
234 void opSetTextRise(Object args
[], int numArgs
);
235 void opSetWordSpacing(Object args
[], int numArgs
);
236 void opSetHorizScaling(Object args
[], int numArgs
);
238 // text positioning operators
239 void opTextMove(Object args
[], int numArgs
);
240 void opTextMoveSet(Object args
[], int numArgs
);
241 void opSetTextMatrix(Object args
[], int numArgs
);
242 void opTextNextLine(Object args
[], int numArgs
);
244 // text string operators
245 void opShowText(Object args
[], int numArgs
);
246 void opMoveShowText(Object args
[], int numArgs
);
247 void opMoveSetShowText(Object args
[], int numArgs
);
248 void opShowSpaceText(Object args
[], int numArgs
);
249 void doShowText(GString
*s
);
252 void opXObject(Object args
[], int numArgs
);
253 void doImage(Object
*ref
, Stream
*str
, GBool inlineImg
);
254 void doForm(Object
*str
);
255 void doForm1(Object
*str
, Dict
*resDict
, double *matrix
, double *bbox
);
257 // in-line image operators
258 void opBeginImage(Object args
[], int numArgs
);
259 Stream
*buildImageStream();
260 void opImageData(Object args
[], int numArgs
);
261 void opEndImage(Object args
[], int numArgs
);
263 // type 3 font operators
264 void opSetCharWidth(Object args
[], int numArgs
);
265 void opSetCacheDevice(Object args
[], int numArgs
);
267 // compatibility operators
268 void opBeginIgnoreUndef(Object args
[], int numArgs
);
269 void opEndIgnoreUndef(Object args
[], int numArgs
);
271 // marked content operators
272 void opBeginMarkedContent(Object args
[], int numArgs
);
273 void opEndMarkedContent(Object args
[], int numArgs
);
274 void opMarkPoint(Object args
[], int numArgs
);
276 void pushResources(Dict
*resDict
);