node-poppler 5.1.4 → 5.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +10 -10
  3. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Annot.h +0 -1783
  4. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/AnnotStampImageHelper.h +0 -68
  5. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Array.h +0 -92
  6. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/BBoxOutputDev.h +0 -54
  7. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CMap.h +0 -128
  8. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CachedFile.h +0 -149
  9. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoFontEngine.h +0 -122
  10. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoOutputDev.h +0 -468
  11. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoRescaleBox.h +0 -60
  12. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Catalog.h +0 -318
  13. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CertificateInfo.h +0 -129
  14. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharCodeToUnicode.h +0 -143
  15. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharTypes.h +0 -24
  16. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlCachedFile.h +0 -37
  17. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlPDFDocBuilder.h +0 -32
  18. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/DateInfo.h +0 -44
  19. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Decrypt.h +0 -147
  20. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Dict.h +0 -126
  21. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Error.h +0 -59
  22. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ErrorCodes.h +0 -54
  23. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FDPDFDocBuilder.h +0 -36
  24. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FILECacheLoader.h +0 -34
  25. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FileSpec.h +0 -85
  26. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontEncodingTables.h +0 -20
  27. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontInfo.h +0 -109
  28. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Form.h +0 -734
  29. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Function.h +0 -251
  30. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Gfx.h +0 -373
  31. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxFont.h +0 -466
  32. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState.h +0 -1759
  33. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState_helpers.h +0 -90
  34. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GlobalParams.h +0 -221
  35. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Hints.h +0 -91
  36. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JArithmeticDecoder.h +0 -131
  37. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JBIG2Stream.h +0 -130
  38. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JPEG2000Stream.h +0 -54
  39. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JSInfo.h +0 -65
  40. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Lexer.h +0 -113
  41. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Linearization.h +0 -43
  42. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Link.h +0 -566
  43. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/LocalPDFDocBuilder.h +0 -32
  44. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/MarkedContentOutputDev.h +0 -132
  45. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Movie.h +0 -123
  46. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToCharCode.h +0 -52
  47. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToUnicodeTable.h +0 -4300
  48. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Object.h +0 -678
  49. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OptionalContent.h +0 -117
  50. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Outline.h +0 -122
  51. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OutputDev.h +0 -379
  52. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDoc.h +0 -419
  53. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocBuilder.h +0 -47
  54. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocEncoding.h +0 -43
  55. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocFactory.h +0 -58
  56. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSOutputDev.h +0 -549
  57. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSTokenizer.h +0 -47
  58. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Page.h +0 -273
  59. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PageTransition.h +0 -105
  60. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Parser.h +0 -76
  61. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PopplerCache.h +0 -65
  62. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PreScanOutputDev.h +0 -148
  63. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ProfileData.h +0 -35
  64. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Rendition.h +0 -164
  65. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SecurityHandler.h +0 -131
  66. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Sound.h +0 -82
  67. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SplashOutputDev.h +0 -413
  68. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream-CCITT.h +0 -334
  69. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream.h +0 -1504
  70. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructElement.h +0 -406
  71. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructTreeRoot.h +0 -89
  72. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/TextOutputDev.h +0 -918
  73. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UTF.h +0 -112
  74. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCClassTables.h +0 -983
  75. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCompTables.h +0 -328
  76. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeDecompTables.h +0 -7181
  77. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMap.h +0 -128
  78. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapFuncs.h +0 -35
  79. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapTables.h +0 -84
  80. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeTypeTable.h +0 -49
  81. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ViewerPreferences.h +0 -87
  82. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/XRef.h +0 -325
  83. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-destination.h +0 -69
  84. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-document.h +0 -135
  85. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-embedded-file.h +0 -55
  86. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font-private.h +0 -68
  87. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font.h +0 -95
  88. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-global.h +0 -132
  89. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-image.h +0 -74
  90. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-renderer.h +0 -77
  91. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-transition.h +0 -85
  92. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page.h +0 -225
  93. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-rectangle.h +0 -66
  94. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-toc.h +0 -72
  95. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-version.h +0 -39
  96. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler_cpp_export.h +0 -42
  97. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiBase.h +0 -66
  98. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiEncodings.h +0 -43
  99. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiIdentifier.h +0 -52
  100. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiTrueType.h +0 -190
  101. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1.h +0 -70
  102. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1C.h +0 -263
  103. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-action.h +0 -454
  104. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-annot.h +0 -333
  105. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-attachment.h +0 -123
  106. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-date.h +0 -32
  107. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-document.h +0 -541
  108. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-enums.h +0 -191
  109. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-features.h +0 -88
  110. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-form-field.h +0 -254
  111. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-layer.h +0 -50
  112. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-macros.h +0 -42
  113. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-media.h +0 -80
  114. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-movie.h +0 -81
  115. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-page.h +0 -424
  116. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-structure-element.h +0 -425
  117. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler.h +0 -259
  118. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooCheckedOps.h +0 -116
  119. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooLikely.h +0 -22
  120. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooString.h +0 -262
  121. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooTimer.h +0 -59
  122. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/ImgWriter.h +0 -39
  123. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/JpegWriter.h +0 -69
  124. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/PNGWriter.h +0 -68
  125. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/TiffWriter.h +0 -70
  126. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gdir.h +0 -96
  127. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gfile.h +0 -156
  128. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gmem.h +0 -201
  129. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/grandom.h +0 -21
  130. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gstrtod.h +0 -45
  131. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler-config.h +0 -155
  132. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler_private_export.h +0 -42
  133. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/Splash.h +0 -336
  134. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashBitmap.h +0 -127
  135. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashClip.h +0 -131
  136. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashErrorCodes.h +0 -50
  137. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFont.h +0 -71
  138. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontEngine.h +0 -72
  139. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontFile.h +0 -64
  140. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFont.h +0 -116
  141. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontEngine.h +0 -89
  142. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFile.h +0 -98
  143. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFileID.h +0 -40
  144. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashGlyphBitmap.h +0 -23
  145. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashMath.h +0 -215
  146. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPath.h +0 -138
  147. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPattern.h +0 -107
  148. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashScreen.h +0 -87
  149. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashState.h +0 -132
  150. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashTypes.h +0 -248
  151. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPath.h +0 -95
  152. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPathScanner.h +0 -136
  153. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-cpp.pc +0 -12
  154. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-glib.pc +0 -12
  155. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler.pc +0 -10
  156. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-cpp.lib +0 -0
  157. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-glib.lib +0 -0
  158. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler.lib +0 -0
  159. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfattach.1 +0 -60
  160. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfdetach.1 +0 -94
  161. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdffonts.1 +0 -128
  162. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfimages.1 +0 -265
  163. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfinfo.1 +0 -198
  164. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfseparate.1 +0 -60
  165. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftocairo.1 +0 -346
  166. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftohtml.1 +0 -118
  167. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftoppm.1 +0 -230
  168. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftops.1 +0 -267
  169. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftotext.1 +0 -157
  170. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfunite.1 +0 -43
  171. package/src/lib/win32/poppler-22.04.0/share/poppler/CMakeLists.txt +0 -309
  172. package/src/lib/win32/poppler-22.04.0/share/poppler/Makefile +0 -333
