]>
git.ipfire.org Git - thirdparty/cups.git/blob - pdftops/OutputDev.cxx
1 //========================================================================
5 // Copyright 1996 Derek B. Noonburg
7 //========================================================================
10 #pragma implementation
17 #include "OutputDev.h"
19 //------------------------------------------------------------------------
21 //------------------------------------------------------------------------
23 void OutputDev::setDefaultCTM(double *ctm1
) {
27 for (i
= 0; i
< 6; ++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
;
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];
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);
48 void OutputDev::updateAll(GfxState
*state
) {
49 updateLineDash(state
);
50 updateFlatness(state
);
51 updateLineJoin(state
);
53 updateMiterLimit(state
);
54 updateLineWidth(state
);
55 updateFillColor(state
);
56 updateStrokeColor(state
);
60 void OutputDev::drawImageMask(GfxState
*state
, Object
*ref
, Stream
*str
,
61 int width
, int height
, GBool invert
,
70 j
= height
* ((width
+ 7) / 8);
71 for (i
= 0; i
< j
; ++i
)
76 void OutputDev::drawImage(GfxState
*state
, Object
*ref
, Stream
*str
,
77 int width
, int height
, GfxImageColorMap
*colorMap
,
85 j
= height
* ((width
* colorMap
->getNumPixelComps() *
86 colorMap
->getBits() + 7) / 8);
87 for (i
= 0; i
< j
; ++i
)
93 void OutputDev::opiBegin(GfxState
*state
, Dict
*opiDict
) {
96 void OutputDev::opiEnd(GfxState
*state
, Dict
*opiDict
) {