LCOV - code coverage report
Current view: directory - home/even/poppler-git/install/include/poppler - OutputDev.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 41 13 31.7 %
Date: 2013-03-30 Functions: 36 12 33.3 %

       1                 : //========================================================================
       2                 : //
       3                 : // OutputDev.h
       4                 : //
       5                 : // Copyright 1996-2003 Glyph & Cog, LLC
       6                 : //
       7                 : //========================================================================
       8                 : 
       9                 : //========================================================================
      10                 : //
      11                 : // Modified under the Poppler project - http://poppler.freedesktop.org
      12                 : //
      13                 : // All changes made under the Poppler project to this file are licensed
      14                 : // under GPL version 2 or later
      15                 : //
      16                 : // Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
      17                 : // Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no>
      18                 : // Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net>
      19                 : // Copyright (C) 2007, 2011 Adrian Johnson <ajohnson@redneon.com>
      20                 : // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
      21                 : // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
      22                 : // Copyright (C) 2009, 2012 Albert Astals Cid <aacid@kde.org>
      23                 : // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
      24                 : // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
      25                 : // Copyright (C) 2012 William Bader <williambader@hotmail.com>
      26                 : //
      27                 : // To see a description of the changes please see the Changelog file that
      28                 : // came with your tarball or type make ChangeLog if you are building from git
      29                 : //
      30                 : //========================================================================
      31                 : 
      32                 : #ifndef OUTPUTDEV_H
      33                 : #define OUTPUTDEV_H
      34                 : 
      35                 : #ifdef USE_GCC_PRAGMAS
      36                 : #pragma interface
      37                 : #endif
      38                 : 
      39                 : #include "poppler-config.h"
      40                 : #include "goo/gtypes.h"
      41                 : #include "CharTypes.h"
      42                 : #include "Object.h"
      43                 : 
      44                 : class Annot;
      45                 : class Dict;
      46                 : class GooHash;
      47                 : class GooString;
      48                 : class GfxState;
      49                 : class Gfx;
      50                 : struct GfxColor;
      51                 : class GfxColorSpace;
      52                 : class GfxImageColorMap;
      53                 : class GfxFunctionShading;
      54                 : class GfxAxialShading;
      55                 : class GfxGouraudTriangleShading;
      56                 : class GfxPatchMeshShading;
      57                 : class GfxRadialShading;
      58                 : class GfxGouraudTriangleShading;
      59                 : class GfxPatchMeshShading;
      60                 : class Stream;
      61                 : class Links;
      62                 : class AnnotLink;
      63                 : class Catalog;
      64                 : class Page;
      65                 : class Function;
      66                 : 
      67                 : //------------------------------------------------------------------------
      68                 : // OutputDev
      69                 : //------------------------------------------------------------------------
      70                 : 
      71                 : class OutputDev {
      72                 : public:
      73                 : 
      74                 :   // Constructor.
      75                 :   OutputDev() { profileHash = NULL; }
      76                 : 
      77                 :   // Destructor.
      78                 :   virtual ~OutputDev() {}
      79                 : 
      80                 :   //----- get info about output device
      81                 : 
      82                 :   // Does this device use upside-down coordinates?
      83                 :   // (Upside-down means (0,0) is the top left corner of the page.)
      84                 :   virtual GBool upsideDown() = 0;
      85                 : 
      86                 :   // Does this device use drawChar() or drawString()?
      87                 :   virtual GBool useDrawChar() = 0;
      88                 : 
      89                 :   // Does this device use tilingPatternFill()?  If this returns false,
      90                 :   // tiling pattern fills will be reduced to a series of other drawing
      91                 :   // operations.
      92                 :   virtual GBool useTilingPatternFill() { return gFalse; }
      93                 : 
      94                 :   // Does this device support specific shading types?
      95                 :   // see gouraudTriangleShadedFill() and patchMeshShadedFill()
      96                 :   virtual GBool useShadedFills(int type) { return gFalse; }
      97                 : 
      98                 :   // Does this device use FillColorStop()?
      99               0 :   virtual GBool useFillColorStop() { return gFalse; }
     100                 : 
     101                 :   // Does this device use drawForm()?  If this returns false,
     102                 :   // form-type XObjects will be interpreted (i.e., unrolled).
     103              16 :   virtual GBool useDrawForm() { return gFalse; }
     104                 : 
     105                 :   // Does this device use beginType3Char/endType3Char?  Otherwise,
     106                 :   // text in Type 3 fonts will be drawn with drawChar/drawString.
     107                 :   virtual GBool interpretType3Chars() = 0;
     108                 : 
     109                 :   // Does this device need non-text content?
     110              90 :   virtual GBool needNonText() { return gTrue; }
     111                 : 
     112                 :   // Does this device require incCharCount to be called for text on
     113                 :   // non-shown layers?
     114             820 :   virtual GBool needCharCount() { return gFalse; }
     115                 :   
     116                 :   // Does this device need to clip pages to the crop box even when the
     117                 :   // box is the crop box?
     118              46 :   virtual GBool needClipToCropBox() { return gFalse; }
     119                 : 
     120                 :   //----- initialization and control
     121                 : 
     122                 :   // Set default transform matrix.
     123                 :   virtual void setDefaultCTM(double *ctm);
     124                 : 
     125                 :   // Check to see if a page slice should be displayed.  If this
     126                 :   // returns false, the page display is aborted.  Typically, an
     127                 :   // OutputDev will use some alternate means to display the page
     128                 :   // before returning false.
     129              48 :   virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
     130                 :              int rotate, GBool useMediaBox, GBool crop,
     131                 :              int sliceX, int sliceY, int sliceW, int sliceH,
     132                 :              GBool printing,
     133                 :              GBool (* abortCheckCbk)(void *data) = NULL,
     134                 :              void * abortCheckCbkData = NULL,
     135                 :              GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
     136                 :              void *annotDisplayDecideCbkData = NULL)
     137              48 :     { return gTrue; }
     138                 : 
     139                 :   // Start a page.
     140                 :   virtual void startPage(int pageNum, GfxState *state, XRef *xref) {}
     141                 : 
     142                 :   // End a page.
     143                 :   virtual void endPage() {}
     144                 : 
     145                 :   // Dump page contents to display.
     146              49 :   virtual void dump() {}
     147                 : 
     148                 :   //----- coordinate conversion
     149                 : 
     150                 :   // Convert between device and user coordinates.
     151                 :   virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
     152                 :   virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
     153                 : 
     154                 :   double *getDefCTM() { return defCTM; }
     155                 :   double *getDefICTM() { return defICTM; }
     156                 : 
     157                 :   //----- save/restore graphics state
     158                 :   virtual void saveState(GfxState * /*state*/) {}
     159                 :   virtual void restoreState(GfxState * /*state*/) {}
     160                 : 
     161                 :   //----- update graphics state
     162                 :   virtual void updateAll(GfxState *state);
     163                 :   virtual void updateCTM(GfxState * /*state*/, double /*m11*/, double /*m12*/,
     164                 :        double /*m21*/, double /*m22*/, double /*m31*/, double /*m32*/) {}
     165                 :   virtual void updateLineDash(GfxState * /*state*/) {}
     166                 :   virtual void updateFlatness(GfxState * /*state*/) {}
     167                 :   virtual void updateLineJoin(GfxState * /*state*/) {}
     168                 :   virtual void updateLineCap(GfxState * /*state*/) {}
     169                 :   virtual void updateMiterLimit(GfxState * /*state*/) {}
     170                 :   virtual void updateLineWidth(GfxState * /*state*/) {}
     171                 :   virtual void updateStrokeAdjust(GfxState * /*state*/) {}
     172               0 :   virtual void updateAlphaIsShape(GfxState * /*state*/) {}
     173               0 :   virtual void updateTextKnockout(GfxState * /*state*/) {}
     174                 :   virtual void updateFillColorSpace(GfxState * /*state*/) {}
     175                 :   virtual void updateStrokeColorSpace(GfxState * /*state*/) {}
     176                 :   virtual void updateFillColor(GfxState * /*state*/) {}
     177                 :   virtual void updateStrokeColor(GfxState * /*state*/) {}
     178                 :   virtual void updateBlendMode(GfxState * /*state*/) {}
     179                 :   virtual void updateFillOpacity(GfxState * /*state*/) {}
     180                 :   virtual void updateStrokeOpacity(GfxState * /*state*/) {}
     181                 :   virtual void updateFillOverprint(GfxState * /*state*/) {}
     182                 :   virtual void updateStrokeOverprint(GfxState * /*state*/) {}
     183                 :   virtual void updateOverprintMode(GfxState * /*state*/) {}
     184                 :   virtual void updateTransfer(GfxState * /*state*/) {}
     185               0 :   virtual void updateFillColorStop(GfxState * /*state*/, double /*offset*/) {}
     186                 : 
     187                 :   //----- update text state
     188                 :   virtual void updateFont(GfxState * /*state*/) {}
     189            1354 :   virtual void updateTextMat(GfxState * /*state*/) {}
     190               0 :   virtual void updateCharSpace(GfxState * /*state*/) {}
     191               0 :   virtual void updateRender(GfxState * /*state*/) {}
     192               0 :   virtual void updateRise(GfxState * /*state*/) {}
     193               0 :   virtual void updateWordSpace(GfxState * /*state*/) {}
     194               0 :   virtual void updateHorizScaling(GfxState * /*state*/) {}
     195            5686 :   virtual void updateTextPos(GfxState * /*state*/) {}
     196               0 :   virtual void updateTextShift(GfxState * /*state*/, double /*shift*/) {}
     197               0 :   virtual void saveTextPos(GfxState * /*state*/) {}
     198               0 :   virtual void restoreTextPos(GfxState * /*state*/) {}
     199                 : 
     200                 :   //----- path painting
     201                 :   virtual void stroke(GfxState * /*state*/) {}
     202                 :   virtual void fill(GfxState * /*state*/) {}
     203                 :   virtual void eoFill(GfxState * /*state*/) {}
     204                 :   virtual GBool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, Object * /*str*/,
     205                 :           double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/,
     206                 :           double * /*mat*/, double * /*bbox*/,
     207                 :           int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/,
     208                 :           double /*xStep*/, double /*yStep*/)
     209                 :     { return gFalse; }
     210               0 :   virtual GBool functionShadedFill(GfxState * /*state*/,
     211                 :            GfxFunctionShading * /*shading*/)
     212               0 :     { return gFalse; }
     213                 :   virtual GBool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/)
     214                 :     { return gFalse; }
     215               0 :   virtual GBool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/)
     216               0 :     { return gFalse; }
     217                 :   virtual GBool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/)
     218                 :     { return gFalse; }
     219               0 :   virtual GBool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/)
     220               0 :     { return gFalse; }
     221                 :   virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading)
     222                 :     { return gFalse; }
     223               0 :   virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
     224               0 :     { return gFalse; }
     225                 : 
     226                 :   //----- path clipping
     227                 :   virtual void clip(GfxState * /*state*/) {}
     228                 :   virtual void eoClip(GfxState * /*state*/) {}
     229                 :   virtual void clipToStrokePath(GfxState * /*state*/) {}
     230                 : 
     231                 :   //----- text drawing
     232            5009 :   virtual void beginStringOp(GfxState * /*state*/) {}
     233            5009 :   virtual void endStringOp(GfxState * /*state*/) {}
     234            5009 :   virtual void beginString(GfxState * /*state*/, GooString * /*s*/) {}
     235            5009 :   virtual void endString(GfxState * /*state*/) {}
     236                 :   virtual void drawChar(GfxState * /*state*/, double /*x*/, double /*y*/,
     237                 :       double /*dx*/, double /*dy*/,
     238                 :       double /*originX*/, double /*originY*/,
     239                 :       CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) {}
     240               0 :   virtual void drawString(GfxState * /*state*/, GooString * /*s*/) {}
     241                 :   virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/,
     242                 :              double /*dx*/, double /*dy*/,
     243                 :              CharCode /*code*/, Unicode * /*u*/, int /*uLen*/);
     244                 :   virtual void endType3Char(GfxState * /*state*/) {}
     245                 :   virtual void beginTextObject(GfxState * /*state*/) {}
     246                 :   virtual void endTextObject(GfxState * /*state*/) {}
     247               0 :   virtual void incCharCount(int /*nChars*/) {}
     248               0 :   virtual void beginActualText(GfxState * /*state*/, GooString * /*text*/ ) {}
     249               0 :   virtual void endActualText(GfxState * /*state*/) {}
     250                 : 
     251                 :   //----- image drawing
     252                 :   virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
     253                 :            int width, int height, GBool invert, GBool interpolate,
     254                 :            GBool inlineImg);
     255                 :   virtual void setSoftMaskFromImageMask(GfxState *state,
     256                 :           Object *ref, Stream *str,
     257                 :           int width, int height, GBool invert,
     258                 :           GBool inlineImg, double *baseMatrix);
     259                 :   virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix);
     260                 :   virtual void drawImage(GfxState *state, Object *ref, Stream *str,
     261                 :        int width, int height, GfxImageColorMap *colorMap,
     262                 :        GBool interpolate, int *maskColors, GBool inlineImg);
     263                 :   virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
     264                 :              int width, int height,
     265                 :              GfxImageColorMap *colorMap, GBool interpolate,
     266                 :              Stream *maskStr, int maskWidth, int maskHeight,
     267                 :              GBool maskInvert, GBool maskInterpolate);
     268                 :   virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
     269                 :            int width, int height,
     270                 :            GfxImageColorMap *colorMap,
     271                 :            GBool interpolate,
     272                 :            Stream *maskStr,
     273                 :            int maskWidth, int maskHeight,
     274                 :            GfxImageColorMap *maskColorMap,
     275                 :            GBool maskInterpolate);
     276                 : 
     277                 :   //----- grouping operators
     278                 : 
     279                 :   virtual void endMarkedContent(GfxState *state);
     280                 :   virtual void beginMarkedContent(char *name, Dict *properties);
     281                 :   virtual void markPoint(char *name);
     282                 :   virtual void markPoint(char *name, Dict *properties);
     283                 : 
     284                 : 
     285                 : 
     286                 : #if OPI_SUPPORT
     287                 :   //----- OPI functions
     288                 :   virtual void opiBegin(GfxState *state, Dict *opiDict);
     289                 :   virtual void opiEnd(GfxState *state, Dict *opiDict);
     290                 : #endif
     291                 : 
     292                 :   //----- Type 3 font operators
     293                 :   virtual void type3D0(GfxState * /*state*/, double /*wx*/, double /*wy*/) {}
     294                 :   virtual void type3D1(GfxState * /*state*/, double /*wx*/, double /*wy*/,
     295                 :            double /*llx*/, double /*lly*/, double /*urx*/, double /*ury*/) {}
     296                 : 
     297                 :   //----- form XObjects
     298               0 :   virtual void drawForm(Ref /*id*/) {}
     299                 : 
     300                 :   //----- PostScript XObjects
     301               0 :   virtual void psXObject(Stream * /*psStream*/, Stream * /*level1Stream*/) {}
     302                 : 
     303                 :   //----- Profiling
     304                 :   virtual void startProfile();
     305               0 :   virtual GooHash *getProfileHash() {return profileHash; }
     306                 :   virtual GooHash *endProfile();
     307                 : 
     308                 :   //----- transparency groups and soft masks
     309                 :   virtual GBool checkTransparencyGroup(GfxState * /*state*/, GBool /*knockout*/) { return gTrue; }
     310                 :   virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
     311                 :               GfxColorSpace * /*blendingColorSpace*/,
     312                 :               GBool /*isolated*/, GBool /*knockout*/,
     313                 :               GBool /*forSoftMask*/) {}
     314                 :   virtual void endTransparencyGroup(GfxState * /*state*/) {}
     315                 :   virtual void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) {}
     316                 :   virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
     317                 :          Function * /*transferFunc*/, GfxColor * /*backdropColor*/) {}
     318                 :   virtual void clearSoftMask(GfxState * /*state*/) {}
     319                 : 
     320                 :   //----- links
     321               0 :   virtual void processLink(AnnotLink * /*link*/) {}
     322                 : 
     323                 : #if 1 //~tmp: turn off anti-aliasing temporarily
     324                 :   virtual GBool getVectorAntialias() { return gFalse; }
     325                 :   virtual void setVectorAntialias(GBool /*vaa*/) {}
     326                 : #endif
     327                 : 
     328                 : private:
     329                 : 
     330                 :   double defCTM[6];   // default coordinate transform matrix
     331                 :   double defICTM[6];    // inverse of default CTM
     332                 :   GooHash *profileHash;
     333                 : };
     334                 : 
     335                 : #endif

Generated by: LCOV version 1.7