@@ -1,1504 +0,0 @@
1
- //========================================================================
2
- //
3
- // Stream.h
4
- //
5
- // Copyright 1996-2003 Glyph & Cog, LLC
6
- //
7
- //========================================================================
8
-
9
- //========================================================================
10
- //
11
- // Modified under the Poppler project - http://poppler.freedesktop.org
12
- //
13
- // All changes made under the Poppler project to this file are licensed
14
- // under GPL version 2 or later
15
- //
16
- // Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
17
- // Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
18
- // Copyright (C) 2008, 2010, 2011, 2016-2021 Albert Astals Cid <aacid@kde.org>
19
- // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
20
- // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
21
- // Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
22
- // Copyright (C) 2011, 2012, 2016, 2020 William Bader <williambader@hotmail.com>
23
- // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
24
- // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
25
- // Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com>
26
- // Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de>
27
- // Copyright (C) 2013, 2018 Adam Reichold <adamreichold@myopera.com>
28
- // Copyright (C) 2013 Pino Toscano <pino@kde.org>
29
- // Copyright (C) 2019 Volker Krause <vkrause@kde.org>
30
- // Copyright (C) 2019 Alexander Volkov <a.volkov@rusbitech.ru>
31
- // Copyright (C) 2020-2022 Oliver Sander <oliver.sander@tu-dresden.de>
32
- // Copyright (C) 2020 Philipp Knechtges <philipp-dev@knechtges.com>
33
- // Copyright (C) 2021 Hubert Figuiere <hub@figuiere.net>
34
- // Copyright (C) 2021 Christian Persch <chpe@src.gnome.org>
35
- // Copyright (C) 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
36
- //
37
- // To see a description of the changes please see the Changelog file that
38
- // came with your tarball or type make ChangeLog if you are building from git
39
- //
40
- //========================================================================
41
-
42
- #ifndef STREAM_H
43
- #define STREAM_H
44
-
45
- #include <atomic>
46
- #include <cstdio>
47
- #include <vector>
48
-
49
- #include "poppler-config.h"
50
- #include "poppler_private_export.h"
51
- #include "Object.h"
52
-
53
- class GooFile;
54
- class BaseStream;
55
- class CachedFile;
56
- class SplashBitmap;
57
-
58
- //------------------------------------------------------------------------
59
-
60
- enum StreamKind
61
- {
62
- strFile,
63
- strCachedFile,
64
- strASCIIHex,
65
- strASCII85,
66
- strLZW,
67
- strRunLength,
68
- strCCITTFax,
69
- strDCT,
70
- strFlate,
71
- strJBIG2,
72
- strJPX,
73
- strWeird, // internal-use stream types
74
- strCrypt // internal-use to detect decode streams
75
- };
76
-
77
- enum StreamColorSpaceMode
78
- {
79
- streamCSNone,
80
- streamCSDeviceGray,
81
- streamCSDeviceRGB,
82
- streamCSDeviceCMYK
83
- };
84
-
85
- //------------------------------------------------------------------------
86
-
87
- // This is in Stream.h instead of Decrypt.h to avoid really annoying
88
- // include file dependency loops.
89
- enum CryptAlgorithm
90
- {
91
- cryptRC4,
92
- cryptAES,
93
- cryptAES256,
94
- cryptNone
95
- };
96
-
97
- //------------------------------------------------------------------------
98
-
99
- typedef struct _ByteRange
100
- {
101
- unsigned int offset;
102
- unsigned int length;
103
- } ByteRange;
104
-
105
- //------------------------------------------------------------------------
106
- // Stream (base class)
107
- //------------------------------------------------------------------------
108
-
109
- class POPPLER_PRIVATE_EXPORT Stream
110
- {
111
- public:
112
- // Constructor.
113
- Stream();
114
-
115
- // Destructor.
116
- virtual ~Stream();
117
-
118
- Stream(const Stream &) = delete;
119
- Stream &operator=(const Stream &other) = delete;
120
-
121
- // Get kind of stream.
122
- virtual StreamKind getKind() const = 0;
123
-
124
- // Reset stream to beginning.
125
- virtual void reset() = 0;
126
-
127
- // Close down the stream.
128
- virtual void close();
129
-
130
- inline int doGetChars(int nChars, unsigned char *buffer)
131
- {
132
- if (hasGetChars()) {
133
- return getChars(nChars, buffer);
134
- } else {
135
- for (int i = 0; i < nChars; ++i) {
136
- const int c = getChar();
137
- if (likely(c != EOF)) {
138
- buffer[i] = c;
139
- } else {
140
- return i;
141
- }
142
- }
143
- return nChars;
144
- }
145
- }
146
-
147
- inline void fillString(std::string &s)
148
- {
149
- unsigned char readBuf[4096];
150
- int readChars;
151
- reset();
152
- while ((readChars = doGetChars(4096, readBuf)) != 0) {
153
- s.append((const char *)readBuf, readChars);
154
- }
155
- }
156
-
157
- inline void fillGooString(GooString *s) { fillString(s->toNonConstStr()); }
158
-
159
- inline std::vector<unsigned char> toUnsignedChars(int initialSize = 4096, int sizeIncrement = 4096)
160
- {
161
- std::vector<unsigned char> buf(initialSize);
162
-
163
- int readChars;
164
- int size = initialSize;
165
- int length = 0;
166
- int charsToRead = initialSize;
167
- bool continueReading = true;
168
- reset();
169
- while (continueReading && (readChars = doGetChars(charsToRead, buf.data() + length)) != 0) {
170
- length += readChars;
171
- if (readChars == charsToRead) {
172
- if (lookChar() != EOF) {
173
- size += sizeIncrement;
174
- charsToRead = sizeIncrement;
175
- buf.resize(size);
176
- } else {
177
- continueReading = false;
178
- }
179
- } else {
180
- continueReading = false;
181
- }
182
- }
183
-
184
- buf.resize(length);
185
- return buf;
186
- }
187
-
188
- // Get next char from stream.
189
- virtual int getChar() = 0;
190
-
191
- // Peek at next char in stream.
192
- virtual int lookChar() = 0;
193
-
194
- // Get next char from stream without using the predictor.
195
- // This is only used by StreamPredictor.
196
- virtual int getRawChar();
197
- virtual void getRawChars(int nChars, int *buffer);
198
-
199
- // Get next char directly from stream source, without filtering it
200
- virtual int getUnfilteredChar() = 0;
201
-
202
- // Resets the stream without reading anything (even not the headers)
203
- // WARNING: Reading the stream with something else than getUnfilteredChar
204
- // may lead to unexcepted behaviour until you call reset ()
205
- virtual void unfilteredReset() = 0;
206
-
207
- // Get next line from stream.
208
- virtual char *getLine(char *buf, int size);
209
-
210
- // Discard the next <n> bytes from stream. Returns the number of
211
- // bytes discarded, which will be less than <n> only if EOF is
212
- // reached.
213
- virtual unsigned int discardChars(unsigned int n);
214
-
215
- // Get current position in file.
216
- virtual Goffset getPos() = 0;
217
-
218
- // Go to a position in the stream. If <dir> is negative, the
219
- // position is from the end of the file; otherwise the position is
220
- // from the start of the file.
221
- virtual void setPos(Goffset pos, int dir = 0) = 0;
222
-
223
- // Get PostScript command for the filter(s).
224
- virtual GooString *getPSFilter(int psLevel, const char *indent);
225
-
226
- // Does this stream type potentially contain non-printable chars?
227
- virtual bool isBinary(bool last = true) const = 0;
228
-
229
- // Get the BaseStream of this stream.
230
- virtual BaseStream *getBaseStream() = 0;
231
-
232
- // Get the stream after the last decoder (this may be a BaseStream
233
- // or a DecryptStream).
234
- virtual Stream *getUndecodedStream() = 0;
235
-
236
- // Get the dictionary associated with this stream.
237
- virtual Dict *getDict() = 0;
238
- virtual Object *getDictObject() = 0;
239
-
240
- // Is this an encoding filter?
241
- virtual bool isEncoder() const { return false; }
242
-
243
- // Get image parameters which are defined by the stream contents.
244
- virtual void getImageParams(int * /*bitsPerComponent*/, StreamColorSpaceMode * /*csMode*/) { }
245
-
246
- // Return the next stream in the "stack".
247
- virtual Stream *getNextStream() const { return nullptr; }
248
-
249
- // Add filters to this stream according to the parameters in <dict>.
250
- // Returns the new stream.
251
- Stream *addFilters(Dict *dict, int recursion = 0);
252
-
253
- // Returns true if this stream includes a crypt filter.
254
- bool isEncrypted() const;
255
-
256
- private:
257
- friend class Object; // for incRef/decRef
258
-
259
- // Reference counting.
260
- int incRef() { return ++ref; }
261
- int decRef() { return --ref; }
262
-
263
- virtual bool hasGetChars() { return false; }
264
- virtual int getChars(int nChars, unsigned char *buffer);
265
-
266
- Stream *makeFilter(const char *name, Stream *str, Object *params, int recursion = 0, Dict *dict = nullptr);
267
-
268
- std::atomic_int ref; // reference count
269
- };
270
-
271
- //------------------------------------------------------------------------
272
- // OutStream
273
- //
274
- // This is the base class for all streams that output to a file
275
- //------------------------------------------------------------------------
276
- class POPPLER_PRIVATE_EXPORT OutStream
277
- {
278
- public:
279
- // Constructor.
280
- OutStream();
281
-
282
- // Desctructor.
283
- virtual ~OutStream();
284
-
285
- OutStream(const OutStream &) = delete;
286
- OutStream &operator=(const OutStream &other) = delete;
287
-
288
- // Close the stream
289
- virtual void close() = 0;
290
-
291
- // Return position in stream
292
- virtual Goffset getPos() = 0;
293
-
294
- // Put a char in the stream
295
- virtual void put(char c) = 0;
296
-
297
- virtual void printf(const char *format, ...) GCC_PRINTF_FORMAT(2, 3) = 0;
298
- };
299
-
300
- //------------------------------------------------------------------------
301
- // FileOutStream
302
- //------------------------------------------------------------------------
303
- class POPPLER_PRIVATE_EXPORT FileOutStream : public OutStream
304
- {
305
- public:
306
- FileOutStream(FILE *fa, Goffset startA);
307
-
308
- ~FileOutStream() override;
309
-
310
- void close() override;
311
-
312
- Goffset getPos() override;
313
-
314
- void put(char c) override;
315
-
316
- void printf(const char *format, ...) override GCC_PRINTF_FORMAT(2, 3);
317
-
318
- private:
319
- FILE *f;
320
- Goffset start;
321
- };
322
-
323
- //------------------------------------------------------------------------
324
- // BaseStream
325
- //
326
- // This is the base class for all streams that read directly from a file.
327
- //------------------------------------------------------------------------
328
-
329
- class POPPLER_PRIVATE_EXPORT BaseStream : public Stream
330
- {
331
- public:
332
- // TODO Mirar si puedo hacer que dictA sea un puntero
333
- BaseStream(Object &&dictA, Goffset lengthA);
334
- ~BaseStream() override;
335
- virtual BaseStream *copy() = 0;
336
- virtual Stream *makeSubStream(Goffset start, bool limited, Goffset length, Object &&dict) = 0;
337
- void setPos(Goffset pos, int dir = 0) override = 0;
338
- bool isBinary(bool last = true) const override { return last; }
339
- BaseStream *getBaseStream() override { return this; }
340
- Stream *getUndecodedStream() override { return this; }
341
- Dict *getDict() override { return dict.getDict(); }
342
- Object *getDictObject() override { return &dict; }
343
- virtual GooString *getFileName() { return nullptr; }
344
- virtual Goffset getLength() { return length; }
345
-
346
- // Get/set position of first byte of stream within the file.
347
- virtual Goffset getStart() = 0;
348
- virtual void moveStart(Goffset delta) = 0;
349
-
350
- protected:
351
- Goffset length;
352
- Object dict;
353
- };
354
-
355
- //------------------------------------------------------------------------
356
- // BaseInputStream
357
- //------------------------------------------------------------------------
358
-
359
- class POPPLER_PRIVATE_EXPORT BaseSeekInputStream : public BaseStream
360
- {
361
- public:
362
- // This enum is used to tell the seek() method how it must reposition
363
- // the stream offset.
364
- enum SeekType
365
- {
366
- SeekSet, // the offset is set to offset bytes
367
- SeekCur, // the offset is set to its current location plus offset bytes
368
- SeekEnd // the offset is set to the size of the stream plus offset bytes
369
- };
370
-
371
- BaseSeekInputStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA);
372
- ~BaseSeekInputStream() override;
373
- StreamKind getKind() const override { return strWeird; }
374
- void reset() override;
375
- void close() override;
376
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
377
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
378
- Goffset getPos() override { return bufPos + (bufPtr - buf); }
379
- void setPos(Goffset pos, int dir = 0) override;
380
- Goffset getStart() override { return start; }
381
- void moveStart(Goffset delta) override;
382
-
383
- int getUnfilteredChar() override { return getChar(); }
384
- void unfilteredReset() override { reset(); }
385
-
386
- protected:
387
- Goffset start;
388
- bool limited;
389
-
390
- private:
391
- bool fillBuf();
392
-
393
- bool hasGetChars() override { return true; }
394
- int getChars(int nChars, unsigned char *buffer) override;
395
-
396
- virtual Goffset currentPos() const = 0;
397
- virtual void setCurrentPos(Goffset offset) = 0;
398
- virtual Goffset read(char *buf, Goffset size) = 0;
399
-
400
- static constexpr int seekInputStreamBufSize = 1024;
401
- char buf[seekInputStreamBufSize];
402
- char *bufPtr;
403
- char *bufEnd;
404
- Goffset bufPos;
405
- Goffset savePos;
406
- bool saved;
407
- };
408
-
409
- //------------------------------------------------------------------------
410
- // FilterStream
411
- //
412
- // This is the base class for all streams that filter another stream.
413
- //------------------------------------------------------------------------
414
-
415
- class FilterStream : public Stream
416
- {
417
- public:
418
- explicit FilterStream(Stream *strA);
419
- ~FilterStream() override;
420
- void close() override;
421
- Goffset getPos() override { return str->getPos(); }
422
- void setPos(Goffset pos, int dir = 0) override;
423
- BaseStream *getBaseStream() override { return str->getBaseStream(); }
424
- Stream *getUndecodedStream() override { return str->getUndecodedStream(); }
425
- Dict *getDict() override { return str->getDict(); }
426
- Object *getDictObject() override { return str->getDictObject(); }
427
- Stream *getNextStream() const override { return str; }
428
-
429
- int getUnfilteredChar() override { return str->getUnfilteredChar(); }
430
- void unfilteredReset() override { str->unfilteredReset(); }
431
-
432
- protected:
433
- Stream *str;
434
- };
435
-
436
- //------------------------------------------------------------------------
437
- // ImageStream
438
- //------------------------------------------------------------------------
439
-
440
- class POPPLER_PRIVATE_EXPORT ImageStream
441
- {
442
- public:
443
- // Create an image stream object for an image with the specified
444
- // parameters. Note that these are the actual image parameters,
445
- // which may be different from the predictor parameters.
446
- ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA);
447
-
448
- ~ImageStream();
449
-
450
- ImageStream(const ImageStream &) = delete;
451
- ImageStream &operator=(const ImageStream &other) = delete;
452
-
453
- // Reset the stream.
454
- void reset();
455
-
456
- // Close the stream previously reset
457
- void close();
458
-
459
- // Gets the next pixel from the stream. <pix> should be able to hold
460
- // at least nComps elements. Returns false at end of file.
461
- bool getPixel(unsigned char *pix);
462
-
463
- // Returns a pointer to the next line of pixels. Returns NULL at
464
- // end of file.
465
- unsigned char *getLine();
466
-
467
- // Skip an entire line from the image.
468
- void skipLine();
469
-
470
- private:
471
- Stream *str; // base stream
472
- int width; // pixels per line
473
- int nComps; // components per pixel
474
- int nBits; // bits per component
475
- int nVals; // components per line
476
- int inputLineSize; // input line buffer size
477
- unsigned char *inputLine; // input line buffer
478
- unsigned char *imgLine; // line buffer
479
- int imgIdx; // current index in imgLine
480
- };
481
-
482
- //------------------------------------------------------------------------
483
- // StreamPredictor
484
- //------------------------------------------------------------------------
485
-
486
- class StreamPredictor
487
- {
488
- public:
489
- // Create a predictor object. Note that the parameters are for the
490
- // predictor, and may not match the actual image parameters.
491
- StreamPredictor(Stream *strA, int predictorA, int widthA, int nCompsA, int nBitsA);
492
-
493
- ~StreamPredictor();
494
-
495
- StreamPredictor(const StreamPredictor &) = delete;
496
- StreamPredictor &operator=(const StreamPredictor &) = delete;
497
-
498
- bool isOk() { return ok; }
499
-
500
- int lookChar();
501
- int getChar();
502
- int getChars(int nChars, unsigned char *buffer);
503
-
504
- private:
505
- bool getNextLine();
506
-
507
- Stream *str; // base stream
508
- int predictor; // predictor
509
- int width; // pixels per line
510
- int nComps; // components per pixel
511
- int nBits; // bits per component
512
- int nVals; // components per line
513
- int pixBytes; // bytes per pixel
514
- int rowBytes; // bytes per line
515
- unsigned char *predLine; // line buffer
516
- int predIdx; // current index in predLine
517
- bool ok;
518
- };
519
-
520
- //------------------------------------------------------------------------
521
- // FileStream
522
- //------------------------------------------------------------------------
523
-
524
- #define fileStreamBufSize 256
525
-
526
- class POPPLER_PRIVATE_EXPORT FileStream : public BaseStream
527
- {
528
- public:
529
- FileStream(GooFile *fileA, Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA);
530
- ~FileStream() override;
531
- BaseStream *copy() override;
532
- Stream *makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) override;
533
- StreamKind getKind() const override { return strFile; }
534
- void reset() override;
535
- void close() override;
536
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
537
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
538
- Goffset getPos() override { return bufPos + (bufPtr - buf); }
539
- void setPos(Goffset pos, int dir = 0) override;
540
- Goffset getStart() override { return start; }
541
- void moveStart(Goffset delta) override;
542
-
543
- int getUnfilteredChar() override { return getChar(); }
544
- void unfilteredReset() override { reset(); }
545
-
546
- bool getNeedsEncryptionOnSave() const { return needsEncryptionOnSave; }
547
- void setNeedsEncryptionOnSave(bool needsEncryptionOnSaveA) { needsEncryptionOnSave = needsEncryptionOnSaveA; }
548
-
549
- private:
550
- bool fillBuf();
551
-
552
- bool hasGetChars() override { return true; }
553
- int getChars(int nChars, unsigned char *buffer) override
554
- {
555
- int n, m;
556
-
557
- n = 0;
558
- while (n < nChars) {
559
- if (bufPtr >= bufEnd) {
560
- if (!fillBuf()) {
561
- break;
562
- }
563
- }
564
- m = (int)(bufEnd - bufPtr);
565
- if (m > nChars - n) {
566
- m = nChars - n;
567
- }
568
- memcpy(buffer + n, bufPtr, m);
569
- bufPtr += m;
570
- n += m;
571
- }
572
- return n;
573
- }
574
-
575
- private:
576
- GooFile *file;
577
- Goffset offset;
578
- Goffset start;
579
- bool limited;
580
- char buf[fileStreamBufSize];
581
- char *bufPtr;
582
- char *bufEnd;
583
- Goffset bufPos;
584
- Goffset savePos;
585
- bool saved;
586
- bool needsEncryptionOnSave; // Needed for FileStreams that point to "external" files
587
- // and thus when saving we can't do a raw copy
588
- };
589
-
590
- //------------------------------------------------------------------------
591
- // CachedFileStream
592
- //------------------------------------------------------------------------
593
-
594
- #define cachedStreamBufSize 1024
595
-
596
- class POPPLER_PRIVATE_EXPORT CachedFileStream : public BaseStream
597
- {
598
- public:
599
- CachedFileStream(CachedFile *ccA, Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA);
600
- ~CachedFileStream() override;
601
- BaseStream *copy() override;
602
- Stream *makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) override;
603
- StreamKind getKind() const override { return strCachedFile; }
604
- void reset() override;
605
- void close() override;
606
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
607
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
608
- Goffset getPos() override { return bufPos + (bufPtr - buf); }
609
- void setPos(Goffset pos, int dir = 0) override;
610
- Goffset getStart() override { return start; }
611
- void moveStart(Goffset delta) override;
612
-
613
- int getUnfilteredChar() override { return getChar(); }
614
- void unfilteredReset() override { reset(); }
615
-
616
- private:
617
- bool fillBuf();
618
-
619
- CachedFile *cc;
620
- Goffset start;
621
- bool limited;
622
- char buf[cachedStreamBufSize];
623
- char *bufPtr;
624
- char *bufEnd;
625
- unsigned int bufPos;
626
- int savePos;
627
- bool saved;
628
- };
629
-
630
- //------------------------------------------------------------------------
631
- // MemStream
632
- //------------------------------------------------------------------------
633
-
634
- template<typename T>
635
- class BaseMemStream : public BaseStream
636
- {
637
- public:
638
- BaseMemStream(T *bufA, Goffset startA, Goffset lengthA, Object &&dictA) : BaseStream(std::move(dictA), lengthA)
639
- {
640
- buf = bufA;
641
- start = startA;
642
- length = lengthA;
643
- bufEnd = buf + start + length;
644
- bufPtr = buf + start;
645
- }
646
-
647
- BaseStream *copy() override { return new BaseMemStream(buf, start, length, dict.copy()); }
648
-
649
- Stream *makeSubStream(Goffset startA, bool limited, Goffset lengthA, Object &&dictA) override
650
- {
651
- Goffset newLength;
652
-
653
- if (!limited || startA + lengthA > start + length) {
654
- newLength = start + length - startA;
655
- } else {
656
- newLength = lengthA;
657
- }
658
- return new BaseMemStream(buf, startA, newLength, std::move(dictA));
659
- }
660
-
661
- StreamKind getKind() const override { return strWeird; }
662
-
663
- void reset() override { bufPtr = buf + start; }
664
-
665
- void close() override { }
666
-
667
- int getChar() override { return (bufPtr < bufEnd) ? (*bufPtr++ & 0xff) : EOF; }
668
-
669
- int lookChar() override { return (bufPtr < bufEnd) ? (*bufPtr & 0xff) : EOF; }
670
-
671
- Goffset getPos() override { return (int)(bufPtr - buf); }
672
-
673
- void setPos(Goffset pos, int dir = 0) override
674
- {
675
- unsigned int i;
676
-
677
- if (dir >= 0) {
678
- i = pos;
679
- } else {
680
- i = start + length - pos;
681
- }
682
- if (i < start) {
683
- i = start;
684
- } else if (i > start + length) {
685
- i = start + length;
686
- }
687
- bufPtr = buf + i;
688
- }
689
-
690
- Goffset getStart() override { return start; }
691
-
692
- void moveStart(Goffset delta) override
693
- {
694
- start += delta;
695
- length -= delta;
696
- bufPtr = buf + start;
697
- }
698
-
699
- int getUnfilteredChar() override { return getChar(); }
700
-
701
- void unfilteredReset() override { reset(); }
702
-
703
- protected:
704
- T *buf;
705
-
706
- private:
707
- bool hasGetChars() override { return true; }
708
-
709
- int getChars(int nChars, unsigned char *buffer) override
710
- {
711
- int n;
712
-
713
- if (unlikely(nChars <= 0)) {
714
- return 0;
715
- }
716
- if (unlikely(bufPtr >= bufEnd)) {
717
- return 0;
718
- }
719
- if (bufEnd - bufPtr < nChars) {
720
- n = (int)(bufEnd - bufPtr);
721
- } else {
722
- n = nChars;
723
- }
724
- memcpy(buffer, bufPtr, n);
725
- bufPtr += n;
726
- return n;
727
- }
728
-
729
- Goffset start;
730
- T *bufEnd;
731
- T *bufPtr;
732
- };
733
-
734
- class POPPLER_PRIVATE_EXPORT MemStream : public BaseMemStream<const char>
735
- {
736
- public:
737
- MemStream(const char *bufA, Goffset startA, Goffset lengthA, Object &&dictA) : BaseMemStream(bufA, startA, lengthA, std::move(dictA)) { }
738
- ~MemStream() override;
739
- };
740
-
741
- class AutoFreeMemStream : public BaseMemStream<char>
742
- {
743
- bool filterRemovalForbidden = false;
744
-
745
- public:
746
- // AutoFreeMemStream takes ownership over the buffer.
747
- // The buffer should be created using gmalloc().
748
- AutoFreeMemStream(char *bufA, Goffset startA, Goffset lengthA, Object &&dictA) : BaseMemStream(bufA, startA, lengthA, std::move(dictA)) { }
749
- ~AutoFreeMemStream() override;
750
-
751
- // A hack to deal with the strange behaviour of PDFDoc::writeObject().
752
- bool isFilterRemovalForbidden() const;
753
- void setFilterRemovalForbidden(bool forbidden);
754
- };
755
-
756
- //------------------------------------------------------------------------
757
- // EmbedStream
758
- //
759
- // This is a special stream type used for embedded streams (inline
760
- // images). It reads directly from the base stream -- after the
761
- // EmbedStream is deleted, reads from the base stream will proceed where
762
- // the BaseStream left off. Note that this is very different behavior
763
- // that creating a new FileStream (using makeSubStream).
764
- //------------------------------------------------------------------------
765
-
766
- class POPPLER_PRIVATE_EXPORT EmbedStream : public BaseStream
767
- {
768
- public:
769
- EmbedStream(Stream *strA, Object &&dictA, bool limitedA, Goffset lengthA, bool reusableA = false);
770
- ~EmbedStream() override;
771
- BaseStream *copy() override;
772
- Stream *makeSubStream(Goffset start, bool limitedA, Goffset lengthA, Object &&dictA) override;
773
- StreamKind getKind() const override { return str->getKind(); }
774
- void reset() override;
775
- int getChar() override;
776
- int lookChar() override;
777
- Goffset getPos() override;
778
- void setPos(Goffset pos, int dir = 0) override;
779
- Goffset getStart() override;
780
- void moveStart(Goffset delta) override;
781
-
782
- int getUnfilteredChar() override { return str->getUnfilteredChar(); }
783
- void unfilteredReset() override { str->unfilteredReset(); }
784
-
785
- void rewind();
786
- void restore();
787
-
788
- private:
789
- bool hasGetChars() override { return true; }
790
- int getChars(int nChars, unsigned char *buffer) override;
791
-
792
- Stream *str;
793
- bool limited;
794
- bool reusable;
795
- bool record;
796
- bool replay;
797
- unsigned char *bufData;
798
- long bufMax;
799
- long bufLen;
800
- long bufPos;
801
- Goffset start;
802
- };
803
-
804
- //------------------------------------------------------------------------
805
- // ASCIIHexStream
806
- //------------------------------------------------------------------------
807
-
808
- class ASCIIHexStream : public FilterStream
809
- {
810
- public:
811
- explicit ASCIIHexStream(Stream *strA);
812
- ~ASCIIHexStream() override;
813
- StreamKind getKind() const override { return strASCIIHex; }
814
- void reset() override;
815
- int getChar() override
816
- {
817
- int c = lookChar();
818
- buf = EOF;
819
- return c;
820
- }
821
- int lookChar() override;
822
- GooString *getPSFilter(int psLevel, const char *indent) override;
823
- bool isBinary(bool last = true) const override;
824
-
825
- private:
826
- int buf;
827
- bool eof;
828
- };
829
-
830
- //------------------------------------------------------------------------
831
- // ASCII85Stream
832
- //------------------------------------------------------------------------
833
-
834
- class ASCII85Stream : public FilterStream
835
- {
836
- public:
837
- explicit ASCII85Stream(Stream *strA);
838
- ~ASCII85Stream() override;
839
- StreamKind getKind() const override { return strASCII85; }
840
- void reset() override;
841
- int getChar() override
842
- {
843
- int ch = lookChar();
844
- ++index;
845
- return ch;
846
- }
847
- int lookChar() override;
848
- GooString *getPSFilter(int psLevel, const char *indent) override;
849
- bool isBinary(bool last = true) const override;
850
-
851
- private:
852
- int c[5];
853
- int b[4];
854
- int index, n;
855
- bool eof;
856
- };
857
-
858
- //------------------------------------------------------------------------
859
- // LZWStream
860
- //------------------------------------------------------------------------
861
-
862
- class LZWStream : public FilterStream
863
- {
864
- public:
865
- LZWStream(Stream *strA, int predictor, int columns, int colors, int bits, int earlyA);
866
- ~LZWStream() override;
867
- StreamKind getKind() const override { return strLZW; }
868
- void reset() override;
869
- int getChar() override;
870
- int lookChar() override;
871
- int getRawChar() override;
872
- void getRawChars(int nChars, int *buffer) override;
873
- GooString *getPSFilter(int psLevel, const char *indent) override;
874
- bool isBinary(bool last = true) const override;
875
-
876
- private:
877
- bool hasGetChars() override { return true; }
878
- int getChars(int nChars, unsigned char *buffer) override;
879
-
880
- inline int doGetRawChar()
881
- {
882
- if (eof) {
883
- return EOF;
884
- }
885
- if (seqIndex >= seqLength) {
886
- if (!processNextCode()) {
887
- return EOF;
888
- }
889
- }
890
- return seqBuf[seqIndex++];
891
- }
892
-
893
- StreamPredictor *pred; // predictor
894
- int early; // early parameter
895
- bool eof; // true if at eof
896
- unsigned int inputBuf; // input buffer
897
- int inputBits; // number of bits in input buffer
898
- struct
899
- { // decoding table
900
- int length;
901
- int head;
902
- unsigned char tail;
903
- } table[4097];
904
- int nextCode; // next code to be used
905
- int nextBits; // number of bits in next code word
906
- int prevCode; // previous code used in stream
907
- int newChar; // next char to be added to table
908
- unsigned char seqBuf[4097]; // buffer for current sequence
909
- int seqLength; // length of current sequence
910
- int seqIndex; // index into current sequence
911
- bool first; // first code after a table clear
912
-
913
- bool processNextCode();
914
- void clearTable();
915
- int getCode();
916
- };
917
-
918
- //------------------------------------------------------------------------
919
- // RunLengthStream
920
- //------------------------------------------------------------------------
921
-
922
- class RunLengthStream : public FilterStream
923
- {
924
- public:
925
- explicit RunLengthStream(Stream *strA);
926
- ~RunLengthStream() override;
927
- StreamKind getKind() const override { return strRunLength; }
928
- void reset() override;
929
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
930
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
931
- GooString *getPSFilter(int psLevel, const char *indent) override;
932
- bool isBinary(bool last = true) const override;
933
-
934
- private:
935
- bool hasGetChars() override { return true; }
936
- int getChars(int nChars, unsigned char *buffer) override;
937
-
938
- char buf[128]; // buffer
939
- char *bufPtr; // next char to read
940
- char *bufEnd; // end of buffer
941
- bool eof;
942
-
943
- bool fillBuf();
944
- };
945
-
946
- //------------------------------------------------------------------------
947
- // CCITTFaxStream
948
- //------------------------------------------------------------------------
949
-
950
- struct CCITTCodeTable;
951
-
952
- class CCITTFaxStream : public FilterStream
953
- {
954
- public:
955
- CCITTFaxStream(Stream *strA, int encodingA, bool endOfLineA, bool byteAlignA, int columnsA, int rowsA, bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA);
956
- ~CCITTFaxStream() override;
957
- StreamKind getKind() const override { return strCCITTFax; }
958
- void reset() override;
959
- int getChar() override
960
- {
961
- int c = lookChar();
962
- buf = EOF;
963
- return c;
964
- }
965
- int lookChar() override;
966
- GooString *getPSFilter(int psLevel, const char *indent) override;
967
- bool isBinary(bool last = true) const override;
968
-
969
- void unfilteredReset() override;
970
-
971
- int getEncoding() { return encoding; }
972
- bool getEndOfLine() { return endOfLine; }
973
- bool getEncodedByteAlign() { return byteAlign; }
974
- bool getEndOfBlock() { return endOfBlock; }
975
- int getColumns() { return columns; }
976
- bool getBlackIs1() { return black; }
977
- int getDamagedRowsBeforeError() { return damagedRowsBeforeError; }
978
-
979
- private:
980
- void ccittReset(bool unfiltered);
981
- int encoding; // 'K' parameter
982
- bool endOfLine; // 'EndOfLine' parameter
983
- bool byteAlign; // 'EncodedByteAlign' parameter
984
- int columns; // 'Columns' parameter
985
- int rows; // 'Rows' parameter
986
- bool endOfBlock; // 'EndOfBlock' parameter
987
- bool black; // 'BlackIs1' parameter
988
- int damagedRowsBeforeError; // 'DamagedRowsBeforeError' parameter
989
- bool eof; // true if at eof
990
- bool nextLine2D; // true if next line uses 2D encoding
991
- int row; // current row
992
- unsigned int inputBuf; // input buffer
993
- int inputBits; // number of bits in input buffer
994
- int *codingLine; // coding line changing elements
995
- int *refLine; // reference line changing elements
996
- int a0i; // index into codingLine
997
- bool err; // error on current line
998
- int outputBits; // remaining ouput bits
999
- int buf; // character buffer
1000
-
1001
- void addPixels(int a1, int blackPixels);
1002
- void addPixelsNeg(int a1, int blackPixels);
1003
- short getTwoDimCode();
1004
- short getWhiteCode();
1005
- short getBlackCode();
1006
- short lookBits(int n);
1007
- void eatBits(int n)
1008
- {
1009
- if ((inputBits -= n) < 0) {
1010
- inputBits = 0;
1011
- }
1012
- }
1013
- };
1014
-
1015
- #ifndef ENABLE_LIBJPEG
1016
- //------------------------------------------------------------------------
1017
- // DCTStream
1018
- //------------------------------------------------------------------------
1019
-
1020
- // DCT component info
1021
- struct DCTCompInfo
1022
- {
1023
- int id; // component ID
1024
- int hSample, vSample; // horiz/vert sampling resolutions
1025
- int quantTable; // quantization table number
1026
- int prevDC; // DC coefficient accumulator
1027
- };
1028
-
1029
- struct DCTScanInfo
1030
- {
1031
- bool comp[4]; // comp[i] is set if component i is
1032
- // included in this scan
1033
- int numComps; // number of components in the scan
1034
- int dcHuffTable[4]; // DC Huffman table numbers
1035
- int acHuffTable[4]; // AC Huffman table numbers
1036
- int firstCoeff, lastCoeff; // first and last DCT coefficient
1037
- int ah, al; // successive approximation parameters
1038
- };
1039
-
1040
- // DCT Huffman decoding table
1041
- struct DCTHuffTable
1042
- {
1043
- unsigned char firstSym[17]; // first symbol for this bit length
1044
- unsigned short firstCode[17]; // first code for this bit length
1045
- unsigned short numCodes[17]; // number of codes of this bit length
1046
- unsigned char sym[256]; // symbols
1047
- };
1048
-
1049
- class DCTStream : public FilterStream
1050
- {
1051
- public:
1052
- DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
1053
- ~DCTStream() override;
1054
- StreamKind getKind() const override { return strDCT; }
1055
- void reset() override;
1056
- void close() override;
1057
- int getChar() override;
1058
- int lookChar() override;
1059
- GooString *getPSFilter(int psLevel, const char *indent) override;
1060
- bool isBinary(bool last = true) const override;
1061
-
1062
- void unfilteredReset() override;
1063
-
1064
- private:
1065
- void dctReset(bool unfiltered);
1066
- bool progressive; // set if in progressive mode
1067
- bool interleaved; // set if in interleaved mode
1068
- int width, height; // image size
1069
- int mcuWidth, mcuHeight; // size of min coding unit, in data units
1070
- int bufWidth, bufHeight; // frameBuf size
1071
- DCTCompInfo compInfo[4]; // info for each component
1072
- DCTScanInfo scanInfo; // info for the current scan
1073
- int numComps; // number of components in image
1074
- int colorXform; // color transform: -1 = unspecified
1075
- // 0 = none
1076
- // 1 = YUV/YUVK -> RGB/CMYK
1077
- bool gotJFIFMarker; // set if APP0 JFIF marker was present
1078
- bool gotAdobeMarker; // set if APP14 Adobe marker was present
1079
- int restartInterval; // restart interval, in MCUs
1080
- unsigned short quantTables[4][64]; // quantization tables
1081
- int numQuantTables; // number of quantization tables
1082
- DCTHuffTable dcHuffTables[4]; // DC Huffman tables
1083
- DCTHuffTable acHuffTables[4]; // AC Huffman tables
1084
- int numDCHuffTables; // number of DC Huffman tables
1085
- int numACHuffTables; // number of AC Huffman tables
1086
- unsigned char *rowBuf[4][32]; // buffer for one MCU (non-progressive mode)
1087
- int *frameBuf[4]; // buffer for frame (progressive mode)
1088
- int comp, x, y, dy; // current position within image/MCU
1089
- int restartCtr; // MCUs left until restart
1090
- int restartMarker; // next restart marker
1091
- int eobRun; // number of EOBs left in the current run
1092
- int inputBuf; // input buffer for variable length codes
1093
- int inputBits; // number of valid bits in input buffer
1094
-
1095
- void restart();
1096
- bool readMCURow();
1097
- void readScan();
1098
- bool readDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]);
1099
- bool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]);
1100
- void decodeImage();
1101
- void transformDataUnit(unsigned short *quantTable, int dataIn[64], unsigned char dataOut[64]);
1102
- int readHuffSym(DCTHuffTable *table);
1103
- int readAmp(int size);
1104
- int readBit();
1105
- bool readHeader();
1106
- bool readBaselineSOF();
1107
- bool readProgressiveSOF();
1108
- bool readScanInfo();
1109
- bool readQuantTables();
1110
- bool readHuffmanTables();
1111
- bool readRestartInterval();
1112
- bool readJFIFMarker();
1113
- bool readAdobeMarker();
1114
- bool readTrailer();
1115
- int readMarker();
1116
- int read16();
1117
- };
1118
-
1119
- #endif
1120
-
1121
- #ifndef ENABLE_ZLIB_UNCOMPRESS
1122
- //------------------------------------------------------------------------
1123
- // FlateStream
1124
- //------------------------------------------------------------------------
1125
-
1126
- # define flateWindow 32768 // buffer size
1127
- # define flateMask (flateWindow - 1)
1128
- # define flateMaxHuffman 15 // max Huffman code length
1129
- # define flateMaxCodeLenCodes 19 // max # code length codes
1130
- # define flateMaxLitCodes 288 // max # literal codes
1131
- # define flateMaxDistCodes 30 // max # distance codes
1132
-
1133
- // Huffman code table entry
1134
- struct FlateCode
1135
- {
1136
- unsigned short len; // code length, in bits
1137
- unsigned short val; // value represented by this code
1138
- };
1139
-
1140
- struct FlateHuffmanTab
1141
- {
1142
- const FlateCode *codes;
1143
- int maxLen;
1144
- };
1145
-
1146
- // Decoding info for length and distance code words
1147
- struct FlateDecode
1148
- {
1149
- int bits; // # extra bits
1150
- int first; // first length/distance
1151
- };
1152
-
1153
- class FlateStream : public FilterStream
1154
- {
1155
- public:
1156
- FlateStream(Stream *strA, int predictor, int columns, int colors, int bits);
1157
- ~FlateStream() override;
1158
- StreamKind getKind() const override { return strFlate; }
1159
- void reset() override;
1160
- int getChar() override;
1161
- int lookChar() override;
1162
- int getRawChar() override;
1163
- void getRawChars(int nChars, int *buffer) override;
1164
- GooString *getPSFilter(int psLevel, const char *indent) override;
1165
- bool isBinary(bool last = true) const override;
1166
- void unfilteredReset() override;
1167
-
1168
- private:
1169
- void flateReset(bool unfiltered);
1170
- inline int doGetRawChar()
1171
- {
1172
- int c;
1173
-
1174
- while (remain == 0) {
1175
- if (endOfBlock && eof) {
1176
- return EOF;
1177
- }
1178
- readSome();
1179
- }
1180
- c = buf[index];
1181
- index = (index + 1) & flateMask;
1182
- --remain;
1183
- return c;
1184
- }
1185
-
1186
- bool hasGetChars() override { return true; }
1187
- int getChars(int nChars, unsigned char *buffer) override;
1188
-
1189
- StreamPredictor *pred; // predictor
1190
- unsigned char buf[flateWindow]; // output data buffer
1191
- int index; // current index into output buffer
1192
- int remain; // number valid bytes in output buffer
1193
- int codeBuf; // input buffer
1194
- int codeSize; // number of bits in input buffer
1195
- int // literal and distance code lengths
1196
- codeLengths[flateMaxLitCodes + flateMaxDistCodes];
1197
- FlateHuffmanTab litCodeTab; // literal code table
1198
- FlateHuffmanTab distCodeTab; // distance code table
1199
- bool compressedBlock; // set if reading a compressed block
1200
- int blockLen; // remaining length of uncompressed block
1201
- bool endOfBlock; // set when end of block is reached
1202
- bool eof; // set when end of stream is reached
1203
-
1204
- static const int // code length code reordering
1205
- codeLenCodeMap[flateMaxCodeLenCodes];
1206
- static const FlateDecode // length decoding info
1207
- lengthDecode[flateMaxLitCodes - 257];
1208
- static const FlateDecode // distance decoding info
1209
- distDecode[flateMaxDistCodes];
1210
- static FlateHuffmanTab // fixed literal code table
1211
- fixedLitCodeTab;
1212
- static FlateHuffmanTab // fixed distance code table
1213
- fixedDistCodeTab;
1214
-
1215
- void readSome();
1216
- bool startBlock();
1217
- void loadFixedCodes();
1218
- bool readDynamicCodes();
1219
- FlateCode *compHuffmanCodes(const int *lengths, int n, int *maxLen);
1220
- int getHuffmanCodeWord(FlateHuffmanTab *tab);
1221
- int getCodeWord(int bits);
1222
- };
1223
- #endif
1224
-
1225
- //------------------------------------------------------------------------
1226
- // EOFStream
1227
- //------------------------------------------------------------------------
1228
-
1229
- class EOFStream : public FilterStream
1230
- {
1231
- public:
1232
- explicit EOFStream(Stream *strA);
1233
- ~EOFStream() override;
1234
- StreamKind getKind() const override { return strWeird; }
1235
- void reset() override { }
1236
- int getChar() override { return EOF; }
1237
- int lookChar() override { return EOF; }
1238
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1239
- bool isBinary(bool /*last = true*/) const override { return false; }
1240
- };
1241
-
1242
- //------------------------------------------------------------------------
1243
- // BufStream
1244
- //------------------------------------------------------------------------
1245
-
1246
- class BufStream : public FilterStream
1247
- {
1248
- public:
1249
- BufStream(Stream *strA, int bufSizeA);
1250
- ~BufStream() override;
1251
- StreamKind getKind() const override { return strWeird; }
1252
- void reset() override;
1253
- int getChar() override;
1254
- int lookChar() override;
1255
- GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; }
1256
- bool isBinary(bool last = true) const override;
1257
-
1258
- int lookChar(int idx);
1259
-
1260
- private:
1261
- int *buf;
1262
- int bufSize;
1263
- };
1264
-
1265
- //------------------------------------------------------------------------
1266
- // FixedLengthEncoder
1267
- //------------------------------------------------------------------------
1268
-
1269
- class FixedLengthEncoder : public FilterStream
1270
- {
1271
- public:
1272
- FixedLengthEncoder(Stream *strA, int lengthA);
1273
- ~FixedLengthEncoder() override;
1274
- StreamKind getKind() const override { return strWeird; }
1275
- void reset() override;
1276
- int getChar() override;
1277
- int lookChar() override;
1278
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1279
- bool isBinary(bool /*last = true*/) const override;
1280
- bool isEncoder() const override { return true; }
1281
-
1282
- private:
1283
- int length;
1284
- int count;
1285
- };
1286
-
1287
- //------------------------------------------------------------------------
1288
- // ASCIIHexEncoder
1289
- //------------------------------------------------------------------------
1290
-
1291
- class ASCIIHexEncoder : public FilterStream
1292
- {
1293
- public:
1294
- explicit ASCIIHexEncoder(Stream *strA);
1295
- ~ASCIIHexEncoder() override;
1296
- StreamKind getKind() const override { return strWeird; }
1297
- void reset() override;
1298
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
1299
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
1300
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1301
- bool isBinary(bool /*last = true*/) const override { return false; }
1302
- bool isEncoder() const override { return true; }
1303
-
1304
- private:
1305
- char buf[4];
1306
- char *bufPtr;
1307
- char *bufEnd;
1308
- int lineLen;
1309
- bool eof;
1310
-
1311
- bool fillBuf();
1312
- };
1313
-
1314
- //------------------------------------------------------------------------
1315
- // ASCII85Encoder
1316
- //------------------------------------------------------------------------
1317
-
1318
- class ASCII85Encoder : public FilterStream
1319
- {
1320
- public:
1321
- explicit ASCII85Encoder(Stream *strA);
1322
- ~ASCII85Encoder() override;
1323
- StreamKind getKind() const override { return strWeird; }
1324
- void reset() override;
1325
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
1326
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
1327
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1328
- bool isBinary(bool /*last = true*/) const override { return false; }
1329
- bool isEncoder() const override { return true; }
1330
-
1331
- private:
1332
- char buf[8];
1333
- char *bufPtr;
1334
- char *bufEnd;
1335
- int lineLen;
1336
- bool eof;
1337
-
1338
- bool fillBuf();
1339
- };
1340
-
1341
- //------------------------------------------------------------------------
1342
- // RunLengthEncoder
1343
- //------------------------------------------------------------------------
1344
-
1345
- class RunLengthEncoder : public FilterStream
1346
- {
1347
- public:
1348
- explicit RunLengthEncoder(Stream *strA);
1349
- ~RunLengthEncoder() override;
1350
- StreamKind getKind() const override { return strWeird; }
1351
- void reset() override;
1352
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
1353
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
1354
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1355
- bool isBinary(bool /*last = true*/) const override { return true; }
1356
- bool isEncoder() const override { return true; }
1357
-
1358
- private:
1359
- char buf[131];
1360
- char *bufPtr;
1361
- char *bufEnd;
1362
- char *nextEnd;
1363
- bool eof;
1364
-
1365
- bool fillBuf();
1366
- };
1367
-
1368
- //------------------------------------------------------------------------
1369
- // LZWEncoder
1370
- //------------------------------------------------------------------------
1371
-
1372
- struct LZWEncoderNode
1373
- {
1374
- int byte;
1375
- LZWEncoderNode *next; // next sibling
1376
- LZWEncoderNode *children; // first child
1377
- };
1378
-
1379
- class LZWEncoder : public FilterStream
1380
- {
1381
- public:
1382
- explicit LZWEncoder(Stream *strA);
1383
- ~LZWEncoder() override;
1384
- StreamKind getKind() const override { return strWeird; }
1385
- void reset() override;
1386
- int getChar() override;
1387
- int lookChar() override;
1388
- GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; }
1389
- bool isBinary(bool last = true) const override { return true; }
1390
- bool isEncoder() const override { return true; }
1391
-
1392
- private:
1393
- LZWEncoderNode table[4096];
1394
- int nextSeq;
1395
- int codeLen;
1396
- unsigned char inBuf[4096];
1397
- int inBufLen;
1398
- int outBuf;
1399
- int outBufLen;
1400
- bool needEOD;
1401
-
1402
- void fillBuf();
1403
- };
1404
-
1405
- //------------------------------------------------------------------------
1406
- // CMYKGrayEncoder
1407
- //------------------------------------------------------------------------
1408
-
1409
- class CMYKGrayEncoder : public FilterStream
1410
- {
1411
- public:
1412
- explicit CMYKGrayEncoder(Stream *strA);
1413
- ~CMYKGrayEncoder() override;
1414
- StreamKind getKind() const override { return strWeird; }
1415
- void reset() override;
1416
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
1417
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
1418
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1419
- bool isBinary(bool /*last = true*/) const override { return false; }
1420
- bool isEncoder() const override { return true; }
1421
-
1422
- private:
1423
- char buf[2];
1424
- char *bufPtr;
1425
- char *bufEnd;
1426
- bool eof;
1427
-
1428
- bool fillBuf();
1429
- };
1430
-
1431
- //------------------------------------------------------------------------
1432
- // RGBGrayEncoder
1433
- //------------------------------------------------------------------------
1434
-
1435
- class RGBGrayEncoder : public FilterStream
1436
- {
1437
- public:
1438
- explicit RGBGrayEncoder(Stream *strA);
1439
- ~RGBGrayEncoder() override;
1440
- StreamKind getKind() const override { return strWeird; }
1441
- void reset() override;
1442
- int getChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
1443
- int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
1444
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1445
- bool isBinary(bool /*last = true*/) const override { return false; }
1446
- bool isEncoder() const override { return true; }
1447
-
1448
- private:
1449
- char buf[2];
1450
- char *bufPtr;
1451
- char *bufEnd;
1452
- bool eof;
1453
-
1454
- bool fillBuf();
1455
- };
1456
-
1457
- //------------------------------------------------------------------------
1458
- // SplashBitmapCMYKEncoder
1459
- //
1460
- // This stream helps to condense SplashBitmaps (mostly of DeviceN8 type) into
1461
- // pure CMYK colors. In particular for a DeviceN8 bitmap it redacts the spot colorants.
1462
- //------------------------------------------------------------------------
1463
-
1464
- class SplashBitmapCMYKEncoder : public Stream
1465
- {
1466
- public:
1467
- explicit SplashBitmapCMYKEncoder(SplashBitmap *bitmapA);
1468
- ~SplashBitmapCMYKEncoder() override;
1469
- StreamKind getKind() const override { return strWeird; }
1470
- void reset() override;
1471
- int getChar() override;
1472
- int lookChar() override;
1473
- GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; }
1474
- bool isBinary(bool /*last = true*/) const override { return true; }
1475
-
1476
- // Although we are an encoder, we return false here, since we do not want do be auto-deleted by
1477
- // successive streams.
1478
- bool isEncoder() const override { return false; }
1479
-
1480
- int getUnfilteredChar() override { return getChar(); }
1481
- void unfilteredReset() override { reset(); }
1482
-
1483
- BaseStream *getBaseStream() override { return nullptr; }
1484
- Stream *getUndecodedStream() override { return this; }
1485
-
1486
- Dict *getDict() override { return nullptr; }
1487
- Object *getDictObject() override { return nullptr; }
1488
-
1489
- Goffset getPos() override;
1490
- void setPos(Goffset pos, int dir = 0) override;
1491
-
1492
- private:
1493
- SplashBitmap *bitmap;
1494
- size_t width;
1495
- int height;
1496
-
1497
- std::vector<unsigned char> buf;
1498
- size_t bufPtr;
1499
- int curLine;
1500
-
1501
- bool fillBuf();
1502
- };
1503
-
1504
- #endif