3131#include " HTMLTextPage.h"
3232
3333#include " BackgroundRenderer/BackgroundRenderer.h"
34+ #include " CoveredTextHandler.h"
3435
3536#include " util/const.h"
3637#include " util/misc.h"
@@ -125,6 +126,15 @@ class HTMLRenderer : public OutputDev
125126
126127 virtual void drawImage (GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, GBool interpolate, int *maskColors, GBool inlineImg);
127128
129+ virtual void drawSoftMaskedImage (GfxState *state, Object *ref, Stream *str,
130+ int width, int height,
131+ GfxImageColorMap *colorMap,
132+ GBool interpolate,
133+ Stream *maskStr,
134+ int maskWidth, int maskHeight,
135+ GfxImageColorMap *maskColorMap,
136+ GBool maskInterpolate);
137+
128138 virtual void stroke (GfxState *state) { css_do_path (state, false ); }
129139 virtual void fill (GfxState *state) { css_do_path (state, true ); }
130140 virtual GBool axialShadedFill (GfxState *state, GfxAxialShading *shading, double tMin, double tMax);
@@ -135,6 +145,8 @@ class HTMLRenderer : public OutputDev
135145 bool can_stroke (GfxState *state) { return css_do_path (state, false , true ); }
136146 bool can_fill (GfxState *state) { return css_do_path (state, true , true ); }
137147
148+ const std::vector<bool > & get_chars_covered () { return covered_text_handler.get_chars_covered (); }
149+
138150protected:
139151 // //////////////////////////////////////////////////
140152 // misc
@@ -215,6 +227,19 @@ class HTMLRenderer : public OutputDev
215227 const GfxRGB * line_color, const GfxRGB * fill_color,
216228 void (*style_function)(void *, std::ostream &) = nullptr, void * style_function_data = nullptr );
217229
230+ // //////////////////////////////////////////////////
231+ // Covered text handling
232+ // //////////////////////////////////////////////////
233+ /*
234+ * Cue CoveredTextHandler that a character is drawn
235+ * x, y: glyph-drawing position, in PDF text object space.
236+ * ax, ay: glyph advance, in glyph space.
237+ */
238+ void add_char_bbox (GfxState *state, double x, double y, double ax, double ay);
239+ /*
240+ * Cue CoveredTextHandler that an image is drawn
241+ */
242+ void add_image_bbox (GfxState *state);
218243
219244 // //////////////////////////////////////////////////
220245 // PDF stuffs
@@ -338,6 +363,8 @@ class HTMLRenderer : public OutputDev
338363 std::string cur_page_filename;
339364
340365 static const std::string MANIFEST_FILENAME ;
366+
367+ CoveredTextHandler covered_text_handler;
341368};
342369
343370} // namespace pdf2htmlEX
0 commit comments