00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifdef __GNUC__
00010 #pragma implementation
00011 #endif
00012
00013 #include <aconf.h>
00014 #include <stddef.h>
00015 #include "Object.h"
00016 #include "Stream.h"
00017 #include "GfxState.h"
00018 #include "OutputDev.h"
00019
00020
00021
00022
00023
00024 void OutputDev::setDefaultCTM(fouble *ctm) {
00025 int i;
00026 fouble det;
00027
00028 for (i = 0; i < 6; ++i) {
00029 defCTM[i] = ctm[i];
00030 }
00031 det = 1 / (defCTM[0] * defCTM[3] - defCTM[1] * defCTM[2]);
00032 defICTM[0] = defCTM[3] * det;
00033 defICTM[1] = -defCTM[1] * det;
00034 defICTM[2] = -defCTM[2] * det;
00035 defICTM[3] = defCTM[0] * det;
00036 defICTM[4] = (defCTM[2] * defCTM[5] - defCTM[3] * defCTM[4]) * det;
00037 defICTM[5] = (defCTM[1] * defCTM[4] - defCTM[0] * defCTM[5]) * det;
00038 }
00039
00040 void OutputDev::cvtDevToUser(int dx, int dy, fouble *ux, fouble *uy) {
00041 *ux = defICTM[0] * dx + defICTM[2] * dy + defICTM[4];
00042 *uy = defICTM[1] * dx + defICTM[3] * dy + defICTM[5];
00043 }
00044
00045 void OutputDev::cvtUserToDev(fouble ux, fouble uy, int *dx, int *dy) {
00046 *dx = (int)(defCTM[0] * ux + defCTM[2] * uy + defCTM[4] + 0.5);
00047 *dy = (int)(defCTM[1] * ux + defCTM[3] * uy + defCTM[5] + 0.5);
00048 }
00049
00050 void OutputDev::updateAll(GfxState *state) {
00051 updateLineDash(state);
00052 updateFlatness(state);
00053 updateLineJoin(state);
00054 updateLineCap(state);
00055 updateMiterLimit(state);
00056 updateLineWidth(state);
00057 updateFillColor(state);
00058 updateStrokeColor(state);
00059 updateFont(state);
00060 }
00061
00062 GBool OutputDev::beginType3Char(GfxState *state,
00063 CharCode code, Unicode *u, int uLen) {
00064 return gFalse;
00065 }
00066
00067 void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
00068 int width, int height, GBool invert,
00069 GBool inlineImg) {
00070 int i, j;
00071
00072 if (inlineImg) {
00073 str->reset();
00074 j = height * ((width + 7) / 8);
00075 for (i = 0; i < j; ++i)
00076 str->getChar();
00077 str->close();
00078 }
00079 }
00080
00081 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
00082 int width, int height, GfxImageColorMap *colorMap,
00083 int *maskColors, GBool inlineImg) {
00084 int i, j;
00085
00086 if (inlineImg) {
00087 str->reset();
00088 j = height * ((width * colorMap->getNumPixelComps() *
00089 colorMap->getBits() + 7) / 8);
00090 for (i = 0; i < j; ++i)
00091 str->getChar();
00092 str->close();
00093 }
00094 }
00095
00096 #if OPI_SUPPORT
00097 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
00098 }
00099
00100 void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
00101 }
00102 #endif