]> git.ipfire.org Git - thirdparty/cups.git/blob - pdftops/OutputDev.cxx
Merge changes from 1.1 tree.
[thirdparty/cups.git] / pdftops / OutputDev.cxx
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 <stddef.h>
14 #include "Object.h"
15 #include "Stream.h"
16 #include "GfxState.h"
17 #include "OutputDev.h"
18
19 //------------------------------------------------------------------------
20 // OutputDev
21 //------------------------------------------------------------------------
22
23 void OutputDev::setDefaultCTM(double *ctm1) {
24 int i;
25 double det;
26
27 for (i = 0; i < 6; ++i)
28 ctm[i] = ctm1[i];
29 det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
30 ictm[0] = ctm[3] * det;
31 ictm[1] = -ctm[1] * det;
32 ictm[2] = -ctm[2] * det;
33 ictm[3] = ctm[0] * det;
34 ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det;
35 ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det;
36 }
37
38 void OutputDev::cvtDevToUser(int dx, int dy, double *ux, double *uy) {
39 *ux = ictm[0] * dx + ictm[2] * dy + ictm[4];
40 *uy = ictm[1] * dx + ictm[3] * dy + ictm[5];
41 }
42
43 void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) {
44 *dx = (int)(ctm[0] * ux + ctm[2] * uy + ctm[4] + 0.5);
45 *dy = (int)(ctm[1] * ux + ctm[3] * uy + ctm[5] + 0.5);
46 }
47
48 void OutputDev::updateAll(GfxState *state) {
49 updateLineDash(state);
50 updateFlatness(state);
51 updateLineJoin(state);
52 updateLineCap(state);
53 updateMiterLimit(state);
54 updateLineWidth(state);
55 updateFillColor(state);
56 updateStrokeColor(state);
57 updateFont(state);
58 }
59
60 void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
61 int width, int height, GBool invert,
62 GBool inlineImg) {
63 int i, j;
64
65 (void)state;
66 (void)invert;
67
68 if (inlineImg) {
69 str->reset();
70 j = height * ((width + 7) / 8);
71 for (i = 0; i < j; ++i)
72 str->getChar();
73 }
74 }
75
76 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
77 int width, int height, GfxImageColorMap *colorMap,
78 GBool inlineImg) {
79 int i, j;
80
81 (void)state;
82
83 if (inlineImg) {
84 str->reset();
85 j = height * ((width * colorMap->getNumPixelComps() *
86 colorMap->getBits() + 7) / 8);
87 for (i = 0; i < j; ++i)
88 str->getChar();
89 }
90 }
91
92 #if OPI_SUPPORT
93 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
94 }
95
96 void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
97 }
98 #endif