Back to index

tetex-bin  3.0
OutputDev.cc
Go to the documentation of this file.
00001 //========================================================================
00002 //
00003 // OutputDev.cc
00004 //
00005 // Copyright 1996-2003 Glyph & Cog, LLC
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 // OutputDev
00023 //------------------------------------------------------------------------
00024 
00025 void OutputDev::setDefaultCTM(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(double dx, double 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 *state, double x, double y,
00064                             double dx, double dy,
00065                             CharCode code, Unicode *u, int uLen) {
00066   return gFalse;
00067 }
00068 
00069 void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
00070                            int width, int height, GBool invert,
00071                            GBool inlineImg) {
00072   int i, j;
00073 
00074   if (inlineImg) {
00075     str->reset();
00076     j = height * ((width + 7) / 8);
00077     for (i = 0; i < j; ++i)
00078       str->getChar();
00079     str->close();
00080   }
00081 }
00082 
00083 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
00084                        int width, int height, GfxImageColorMap *colorMap,
00085                        int *maskColors, GBool inlineImg) {
00086   int i, j;
00087 
00088   if (inlineImg) {
00089     str->reset();
00090     j = height * ((width * colorMap->getNumPixelComps() *
00091                  colorMap->getBits() + 7) / 8);
00092     for (i = 0; i < j; ++i)
00093       str->getChar();
00094     str->close();
00095   }
00096 }
00097 
00098 #if OPI_SUPPORT
00099 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
00100 }
00101 
00102 void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
00103 }
00104 #endif