1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
19 #include "OutputDev.h"
21 //------------------------------------------------------------------------
23 //------------------------------------------------------------------------
25 void OutputDev::setDefaultCTM(double *ctm) {
29 for (i = 0; i < 6; ++i) {
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;
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];
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);
51 void OutputDev::updateAll(GfxState *state) {
52 updateLineDash(state);
53 updateFlatness(state);
54 updateLineJoin(state);
56 updateMiterLimit(state);
57 updateLineWidth(state);
58 updateFillColorSpace(state);
59 updateFillColor(state);
60 updateStrokeColorSpace(state);
61 updateStrokeColor(state);
62 updateBlendMode(state);
63 updateFillOpacity(state);
64 updateStrokeOpacity(state);
65 updateFillOverprint(state);
66 updateStrokeOverprint(state);
70 GBool OutputDev::beginType3Char(GfxState *state, double x, double y,
72 CharCode code, Unicode *u, int uLen) {
76 void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
77 int width, int height, GBool invert,
83 j = height * ((width + 7) / 8);
84 for (i = 0; i < j; ++i)
90 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
91 int width, int height, GfxImageColorMap *colorMap,
92 int *maskColors, GBool inlineImg) {
97 j = height * ((width * colorMap->getNumPixelComps() *
98 colorMap->getBits() + 7) / 8);
99 for (i = 0; i < j; ++i)
105 void OutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str,
106 int width, int height,
107 GfxImageColorMap *colorMap,
109 int maskWidth, int maskHeight,
111 drawImage(state, ref, str, width, height, colorMap, NULL, gFalse);
114 void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
115 int width, int height,
116 GfxImageColorMap *colorMap,
118 int maskWidth, int maskHeight,
119 GfxImageColorMap *maskColorMap) {
120 drawImage(state, ref, str, width, height, colorMap, NULL, gFalse);
124 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
127 void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {