From 7aac8dc8533347e21311b15186e0af82f1b22fd6 Mon Sep 17 00:00:00 2001 From: Martin Kretzschmar Date: Wed, 18 Sep 2002 20:32:18 +0000 Subject: Synched with Xpdf 0.92 this adds "decryption" support testing this code after six weeks immediately gives me segfaults (image drawing) :-O must have fixed that later without knowing :-O --- (limited to 'pdf/xpdf/ImageOutputDev.cc') diff --git a/pdf/xpdf/ImageOutputDev.cc b/pdf/xpdf/ImageOutputDev.cc index 93d1c31..9cd1280 100644 --- a/pdf/xpdf/ImageOutputDev.cc +++ b/pdf/xpdf/ImageOutputDev.cc @@ -35,7 +35,7 @@ ImageOutputDev::~ImageOutputDev() { gfree(fileRoot); } -void ImageOutputDev::drawImageMask(GfxState *state, Stream *str, +void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { FILE *f; @@ -86,18 +86,19 @@ void ImageOutputDev::drawImageMask(GfxState *state, Stream *str, } } -void ImageOutputDev::drawImage(GfxState *state, Stream *str, int width, - int height, GfxImageColorMap *colorMap, - GBool inlineImg) { +void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, GBool inlineImg) { FILE *f; ImageStream *imgStr; Guchar pixBuf[4]; - GfxColor color; + GfxRGB rgb; int x, y; int c; // dump JPEG file - if (dumpJPEG && str->getKind() == strDCT) { + if (dumpJPEG && str->getKind() == strDCT && + colorMap->getNumPixelComps() == 3) { // open the image file sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum); @@ -142,10 +143,10 @@ void ImageOutputDev::drawImage(GfxState *state, Stream *str, int width, // write the line for (x = 0; x < width; ++x) { imgStr->getPixel(pixBuf); - colorMap->getColor(pixBuf, &color); - fputc((int)(color.getR() * 255 + 0.5), f); - fputc((int)(color.getG() * 255 + 0.5), f); - fputc((int)(color.getB() * 255 + 0.5), f); + colorMap->getRGB(pixBuf, &rgb); + fputc((int)(rgb.r * 255 + 0.5), f); + fputc((int)(rgb.g * 255 + 0.5), f); + fputc((int)(rgb.b * 255 + 0.5), f); } } delete imgStr; -- cgit v0.9.1