Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/OutputDev.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/OutputDev.cc | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/OutputDev.cc b/noncore/unsupported/qpdf/xpdf/OutputDev.cc new file mode 100644 index 0000000..3c02835 --- a/dev/null +++ b/noncore/unsupported/qpdf/xpdf/OutputDev.cc | |||
@@ -0,0 +1,97 @@ | |||
1 | //======================================================================== | ||
2 | // | ||
3 | // OutputDev.cc | ||
4 | // | ||
5 | // Copyright 1996 Derek B. Noonburg | ||
6 | // | ||
7 | //======================================================================== | ||
8 | |||
9 | #ifdef __GNUC__ | ||
10 | #pragma implementation | ||
11 | #endif | ||
12 | |||
13 | #include <aconf.h> | ||
14 | #include <stddef.h> | ||
15 | #include "Object.h" | ||
16 | #include "Stream.h" | ||
17 | #include "GfxState.h" | ||
18 | #include "OutputDev.h" | ||
19 | |||
20 | //------------------------------------------------------------------------ | ||
21 | // OutputDev | ||
22 | //------------------------------------------------------------------------ | ||
23 | |||
24 | void OutputDev::setDefaultCTM(fouble *ctm) { | ||
25 | int i; | ||
26 | fouble det; | ||
27 | |||
28 | for (i = 0; i < 6; ++i) { | ||
29 | defCTM[i] = ctm[i]; | ||
30 | } | ||
31 | det = 1 / (defCTM[0] * defCTM[3] - defCTM[1] * defCTM[2]); | ||
32 | defICTM[0] = defCTM[3] * det; | ||
33 | defICTM[1] = -defCTM[1] * det; | ||
34 | defICTM[2] = -defCTM[2] * det; | ||
35 | defICTM[3] = defCTM[0] * det; | ||
36 | defICTM[4] = (defCTM[2] * defCTM[5] - defCTM[3] * defCTM[4]) * det; | ||
37 | defICTM[5] = (defCTM[1] * defCTM[4] - defCTM[0] * defCTM[5]) * det; | ||
38 | } | ||
39 | |||
40 | void OutputDev::cvtDevToUser(int dx, int dy, fouble *ux, fouble *uy) { | ||
41 | *ux = defICTM[0] * dx + defICTM[2] * dy + defICTM[4]; | ||
42 | *uy = defICTM[1] * dx + defICTM[3] * dy + defICTM[5]; | ||
43 | } | ||
44 | |||
45 | void OutputDev::cvtUserToDev(fouble ux, fouble uy, int *dx, int *dy) { | ||
46 | *dx = (int)(defCTM[0] * ux + defCTM[2] * uy + defCTM[4] + 0.5); | ||
47 | *dy = (int)(defCTM[1] * ux + defCTM[3] * uy + defCTM[5] + 0.5); | ||
48 | } | ||
49 | |||
50 | void OutputDev::updateAll(GfxState *state) { | ||
51 | updateLineDash(state); | ||
52 | updateFlatness(state); | ||
53 | updateLineJoin(state); | ||
54 | updateLineCap(state); | ||
55 | updateMiterLimit(state); | ||
56 | updateLineWidth(state); | ||
57 | updateFillColor(state); | ||
58 | updateStrokeColor(state); | ||
59 | updateFont(state); | ||
60 | } | ||
61 | |||
62 | void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, | ||
63 | int width, int height, GBool invert, | ||
64 | GBool inlineImg) { | ||
65 | int i, j; | ||
66 | |||
67 | if (inlineImg) { | ||
68 | str->reset(); | ||
69 | j = height * ((width + 7) / 8); | ||
70 | for (i = 0; i < j; ++i) | ||
71 | str->getChar(); | ||
72 | str->close(); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, | ||
77 | int width, int height, GfxImageColorMap *colorMap, | ||
78 | int *maskColors, GBool inlineImg) { | ||
79 | int i, j; | ||
80 | |||
81 | if (inlineImg) { | ||
82 | str->reset(); | ||
83 | j = height * ((width * colorMap->getNumPixelComps() * | ||
84 | colorMap->getBits() + 7) / 8); | ||
85 | for (i = 0; i < j; ++i) | ||
86 | str->getChar(); | ||
87 | str->close(); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | #if OPI_SUPPORT | ||
92 | void OutputDev::opiBegin(GfxState *state, Dict *opiDict) { | ||
93 | } | ||
94 | |||
95 | void OutputDev::opiEnd(GfxState *state, Dict *opiDict) { | ||
96 | } | ||
97 | #endif | ||