/utils/ImageOutputDev.h

https://github.com/circuithub/poppler-http · C Header · 106 lines · 47 code · 20 blank · 39 comment · 0 complexity · 582fbf3ac75115786131c93bf8fa10aa MD5 · raw file

  1. //========================================================================
  2. //
  3. // ImageOutputDev.h
  4. //
  5. // Copyright 1998-2003 Glyph & Cog, LLC
  6. //
  7. //========================================================================
  8. //========================================================================
  9. //
  10. // Modified under the Poppler project - http://poppler.freedesktop.org
  11. //
  12. // All changes made under the Poppler project to this file are licensed
  13. // under GPL version 2 or later
  14. //
  15. // Copyright (C) 2006 Rainer Keller <class321@gmx.de>
  16. // Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com>
  17. // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
  18. //
  19. // To see a description of the changes please see the Changelog file that
  20. // came with your tarball or type make ChangeLog if you are building from git
  21. //
  22. //========================================================================
  23. #ifndef IMAGEOUTPUTDEV_H
  24. #define IMAGEOUTPUTDEV_H
  25. #include "poppler/poppler-config.h"
  26. #ifdef USE_GCC_PRAGMAS
  27. #pragma interface
  28. #endif
  29. #include <stdio.h>
  30. #include "goo/gtypes.h"
  31. #include "OutputDev.h"
  32. class GfxState;
  33. //------------------------------------------------------------------------
  34. // ImageOutputDev
  35. //------------------------------------------------------------------------
  36. class ImageOutputDev: public OutputDev {
  37. public:
  38. // Create an OutputDev which will write images to files named
  39. // <fileRoot>-NNN.<type>. Normally, all images are written as PBM
  40. // (.pbm) or PPM (.ppm) files. If <dumpJPEG> is set, JPEG images are
  41. // written as JPEG (.jpg) files.
  42. ImageOutputDev(char *fileRootA, GBool dumpJPEGA);
  43. // Destructor.
  44. virtual ~ImageOutputDev();
  45. // Check if file was successfully created.
  46. virtual GBool isOk() { return ok; }
  47. // Does this device use beginType3Char/endType3Char? Otherwise,
  48. // text in Type 3 fonts will be drawn with drawChar/drawString.
  49. virtual GBool interpretType3Chars() { return gFalse; }
  50. // Does this device need non-text content?
  51. virtual GBool needNonText() { return gTrue; }
  52. //---- get info about output device
  53. // Does this device use upside-down coordinates?
  54. // (Upside-down means (0,0) is the top left corner of the page.)
  55. virtual GBool upsideDown() { return gTrue; }
  56. // Does this device use drawChar() or drawString()?
  57. virtual GBool useDrawChar() { return gFalse; }
  58. //----- image drawing
  59. virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
  60. int width, int height, GBool invert,
  61. GBool interpolate, GBool inlineImg);
  62. virtual void drawImage(GfxState *state, Object *ref, Stream *str,
  63. int width, int height, GfxImageColorMap *colorMap,
  64. GBool interpolate, int *maskColors, GBool inlineImg);
  65. virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
  66. int width, int height,
  67. GfxImageColorMap *colorMap,
  68. GBool interpolate,
  69. Stream *maskStr, int maskWidth, int maskHeight,
  70. GBool maskInvert, GBool maskInterpolate);
  71. virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
  72. int width, int height,
  73. GfxImageColorMap *colorMap,
  74. GBool interpolate,
  75. Stream *maskStr,
  76. int maskWidth, int maskHeight,
  77. GfxImageColorMap *maskColorMap,
  78. GBool maskInterpolate);
  79. private:
  80. char *fileRoot; // root of output file names
  81. char *fileName; // buffer for output file names
  82. GBool dumpJPEG; // set to dump native JPEG files
  83. int imgNum; // current image number
  84. GBool ok; // set up ok?
  85. };
  86. #endif