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