1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
10 #pragma implementation
18 #include "OutputDev.h"
20 //------------------------------------------------------------------------
22 //------------------------------------------------------------------------
24 void OutputDev::setDefaultCTM(double *ctm
) {
28 for (i
= 0; i
< 6; ++i
) {
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
;
40 void OutputDev::cvtDevToUser(int dx
, int dy
, double *ux
, double *uy
) {
41 *ux
= defICTM
[0] * dx
+ defICTM
[2] * dy
+ defICTM
[4];
42 *uy
= defICTM
[1] * dx
+ defICTM
[3] * dy
+ defICTM
[5];
45 void OutputDev::cvtUserToDev(double ux
, double 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);
50 void OutputDev::updateAll(GfxState
*state
) {
51 updateLineDash(state
);
52 updateFlatness(state
);
53 updateLineJoin(state
);
55 updateMiterLimit(state
);
56 updateLineWidth(state
);
57 updateFillColor(state
);
58 updateStrokeColor(state
);
62 GBool
OutputDev::beginType3Char(GfxState
*state
,
63 CharCode code
, Unicode
*u
, int uLen
) {
67 void OutputDev::drawImageMask(GfxState
*state
, Object
*ref
, Stream
*str
,
68 int width
, int height
, GBool invert
,
74 j
= height
* ((width
+ 7) / 8);
75 for (i
= 0; i
< j
; ++i
)
81 void OutputDev::drawImage(GfxState
*state
, Object
*ref
, Stream
*str
,
82 int width
, int height
, GfxImageColorMap
*colorMap
,
83 int *maskColors
, GBool inlineImg
) {
88 j
= height
* ((width
* colorMap
->getNumPixelComps() *
89 colorMap
->getBits() + 7) / 8);
90 for (i
= 0; i
< j
; ++i
)
97 void OutputDev::opiBegin(GfxState
*state
, Dict
*opiDict
) {
100 void OutputDev::opiEnd(GfxState
*state
, Dict
*opiDict
) {