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
;
36 class GfxGouraudTriangleShading
;
37 class GfxPatchMeshShading
;
44 //------------------------------------------------------------------------
46 //------------------------------------------------------------------------
57 tchkNum
, // number (integer or real)
61 tchkProps
, // properties (dictionary or name)
62 tchkSCN
, // scn/SCN args (number of name)
63 tchkNone
// used to avoid empty initializer lists
71 TchkType tchk
[maxArgs
];
72 void (Gfx::*func
)(Object args
[], int numArgs
);
78 GfxResources(XRef
*xref
, Dict
*resDict
, GfxResources
*nextA
);
81 GfxFont
*lookupFont(char *name
);
82 GBool
lookupXObject(char *name
, Object
*obj
);
83 GBool
lookupXObjectNF(char *name
, Object
*obj
);
84 void lookupColorSpace(char *name
, Object
*obj
);
85 GfxPattern
*lookupPattern(char *name
);
86 GfxShading
*lookupShading(char *name
);
87 GBool
lookupGState(char *name
, Object
*obj
);
89 GfxResources
*getNext() { return next
; }
95 Object colorSpaceDict
;
105 // Constructor for regular output.
106 Gfx(XRef
*xrefA
, OutputDev
*outA
, int pageNum
, Dict
*resDict
,
107 double hDPI
, double vDPI
, PDFRectangle
*box
,
108 PDFRectangle
*cropBox
, int rotate
,
109 GBool (*abortCheckCbkA
)(void *data
) = NULL
,
110 void *abortCheckCbkDataA
= NULL
);
112 // Constructor for a sub-page object.
113 Gfx(XRef
*xrefA
, OutputDev
*outA
, Dict
*resDict
,
114 PDFRectangle
*box
, PDFRectangle
*cropBox
,
115 GBool (*abortCheckCbkA
)(void *data
) = NULL
,
116 void *abortCheckCbkDataA
= NULL
);
120 // Interpret a stream or array of streams.
121 void display(Object
*obj
, GBool topLevel
= gTrue
);
123 // Display an annotation, given its appearance (a Form XObject) and
124 // bounding box (in default user space).
125 void doAnnot(Object
*str
, double xMin
, double yMin
,
126 double xMax
, double yMax
);
128 // Save graphics state.
131 // Restore graphics state.
134 // Get the current graphics state object.
135 GfxState
*getState() { return state
; }
139 XRef
*xref
; // the xref table for this PDF file
140 OutputDev
*out
; // output device
141 GBool subPage
; // is this a sub-page object?
142 GBool printCommands
; // print the drawing commands (for debugging)
143 GfxResources
*res
; // resource stack
146 GfxState
*state
; // current graphics state
147 GBool fontChanged
; // set if font or text matrix has changed
148 GfxClipType clip
; // do a clip?
149 int ignoreUndef
; // current BX/EX nesting level
150 double baseMatrix
[6]; // default matrix for most recent
154 Parser
*parser
; // parser for page content stream(s)
156 GBool
// callback to check for an abort
157 (*abortCheckCbk
)(void *data
);
158 void *abortCheckCbkData
;
159 GBool renderThisPage
; // Render this page?
161 static Operator opTab
[]; // table of operators
163 void go(GBool topLevel
);
164 void execOp(Object
*cmd
, Object args
[], int numArgs
);
165 Operator
*findOp(char *name
);
166 GBool
checkArg(Object
*arg
, TchkType type
);
169 // graphics state operators
170 void opSave(Object args
[], int numArgs
);
171 void opRestore(Object args
[], int numArgs
);
172 void opConcat(Object args
[], int numArgs
);
173 void opSetDash(Object args
[], int numArgs
);
174 void opSetFlat(Object args
[], int numArgs
);
175 void opSetLineJoin(Object args
[], int numArgs
);
176 void opSetLineCap(Object args
[], int numArgs
);
177 void opSetMiterLimit(Object args
[], int numArgs
);
178 void opSetLineWidth(Object args
[], int numArgs
);
179 void opSetExtGState(Object args
[], int numArgs
);
180 void opSetRenderingIntent(Object args
[], int numArgs
);
183 void opSetFillGray(Object args
[], int numArgs
);
184 void opSetStrokeGray(Object args
[], int numArgs
);
185 void opSetFillCMYKColor(Object args
[], int numArgs
);
186 void opSetStrokeCMYKColor(Object args
[], int numArgs
);
187 void opSetFillRGBColor(Object args
[], int numArgs
);
188 void opSetStrokeRGBColor(Object args
[], int numArgs
);
189 void opSetFillColorSpace(Object args
[], int numArgs
);
190 void opSetStrokeColorSpace(Object args
[], int numArgs
);
191 void opSetFillColor(Object args
[], int numArgs
);
192 void opSetStrokeColor(Object args
[], int numArgs
);
193 void opSetFillColorN(Object args
[], int numArgs
);
194 void opSetStrokeColorN(Object args
[], int numArgs
);
196 // path segment operators
197 void opMoveTo(Object args
[], int numArgs
);
198 void opLineTo(Object args
[], int numArgs
);
199 void opCurveTo(Object args
[], int numArgs
);
200 void opCurveTo1(Object args
[], int numArgs
);
201 void opCurveTo2(Object args
[], int numArgs
);
202 void opRectangle(Object args
[], int numArgs
);
203 void opClosePath(Object args
[], int numArgs
);
205 // path painting operators
206 void opEndPath(Object args
[], int numArgs
);
207 void opStroke(Object args
[], int numArgs
);
208 void opCloseStroke(Object args
[], int numArgs
);
209 void opFill(Object args
[], int numArgs
);
210 void opEOFill(Object args
[], int numArgs
);
211 void opFillStroke(Object args
[], int numArgs
);
212 void opCloseFillStroke(Object args
[], int numArgs
);
213 void opEOFillStroke(Object args
[], int numArgs
);
214 void opCloseEOFillStroke(Object args
[], int numArgs
);
215 void doPatternFill(GBool eoFill
);
216 void doTilingPatternFill(GfxTilingPattern
*tPat
, GBool eoFill
);
217 void doShadingPatternFill(GfxShadingPattern
*sPat
, GBool eoFill
);
218 void opShFill(Object args
[], int numArgs
);
219 void doFunctionShFill(GfxFunctionShading
*shading
);
220 void doFunctionShFill1(GfxFunctionShading
*shading
,
221 double x0
, double y0
,
222 double x1
, double y1
,
223 GfxColor
*colors
, int depth
);
224 void doAxialShFill(GfxAxialShading
*shading
);
225 void doRadialShFill(GfxRadialShading
*shading
);
226 void doGouraudTriangleShFill(GfxGouraudTriangleShading
*shading
);
227 void gouraudFillTriangle(double x0
, double y0
, GfxColor
*color0
,
228 double x1
, double y1
, GfxColor
*color1
,
229 double x2
, double y2
, GfxColor
*color2
,
230 int nComps
, int depth
);
231 void doPatchMeshShFill(GfxPatchMeshShading
*shading
);
232 void fillPatch(GfxPatch
*patch
, int nComps
, int depth
);
235 // path clipping operators
236 void opClip(Object args
[], int numArgs
);
237 void opEOClip(Object args
[], int numArgs
);
239 // text object operators
240 void opBeginText(Object args
[], int numArgs
);
241 void opEndText(Object args
[], int numArgs
);
243 // text state operators
244 void opSetCharSpacing(Object args
[], int numArgs
);
245 void opSetFont(Object args
[], int numArgs
);
246 void opSetTextLeading(Object args
[], int numArgs
);
247 void opSetTextRender(Object args
[], int numArgs
);
248 void opSetTextRise(Object args
[], int numArgs
);
249 void opSetWordSpacing(Object args
[], int numArgs
);
250 void opSetHorizScaling(Object args
[], int numArgs
);
252 // text positioning operators
253 void opTextMove(Object args
[], int numArgs
);
254 void opTextMoveSet(Object args
[], int numArgs
);
255 void opSetTextMatrix(Object args
[], int numArgs
);
256 void opTextNextLine(Object args
[], int numArgs
);
258 // text string operators
259 void opShowText(Object args
[], int numArgs
);
260 void opMoveShowText(Object args
[], int numArgs
);
261 void opMoveSetShowText(Object args
[], int numArgs
);
262 void opShowSpaceText(Object args
[], int numArgs
);
263 void doShowText(GString
*s
);
266 void opXObject(Object args
[], int numArgs
);
267 void doImage(Object
*ref
, Stream
*str
, GBool inlineImg
);
268 void doForm(Object
*str
);
269 void doForm1(Object
*str
, Dict
*resDict
, double *matrix
, double *bbox
);
271 // in-line image operators
272 void opBeginImage(Object args
[], int numArgs
);
273 Stream
*buildImageStream();
274 void opImageData(Object args
[], int numArgs
);
275 void opEndImage(Object args
[], int numArgs
);
277 // type 3 font operators
278 void opSetCharWidth(Object args
[], int numArgs
);
279 void opSetCacheDevice(Object args
[], int numArgs
);
281 // compatibility operators
282 void opBeginIgnoreUndef(Object args
[], int numArgs
);
283 void opEndIgnoreUndef(Object args
[], int numArgs
);
285 // marked content operators
286 void opBeginMarkedContent(Object args
[], int numArgs
);
287 void opEndMarkedContent(Object args
[], int numArgs
);
288 void opMarkPoint(Object args
[], int numArgs
);
290 void pushResources(Dict
*resDict
);