X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FGfx.h;h=20898ec8cedcf8cb989e51872d05cd88bc002a95;hb=ad63666daeeda50acc7630132d61fe044634fddd;hp=e1dc3d4e692ea127588f23d8acbfc41a4f15cacd;hpb=d9f9a6449f377b4c933b75d57541b19c6d088994;p=evince.git diff --git a/pdf/xpdf/Gfx.h b/pdf/xpdf/Gfx.h index e1dc3d4e..20898ec8 100644 --- a/pdf/xpdf/Gfx.h +++ b/pdf/xpdf/Gfx.h @@ -2,20 +2,24 @@ // // Gfx.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef GFX_H #define GFX_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif #include "gtypes.h" +#include "Object.h" class GString; +class XRef; class Array; class Stream; class Parser; @@ -23,9 +27,17 @@ class Dict; class OutputDev; class GfxFontDict; class GfxFont; -struct GfxFontEncoding16; +class GfxPattern; +class GfxTilingPattern; +class GfxShadingPattern; +class GfxShading; +class GfxFunctionShading; +class GfxAxialShading; +class GfxRadialShading; class GfxState; +class GfxColor; class Gfx; +class PDFRectangle; //------------------------------------------------------------------------ // Gfx @@ -61,12 +73,27 @@ struct Operator { class GfxResources { public: - GfxResources(GfxResources *next1) { next = next1; } + GfxResources(XRef *xref, Dict *resDict, GfxResources *nextA); ~GfxResources(); + GfxFont *lookupFont(char *name); + GBool lookupXObject(char *name, Object *obj); + GBool lookupXObjectNF(char *name, Object *obj); + void lookupColorSpace(char *name, Object *obj); + GfxPattern *lookupPattern(char *name); + GfxShading *lookupShading(char *name); + GBool lookupGState(char *name, Object *obj); + + GfxResources *getNext() { return next; } + +private: + GfxFontDict *fonts; Object xObjDict; Object colorSpaceDict; + Object patternDict; + Object shadingDict; + Object gStateDict; GfxResources *next; }; @@ -74,39 +101,64 @@ class Gfx { public: // Constructor for regular output. - Gfx(OutputDev *out1, int pageNum, Dict *resDict, - int dpi, double x1, double y1, double x2, double y2, GBool crop, - double cropX1, double cropY1, double cropX2, double cropY2, - int rotate); + Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, + double hDPI, double vDPI, PDFRectangle *box, GBool crop, + PDFRectangle *cropBox, int rotate, + GBool (*abortCheckCbkA)(void *data) = NULL, + void *abortCheckCbkDataA = NULL); + + // Constructor for a sub-page object. + Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict, + PDFRectangle *box, GBool crop, PDFRectangle *cropBox, + GBool (*abortCheckCbkA)(void *data) = NULL, + void *abortCheckCbkDataA = NULL); - // Destructor. ~Gfx(); // Interpret a stream or array of streams. - void display(Object *obj); + void display(Object *obj, GBool topLevel = gTrue); + + // Display an annotation, given its appearance (a Form XObject) and + // bounding box (in default user space). + void doAnnot(Object *str, double xMin, double yMin, + double xMax, double yMax); + + // Save graphics state. + void saveState(); + + // Restore graphics state. + void restoreState(); private: + XRef *xref; // the xref table for this PDF file OutputDev *out; // output device + GBool subPage; // is this a sub-page object? + GBool printCommands; // print the drawing commands (for debugging) GfxResources *res; // resource stack + int updateLevel; GfxState *state; // current graphics state GBool fontChanged; // set if font or text matrix has changed GfxClipType clip; // do a clip? int ignoreUndef; // current BX/EX nesting level + double baseMatrix[6]; // default matrix for most recent + // page/form/pattern + int formDepth; Parser *parser; // parser for page content stream(s) + GBool // callback to check for an abort + (*abortCheckCbk)(void *data); + void *abortCheckCbkData; + static Operator opTab[]; // table of operators - void go(); + void go(GBool topLevel); void execOp(Object *cmd, Object args[], int numArgs); Operator *findOp(char *name); GBool checkArg(Object *arg, TchkType type); int getPos(); - GfxFont *lookupFont(char *name); - GBool lookupXObject(char *name, Object *obj); - void lookupColorSpace(char *name, Object *obj); // graphics state operators void opSave(Object args[], int numArgs); @@ -119,6 +171,7 @@ private: void opSetMiterLimit(Object args[], int numArgs); void opSetLineWidth(Object args[], int numArgs); void opSetExtGState(Object args[], int numArgs); + void opSetRenderingIntent(Object args[], int numArgs); // color operators void opSetFillGray(Object args[], int numArgs); @@ -153,6 +206,17 @@ private: void opCloseFillStroke(Object args[], int numArgs); void opEOFillStroke(Object args[], int numArgs); void opCloseEOFillStroke(Object args[], int numArgs); + void doPatternFill(GBool eoFill); + void doTilingPatternFill(GfxTilingPattern *tPat, GBool eoFill); + void doShadingPatternFill(GfxShadingPattern *sPat, GBool eoFill); + void opShFill(Object args[], int numArgs); + void doFunctionShFill(GfxFunctionShading *shading); + void doFunctionShFill1(GfxFunctionShading *shading, + double x0, double y0, + double x1, double y1, + GfxColor *colors, int depth); + void doAxialShFill(GfxAxialShading *shading); + void doRadialShFill(GfxRadialShading *shading); void doEndPath(); // path clipping operators @@ -184,12 +248,12 @@ private: void opMoveSetShowText(Object args[], int numArgs); void opShowSpaceText(Object args[], int numArgs); void doShowText(GString *s); - int getNextChar16(GfxFontEncoding16 *enc, Guchar *p, int *c16); // XObject operators void opXObject(Object args[], int numArgs); - void doImage(Stream *str, GBool inlineImg); + void doImage(Object *ref, Stream *str, GBool inlineImg); void doForm(Object *str); + void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox); // in-line image operators void opBeginImage(Object args[], int numArgs); @@ -209,6 +273,9 @@ private: void opBeginMarkedContent(Object args[], int numArgs); void opEndMarkedContent(Object args[], int numArgs); void opMarkPoint(Object args[], int numArgs); + + void pushResources(Dict *resDict); + void popResources(); }; #endif