source: trunk/poppler/mypoppler/poppler/CairoOutputDev.h @ 27

Last change on this file since 27 was 27, checked in by Eugene Romanenko, 16 years ago

poppler updated to version 0.5.2, also needed changes to be compatible with new poppler

File size: 4.9 KB
Line 
1//========================================================================
2//
3// CairoOutputDev.h
4//
5// Copyright 2003 Glyph & Cog, LLC
6// Copyright 2004 Red Hat, INC
7//
8//========================================================================
9
10#ifndef CAIROOUTPUTDEV_H
11#define CAIROOUTPUTDEV_H
12
13#ifdef USE_GCC_PRAGMAS
14#pragma interface
15#endif
16
17#include "goo/gtypes.h"
18#include <cairo-ft.h>
19#include "OutputDev.h"
20#include "GfxState.h"
21
22class GfxState;
23class GfxPath;
24class Gfx8BitFont;
25struct GfxRGB;
26class CairoFontEngine;
27class CairoFont;
28
29//------------------------------------------------------------------------
30
31//------------------------------------------------------------------------
32// CairoOutputDev
33//------------------------------------------------------------------------
34
35class CairoOutputDev: public OutputDev {
36public:
37
38  // Constructor.
39  CairoOutputDev();
40
41  // Destructor.
42  virtual ~CairoOutputDev();
43
44  //----- get info about output device
45
46  // Does this device use upside-down coordinates?
47  // (Upside-down means (0,0) is the top left corner of the page.)
48  virtual GBool upsideDown() { return gTrue; }
49
50  // Does this device use drawChar() or drawString()?
51  virtual GBool useDrawChar() { return gTrue; }
52
53  // Does this device use beginType3Char/endType3Char?  Otherwise,
54  // text in Type 3 fonts will be drawn with drawChar/drawString.
55  virtual GBool interpretType3Chars() { return gFalse; }
56
57  //----- initialization and control
58
59  // Start a page.
60  virtual void startPage(int pageNum, GfxState *state) { }
61
62  // End a page.
63  virtual void endPage() { }
64
65  //----- link borders
66  virtual void drawLink(Link *link, Catalog *catalog);
67
68  //----- save/restore graphics state
69  virtual void saveState(GfxState *state);
70  virtual void restoreState(GfxState *state);
71
72  //----- update graphics state
73  virtual void updateAll(GfxState *state);
74  virtual void updateCTM(GfxState *state, double m11, double m12,
75                         double m21, double m22, double m31, double m32);
76  virtual void updateLineDash(GfxState *state);
77  virtual void updateFlatness(GfxState *state);
78  virtual void updateLineJoin(GfxState *state);
79  virtual void updateLineCap(GfxState *state);
80  virtual void updateMiterLimit(GfxState *state);
81  virtual void updateLineWidth(GfxState *state);
82  virtual void updateFillColor(GfxState *state);
83  virtual void updateStrokeColor(GfxState *state);
84  virtual void updateFillOpacity(GfxState *state);
85  virtual void updateStrokeOpacity(GfxState *state);
86
87  //----- update text state
88  virtual void updateFont(GfxState *state);
89
90  //----- path painting
91  virtual void stroke(GfxState *state);
92  virtual void fill(GfxState *state);
93  virtual void eoFill(GfxState *state);
94
95  //----- path clipping
96  virtual void clip(GfxState *state);
97  virtual void eoClip(GfxState *state);
98
99  //----- text drawing
100  void beginString(GfxState *state, GooString *s);
101  void endString(GfxState *state);
102  void drawChar(GfxState *state, double x, double y,
103                double dx, double dy,
104                double originX, double originY,
105                CharCode code, int nBytes, Unicode *u, int uLen);
106
107  virtual GBool beginType3Char(GfxState *state, double x, double y,
108                               double dx, double dy,
109                               CharCode code, Unicode *u, int uLen);
110  virtual void endType3Char(GfxState *state);
111  virtual void endTextObject(GfxState *state);
112
113  //----- image drawing
114  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
115                             int width, int height, GBool invert,
116                             GBool inlineImg);
117  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
118                         int width, int height, GfxImageColorMap *colorMap,
119                         int *maskColors, GBool inlineImg);
120  virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
121                                int width, int height,
122                                GfxImageColorMap *colorMap,
123                                Stream *maskStr,
124                                int maskWidth, int maskHeight,
125                                GfxImageColorMap *maskColorMap);
126
127  virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
128                                int width, int height,
129                                GfxImageColorMap *colorMap,
130                                Stream *maskStr,
131                                int maskWidth, int maskHeight,
132                                GBool maskInvert);
133
134
135  //----- Type 3 font operators
136  virtual void type3D0(GfxState *state, double wx, double wy);
137  virtual void type3D1(GfxState *state, double wx, double wy,
138                       double llx, double lly, double urx, double ury);
139
140  //----- special access
141
142  // Called to indicate that a new PDF document has been loaded.
143  void startDoc(XRef *xrefA);
144 
145  GBool isReverseVideo() { return gFalse; }
146 
147  void setCairo (cairo_t *cr);
148
149protected:
150  void doPath(GfxState *state, GfxPath *path);
151 
152  GfxRGB fill_color, stroke_color;
153  cairo_pattern_t *fill_pattern, *stroke_pattern;
154  double fill_opacity;
155  double stroke_opacity;
156  CairoFont *currentFont;
157 
158  XRef *xref;                   // xref table for current document
159
160  FT_Library ft_lib;
161  CairoFontEngine *fontEngine;
162  cairo_t *cairo;
163  GBool needFontUpdate;                // set when the font needs to be updated
164  cairo_surface_t *surface;
165  cairo_glyph_t *glyphs;
166  int glyphCount;
167  cairo_path_t *textClipPath;
168};
169
170#endif
Note: See TracBrowser for help on using the repository browser.