]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/OutputDev.cc
Reused eog HIG dialog in GPdf.
[evince.git] / pdf / xpdf / OutputDev.cc
1 //========================================================================
2 //
3 // OutputDev.cc
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
8
9 #include <aconf.h>
10
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
13 #endif
14
15 #include <stddef.h>
16 #include "Object.h"
17 #include "Stream.h"
18 #include "GfxState.h"
19 #include "OutputDev.h"
20
21 //------------------------------------------------------------------------
22 // OutputDev
23 //------------------------------------------------------------------------
24
25 void OutputDev::setDefaultCTM(double *ctm) {
26   int i;
27   double det;
28
29   for (i = 0; i < 6; ++i) {
30     defCTM[i] = ctm[i];
31   }
32   det = 1 / (defCTM[0] * defCTM[3] - defCTM[1] * defCTM[2]);
33   defICTM[0] = defCTM[3] * det;
34   defICTM[1] = -defCTM[1] * det;
35   defICTM[2] = -defCTM[2] * det;
36   defICTM[3] = defCTM[0] * det;
37   defICTM[4] = (defCTM[2] * defCTM[5] - defCTM[3] * defCTM[4]) * det;
38   defICTM[5] = (defCTM[1] * defCTM[4] - defCTM[0] * defCTM[5]) * det;
39 }
40
41 void OutputDev::cvtDevToUser(double dx, double dy, double *ux, double *uy) {
42   *ux = defICTM[0] * dx + defICTM[2] * dy + defICTM[4];
43   *uy = defICTM[1] * dx + defICTM[3] * dy + defICTM[5];
44 }
45
46 void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) {
47   *dx = (int)(defCTM[0] * ux + defCTM[2] * uy + defCTM[4] + 0.5);
48   *dy = (int)(defCTM[1] * ux + defCTM[3] * uy + defCTM[5] + 0.5);
49 }
50
51 void OutputDev::updateAll(GfxState *state) {
52   updateLineDash(state);
53   updateFlatness(state);
54   updateLineJoin(state);
55   updateLineCap(state);
56   updateMiterLimit(state);
57   updateLineWidth(state);
58   updateFillColor(state);
59   updateStrokeColor(state);
60   updateFont(state);
61 }
62
63 GBool OutputDev::beginType3Char(GfxState *state,
64                                 CharCode code, Unicode *u, int uLen) {
65   return gFalse;
66 }
67
68 void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
69                               int width, int height, GBool invert,
70                               GBool inlineImg) {
71   int i, j;
72
73   if (inlineImg) {
74     str->reset();
75     j = height * ((width + 7) / 8);
76     for (i = 0; i < j; ++i)
77       str->getChar();
78     str->close();
79   }
80 }
81
82 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
83                           int width, int height, GfxImageColorMap *colorMap,
84                           int *maskColors, GBool inlineImg) {
85   int i, j;
86
87   if (inlineImg) {
88     str->reset();
89     j = height * ((width * colorMap->getNumPixelComps() *
90                    colorMap->getBits() + 7) / 8);
91     for (i = 0; i < j; ++i)
92       str->getChar();
93     str->close();
94   }
95 }
96
97 #if OPI_SUPPORT
98 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
99 }
100
101 void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
102 }
103 #endif