diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1999-04-17 02:59:58 (GMT) |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-04-17 02:59:58 (GMT) |
commit | d9f9a6449f377b4c933b75d57541b19c6d088994 (patch) | |
tree | 04f7f0c54447ef792fbf83bc5039174f4681b3bb /pdf/xpdf/OutputDev.cc |
Initial revision
Diffstat (limited to 'pdf/xpdf/OutputDev.cc')
-rw-r--r-- | pdf/xpdf/OutputDev.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/pdf/xpdf/OutputDev.cc b/pdf/xpdf/OutputDev.cc new file mode 100644 index 0000000..95c5628 --- /dev/null +++ b/pdf/xpdf/OutputDev.cc @@ -0,0 +1,85 @@ +//======================================================================== +// +// OutputDev.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include <stddef.h> +#include "Object.h" +#include "Stream.h" +#include "GfxState.h" +#include "OutputDev.h" + +//------------------------------------------------------------------------ +// OutputDev +//------------------------------------------------------------------------ + +void OutputDev::setDefaultCTM(double *ctm1) { + int i; + double det; + + for (i = 0; i < 6; ++i) + ctm[i] = ctm1[i]; + det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]); + ictm[0] = ctm[3] * det; + ictm[1] = -ctm[1] * det; + ictm[2] = -ctm[2] * det; + ictm[3] = ctm[0] * det; + ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det; + ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det; +} + +void OutputDev::cvtDevToUser(int dx, int dy, double *ux, double *uy) { + *ux = ictm[0] * dx + ictm[2] * dy + ictm[4]; + *uy = ictm[1] * dx + ictm[3] * dy + ictm[5]; +} + +void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) { + *dx = (int)(ctm[0] * ux + ctm[2] * uy + ctm[4] + 0.5); + *dy = (int)(ctm[1] * ux + ctm[3] * uy + ctm[5] + 0.5); +} + +void OutputDev::updateAll(GfxState *state) { + updateLineDash(state); + updateFlatness(state); + updateLineJoin(state); + updateLineCap(state); + updateMiterLimit(state); + updateLineWidth(state); + updateFillColor(state); + updateStrokeColor(state); + updateFont(state); +} + +void OutputDev::drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) { + int i, j; + + if (inlineImg) { + str->reset(); + j = height * ((width + 7) / 8); + for (i = 0; i < j; ++i) + str->getChar(); + } +} + +void OutputDev::drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg) { + int i, j; + + if (inlineImg) { + str->reset(); + j = height * ((width * colorMap->getNumPixelComps() * + colorMap->getBits() + 7) / 8); + for (i = 0; i < j; ++i) + str->getChar(); + } +} |