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

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 15 years ago

First import

File size: 4.7 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 gTrue; }
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  //----- Type 3 font operators
128  virtual void type3D0(GfxState *state, double wx, double wy);
129  virtual void type3D1(GfxState *state, double wx, double wy,
130                       double llx, double lly, double urx, double ury);
131
132  //----- special access
133
134  // Called to indicate that a new PDF document has been loaded.
135  void startDoc(XRef *xrefA);
136 
137  GBool isReverseVideo() { return gFalse; }
138 
139  void setSurface (cairo_surface_t *surface);
140
141protected:
142  void doPath(GfxState *state, GfxPath *path);
143 
144  GfxRGB fill_color, stroke_color;
145  cairo_pattern_t *fill_pattern, *stroke_pattern;
146  double fill_opacity;
147  double stroke_opacity;
148  CairoFont *currentFont;
149 
150  XRef *xref;                   // xref table for current document
151
152  FT_Library ft_lib;
153  CairoFontEngine *fontEngine;
154  cairo_t *cairo;
155  GBool needFontUpdate;                // set when the font needs to be updated
156  cairo_surface_t *surface;
157  cairo_glyph_t *glyphs;
158  int glyphCount;
159  cairo_path_t *textClipPath;
160};
161
162#endif
Note: See TracBrowser for help on using the repository browser.