home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 720 / PDF090B4-SorceCode / pdf / OutputDev.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  4.9 KB  |  175 lines

  1. //========================================================================
  2. //
  3. // OutputDev.cc
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8. //
  9. // Ported to EPOC by Sander van der Wal
  10. //
  11. // $Log: OutputDev.cpp $
  12. // Revision 1.3  2000-09-24 21:08:55+02  svdwal
  13. // clearPath() removed
  14. //
  15. // Revision 1.2  2000-09-17 13:38:22+02  svdwal
  16. // Ported
  17. //
  18.  
  19. #ifdef __GNUC__
  20. #pragma implementation
  21. #endif
  22.  
  23. #ifndef __E32DEF_H__
  24. #include <e32def.h> // remove warning about NULL redefinition
  25. #endif
  26.  
  27. #include <stddef.h>
  28.  
  29. #include "Object.h"
  30. #include "Stream.h"
  31. #include "GfxState.h"
  32. #include "OutputDev.h"
  33.  
  34. //------------------------------------------------------------------------
  35. // OutputDev
  36. //------------------------------------------------------------------------
  37.  
  38.  
  39. OutputDev::~OutputDev() {}
  40.  
  41. void OutputDev::setDefaultCTM(double *ctm1) {
  42.   int i;
  43.   double det;
  44.  
  45.   for (i = 0; i < 6; ++i)
  46.     ctm[i] = ctm1[i];
  47.   
  48.   det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
  49.   ictm[0] = ctm[3] * det;
  50.   ictm[1] = -ctm[1] * det;
  51.   ictm[2] = -ctm[2] * det;
  52.   ictm[3] = ctm[0] * det;
  53.   ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det;
  54.   ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det;
  55. }
  56.  
  57. // Start a page.
  58. void OutputDev::startPageL(int , GfxState *) {}
  59.  
  60. // End a page.
  61. void OutputDev::endPage() {}
  62.  
  63. // Dump page contents to display.
  64. void OutputDev::dump() {}
  65.  
  66. //----- coordinate conversion
  67. void OutputDev::cvtDevToUser(int dx, int dy, double *ux, double *uy) {
  68.   *ux = ictm[0] * dx + ictm[2] * dy + ictm[4];
  69.   *uy = ictm[1] * dx + ictm[3] * dy + ictm[5];
  70. }
  71.  
  72. void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) {
  73.   *dx = (int)(ctm[0] * ux + ctm[2] * uy + ctm[4] + 0.5);
  74.   *dy = (int)(ctm[1] * ux + ctm[3] * uy + ctm[5] + 0.5);
  75. }
  76.  
  77. //----- link borders
  78. void OutputDev::drawLinkBorder(double , double , double , double , double) {}
  79.  
  80. //----- save/restore graphics state
  81. void OutputDev::saveState(GfxState *) {}
  82. void OutputDev::restoreState(GfxState *) {}
  83.  
  84. //----- update graphics state
  85. void OutputDev::updateAll(GfxState *state) {
  86.   updateLineDash(state);
  87.   updateFlatness(state);
  88.   updateLineJoin(state);
  89.   updateLineCap(state);
  90.   updateMiterLimit(state);
  91.   updateLineWidth(state);
  92.   updateFillColor(state);
  93.   updateStrokeColor(state);
  94.   updateFont(state);
  95. }
  96.  
  97. void OutputDev::updateCropBox(GfxState* state, double cropX1, double cropY1, double cropX2, double cropY2)
  98. {
  99.   state->moveTo(cropX1, cropY1);
  100.   state->lineTo(cropX2, cropY1);
  101.   state->lineTo(cropX2, cropY2);
  102.   state->lineTo(cropX1, cropY2);
  103.   state->closePath();
  104.   clip(state);
  105.   state->clearPath();
  106. }
  107.  
  108. void OutputDev::updateCTM(GfxState *, double , double , double , double , double , double ) {}
  109. void OutputDev::updateLineDash(GfxState *) {}
  110. void OutputDev::updateFlatness(GfxState *) {}
  111. void OutputDev::updateLineJoin(GfxState *) {}
  112. void OutputDev::updateLineCap(GfxState *) {}
  113. void OutputDev::updateMiterLimit(GfxState *) {}
  114. void OutputDev::updateLineWidth(GfxState *) {}
  115. void OutputDev::updateFillColor(GfxState *) {}
  116. void OutputDev::updateStrokeColor(GfxState *) {}
  117.  
  118. //----- update text state
  119. void OutputDev::updateFont(GfxState *) {}
  120. void OutputDev::updateTextMat(GfxState *) {}
  121. void OutputDev::updateCharSpace(GfxState *) {}
  122. void OutputDev::updateRender(GfxState *) {}
  123. void OutputDev::updateRise(GfxState *) {}
  124. void OutputDev::updateWordSpace(GfxState *) {}
  125. void OutputDev::updateHorizScaling(GfxState *) {}
  126. void OutputDev::updateTextPos(GfxState *) {}
  127. void OutputDev::updateTextShift(GfxState *, double ) {}
  128.  
  129. //----- path painting
  130. void OutputDev::stroke(GfxState *) {}
  131. void OutputDev::fill(GfxState *, GBool) {}
  132. void OutputDev::eoFill(GfxState *, GBool) {}
  133.  
  134. //----- path clipping
  135. void OutputDev::clip(GfxState *) {}
  136. void OutputDev::eoClip(GfxState *) {}
  137.  
  138. //----- text drawing
  139. void OutputDev::beginString(GfxState *, GString *) {}
  140. void OutputDev::endString(GfxState *) {}
  141. void OutputDev::drawChar(GfxState *, double , double ,
  142.             double , double , Guchar ) {}
  143. void OutputDev::drawChar16(GfxState *, double , double ,
  144.               double , double , int ) {}
  145. void OutputDev::drawString(GfxState *, GString *) {}
  146. void OutputDev::drawString16(GfxState *, GString *) {}
  147.  
  148. //----- image drawing
  149. void OutputDev::drawImageMask(GfxState * /* state */, Stream *str,
  150.                   int width, int height, GBool /*invert */,
  151.                   GBool inlineImg) {
  152.   int i, j;
  153.  
  154.   if (inlineImg) {
  155.     str->reset();
  156.     j = height * ((width + 7) / 8);
  157.     for (i = 0; i < j; ++i)
  158.       str->getChar();
  159.   }
  160. }
  161.  
  162. void OutputDev::drawImage(GfxState * /* state */, Stream *str, int width,
  163.               int height, GfxImageColorMap *colorMap,
  164.               GBool inlineImg) {
  165.   int i, j;
  166.  
  167.   if (inlineImg) {
  168.     str->reset();
  169.     j = height * ((width * colorMap->getNumPixelComps() *
  170.            colorMap->getBits() + 7) / 8);
  171.     for (i = 0; i < j; ++i)
  172.       str->getChar();
  173.   }
  174. }
  175.