From 61dd91be38e34015b1acb9a0f3841c6cd625f195 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Fri, 12 Jun 2009 12:05:41 +0200 Subject: [PATCH] Use Interpolate flag to decide whether applying image interpolation during rendering Fixes bug #9860 --- poppler/ArthurOutputDev.cc | 4 +- poppler/ArthurOutputDev.h | 4 +- poppler/CairoOutputDev.cc | 92 +++++++++++++++++++++++++------------------ poppler/CairoOutputDev.h | 46 ++++++++++++--------- poppler/Gfx.cc | 47 +++++++++++++++++++--- poppler/OutputDev.cc | 16 +++++--- poppler/OutputDev.h | 12 +++-- poppler/PSOutputDev.cc | 5 +- poppler/PSOutputDev.h | 5 +- poppler/PreScanOutputDev.cc | 11 +++-- poppler/PreScanOutputDev.h | 11 +++-- poppler/SplashOutputDev.cc | 15 +++++-- poppler/SplashOutputDev.h | 11 +++-- utils/HtmlOutputDev.cc | 16 ++++---- utils/HtmlOutputDev.h | 6 +- utils/ImageOutputDev.cc | 20 +++++----- utils/ImageOutputDev.h | 11 +++-- 17 files changed, 207 insertions(+), 125 deletions(-) diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc index 306fbfa..ea00f59 100644 --- a/poppler/ArthurOutputDev.cc +++ b/poppler/ArthurOutputDev.cc @@ -665,7 +665,7 @@ void ArthurOutputDev::endTextObject(GfxState *state) void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) + GBool interpolate, GBool inlineImg) { qDebug() << "drawImageMask"; #if 0 @@ -743,7 +743,7 @@ void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) + GBool interpolate, int *maskColors, GBool inlineImg) { unsigned char *buffer; unsigned int *dest; diff --git a/poppler/ArthurOutputDev.h b/poppler/ArthurOutputDev.h index 35a147e..a88ae6f 100644 --- a/poppler/ArthurOutputDev.h +++ b/poppler/ArthurOutputDev.h @@ -126,10 +126,10 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); //----- Type 3 font operators virtual void type3D0(GfxState *state, double wx, double wy); diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 199e5ea..2fa9815 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -475,8 +475,6 @@ void CairoOutputDev::updateFont(GfxState *state) { if (!currentFont) return; - LOG(printf ("font matrix: %f %f %f %f\n", m11, m12, m21, m22)); - font_face = currentFont->getFontFace(); cairo_set_font_face (cairo, font_face); @@ -493,6 +491,8 @@ void CairoOutputDev::updateFont(GfxState *state) { matrix.x0 = 0; matrix.y0 = 0; + LOG(printf ("font matrix: %f %f %f %f\n", matrix.xx, matrix.yx, matrix.xy, matrix.yy)); + /* Make sure the font matrix is invertible before setting it. cairo * will blow up if we give it a matrix that's not invertible, so we * need to check before passing it to cairo_set_font_matrix. Ignoring it @@ -1105,8 +1105,8 @@ void CairoOutputDev::endMaskClip(GfxState *state) { } void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -1133,15 +1133,15 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, //XXX: it is possible that we should only do sub pixel positioning if // we are rendering fonts */ if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { - drawImageMaskPrescaled(state, ref, str, width, height, invert, inlineImg); + drawImageMaskPrescaled(state, ref, str, width, height, invert, interpolate, inlineImg); } else { - drawImageMaskRegular(state, ref, str, width, height, invert, inlineImg); + drawImageMaskRegular(state, ref, str, width, height, invert, interpolate, inlineImg); } } void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; @@ -1200,7 +1200,8 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream * /* we should actually be using CAIRO_FILTER_NEAREST here. However, * cairo doesn't yet do minifaction filtering causing scaled down * images with CAIRO_FILTER_NEAREST to look really bad */ - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST); cairo_mask (cairo, pattern); @@ -1230,8 +1231,8 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream * void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { unsigned char *buffer; cairo_surface_t *image; cairo_pattern_t *pattern; @@ -1458,7 +1459,8 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream /* we should actually be using CAIRO_FILTER_NEAREST here. However, * cairo doesn't yet do minifaction filtering causing scaled down * images with CAIRO_FILTER_NEAREST to look really bad */ - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST); cairo_save (cairo); @@ -1503,10 +1505,12 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream } void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, - Stream *str, int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert) + Stream *str, int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, int maskWidth, + int maskHeight, GBool maskInvert, + GBool maskInterpolate) { ImageStream *maskImgStr; maskImgStr = new ImageStream(maskStr, maskWidth, 1, 1); @@ -1594,7 +1598,10 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_matrix (maskPattern, &matrix); - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); + cairo_pattern_set_filter (maskPattern, + maskInterpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_mask (cairo, maskPattern); @@ -1627,11 +1634,13 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, //XXX: is this affect by AIS(alpha is shape)? void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { ImageStream *maskImgStr; maskImgStr = new ImageStream(maskStr, maskWidth, @@ -1716,8 +1725,10 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s cairo_pattern_set_matrix (maskPattern, &maskMatrix); //XXX: should set mask filter - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); - cairo_pattern_set_filter (maskPattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); + cairo_pattern_set_filter (maskPattern, + maskInterpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_mask (cairo, maskPattern); @@ -1748,9 +1759,10 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s delete imgStr; } void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + int *maskColors, GBool inlineImg) { unsigned char *buffer; unsigned int *dest; @@ -1830,7 +1842,8 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_pattern_set_matrix (pattern, &matrix); - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_paint (cairo); @@ -1891,7 +1904,7 @@ void CairoImageOutputDev::saveImage(CairoImage *image) void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) + GBool interpolate, GBool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -1923,7 +1936,7 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); image->setImage (surface); setCairo (NULL); @@ -1934,7 +1947,7 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) + GBool interpolate, int *maskColors, GBool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -1966,7 +1979,7 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); + CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); image->setImage (surface); setCairo (NULL); @@ -1978,9 +1991,11 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -2012,8 +2027,8 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); image->setImage (surface); setCairo (NULL); @@ -2025,9 +2040,10 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) + GBool maskInvert, GBool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -2059,8 +2075,8 @@ void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream * cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskInvert); + CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); image->setImage (surface); setCairo (NULL); diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 7a9283f..41a440d 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -180,31 +180,34 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, GBool interpolate, GBool inlineImg); void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg); + int width, int height, GBool invert, GBool interpolate, + GBool inlineImg); void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg); + int width, int height, GBool invert, GBool interpolate, + GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GBool maskInvert); + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GBool maskInvert, GBool maskInterpolate); //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, @@ -365,22 +368,25 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 1b6c3e6..7388d7f 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -3681,6 +3681,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { Dict *dict, *maskDict; int width, height; int bits, maskBits; + GBool interpolate; StreamColorSpaceMode csMode; GBool mask; GBool invert; @@ -3691,6 +3692,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { int maskColors[2*gfxColorMaxComps]; int maskWidth, maskHeight; GBool maskInvert; + GBool maskInterpolate; Stream *maskStr; Object obj1, obj2; int i; @@ -3732,6 +3734,19 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (width < 1 || height < 1) goto err1; + // image interpolation + dict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("I", &obj1); + } + if (obj1.isBool()) + interpolate = obj1.getBool(); + else + interpolate = gFalse; + obj1.free(); + maskInterpolate = gFalse; + // image or mask? dict->lookup("ImageMask", &obj1); if (obj1.isNull()) { @@ -3786,7 +3801,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // draw it if (!contentIsHidden()) { - out->drawImageMask(state, ref, str, width, height, invert, inlineImg); + out->drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); if (out->fillMaskCSPattern(state)) { maskHaveCSPattern = gTrue; doPatternFill(gTrue); @@ -3873,6 +3888,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } maskHeight = obj1.getInt(); obj1.free(); + maskDict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup("I", &obj1); + } + if (obj1.isBool()) + maskInterpolate = obj1.getBool(); + else + maskInterpolate = gFalse; + obj1.free(); maskDict->lookup("BitsPerComponent", &obj1); if (obj1.isNull()) { obj1.free(); @@ -3961,6 +3986,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } maskHeight = obj1.getInt(); obj1.free(); + maskDict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup("I", &obj1); + } + if (obj1.isBool()) + maskInterpolate = obj1.getBool(); + else + maskInterpolate = gFalse; + obj1.free(); maskDict->lookup("ImageMask", &obj1); if (obj1.isNull()) { obj1.free(); @@ -3992,15 +4027,15 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // draw it if (haveSoftMask) { if (!contentIsHidden()) { - out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); } delete maskColorMap; } else if (haveExplicitMask && !contentIsHidden ()) { - out->drawMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskInvert); + out->drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); } else if (!contentIsHidden()) { - out->drawImage(state, ref, str, width, height, colorMap, + out->drawImage(state, ref, str, width, height, colorMap, interpolate, haveColorKeyMask ? maskColors : (int *)NULL, inlineImg); } delete colorMap; diff --git a/poppler/OutputDev.cc b/poppler/OutputDev.cc index 627ab06..32c1281 100644 --- a/poppler/OutputDev.cc +++ b/poppler/OutputDev.cc @@ -94,7 +94,7 @@ GBool OutputDev::beginType3Char(GfxState *state, double x, double y, void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool interpolate, GBool inlineImg) { int i, j; if (inlineImg) { @@ -108,7 +108,7 @@ void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + GBool interpolate, int *maskColors, GBool inlineImg) { int i, j; if (inlineImg) { @@ -124,19 +124,23 @@ void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void OutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GBool maskInvert, + GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); } void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); } void OutputDev::endMarkedContent(GfxState *state) { diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h index 4866631..f08af0b 100644 --- a/poppler/OutputDev.h +++ b/poppler/OutputDev.h @@ -222,22 +222,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, + GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); //----- grouping operators diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index d65d03f..d134853 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -4371,7 +4371,7 @@ void PSOutputDev::endMaskClip(GfxState * state) { void PSOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool interpolate, GBool inlineImg) { int len; len = height * ((width + 7) / 8); @@ -4399,7 +4399,7 @@ void PSOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void PSOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + GBool interpolate, int *maskColors, GBool inlineImg) { int len; len = height * ((width * colorMap->getNumPixelComps() * @@ -4429,6 +4429,7 @@ void PSOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void PSOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert) { diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index ac2416c..6dd5dc2 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -231,13 +231,14 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert); // If current colorspace ist pattern, diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc index 8fcebd4..5676c45 100644 --- a/poppler/PreScanOutputDev.cc +++ b/poppler/PreScanOutputDev.cc @@ -120,7 +120,7 @@ void PreScanOutputDev::endType3Char(GfxState * /*state*/) { void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream *str, int width, int height, GBool /*invert*/, - GBool inlineImg) { + GBool /*interpolate*/, GBool inlineImg) { int i, j; check(state->getFillColorSpace(), state->getFillColor(), @@ -139,7 +139,7 @@ void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream * void PreScanOutputDev::drawImage(GfxState *state, Object * /*ref*/, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int * /*maskColors*/, GBool inlineImg) { + GBool /*interpolate*/, int * /*maskColors*/, GBool inlineImg) { GfxColorSpace *colorSpace; int i, j; @@ -171,9 +171,10 @@ void PreScanOutputDev::drawMaskedImage(GfxState *state, Object * /*ref*/, Stream * /*str*/, int /*width*/, int /*height*/, GfxImageColorMap *colorMap, + GBool /*interpolate*/, Stream * /*maskStr*/, int /*maskWidth*/, int /*maskHeight*/, - GBool /*maskInvert*/) { + GBool /*maskInvert*/, GBool /*maskInterpolate*/) { GfxColorSpace *colorSpace; colorSpace = colorMap->getColorSpace(); @@ -195,9 +196,11 @@ void PreScanOutputDev::drawSoftMaskedImage(GfxState * /*state*/, Object * /*ref* Stream * /*str*/, int /*width*/, int /*height*/, GfxImageColorMap *colorMap, + GBool /*interpolate*/, Stream * /*maskStr*/, int /*maskWidth*/, int /*maskHeight*/, - GfxImageColorMap * /*maskColorMap*/) { + GfxImageColorMap * /*maskColorMap*/, + GBool /*maskInterpolate*/) { GfxColorSpace *colorSpace; colorSpace = colorMap->getColorSpace(); diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h index 8a2e2ef..781bd85 100644 --- a/poppler/PreScanOutputDev.h +++ b/poppler/PreScanOutputDev.h @@ -71,21 +71,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState *state, double *bbox, diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 7f810fe..b8b2f0a 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -1970,7 +1970,7 @@ void SplashOutputDev::endMaskClip(GfxState * state) { void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool inlineImg, GBool interpolate) { double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; @@ -2242,6 +2242,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg) { double *ctm; SplashCoord mat[6]; @@ -2456,8 +2457,10 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert) { + int maskHeight, GBool maskInvert, + GBool maskInterpolate) { GfxImageColorMap *maskColorMap; Object maskDecode, decodeLow, decodeHigh; double *ctm; @@ -2487,8 +2490,8 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, maskColorMap = new GfxImageColorMap(1, &maskDecode, new GfxDeviceGrayColorSpace()); maskDecode.free(); - drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); delete maskColorMap; } else { @@ -2611,9 +2614,11 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { double *ctm; SplashCoord mat[6]; SplashOutImageData imgData; diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index b9a7aad..3e3462b 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -143,21 +143,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); // If current colorspace ist pattern, // need this device special handling for masks in pattern colorspace? // Default is false diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index 6095e10..97b229d 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -1144,11 +1144,11 @@ void HtmlOutputDev::drawChar(GfxState *state, double x, double y, } void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { if (ignore||complexMode) { - OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); return; } @@ -1222,16 +1222,16 @@ void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, if (fName) imgList->append(fName); } else { - OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); } } void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg) { if (ignore||complexMode) { - OutputDev::drawImage(state, ref, str, width, height, colorMap, + OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); return; } @@ -1418,7 +1418,7 @@ void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, imgStr->close(); delete imgStr; #else - OutputDev::drawImage(state, ref, str, width, height, colorMap, + OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); #endif } diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h index a048a72..9d31774 100644 --- a/utils/HtmlOutputDev.h +++ b/utils/HtmlOutputDev.h @@ -279,10 +279,10 @@ public: virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg); //new feature virtual int DevType() {return 1234;} diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 5d4876f..da54fd6 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -60,7 +60,7 @@ ImageOutputDev::~ImageOutputDev() { void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool interpolate, GBool inlineImg) { FILE *f; int c; int size, i; @@ -117,7 +117,7 @@ void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + GBool interpolate, int *maskColors, GBool inlineImg) { FILE *f; ImageStream *imgStr; Guchar *p; @@ -227,19 +227,19 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); - drawImageMask(state, ref, maskStr, maskWidth, maskHeight, + int width, int height, GfxImageColorMap *colorMap, GBool interpolate, + Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); + drawImageMask(state, ref, maskStr, maskWidth, maskHeight, maskInterpolate, maskInvert, gFalse); } void ImageOutputDev::drawSoftMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, + int width, int height, GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GfxImageColorMap *maskColorMap, GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); drawImage(state, ref, maskStr, maskWidth, maskHeight, - maskColorMap, NULL, gFalse); + maskColorMap, maskInterpolate, NULL, gFalse); } diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h index e64cf56..3b07636 100644 --- a/utils/ImageOutputDev.h +++ b/utils/ImageOutputDev.h @@ -74,21 +74,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); private: -- 1.6.0.4