#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
-#include "config.h"
#include "FullBitmapOutputDev.h"
#include "GFXOutputDev.h"
-#include "SplashBitmap.h"
-#include "SplashPattern.h"
-#include "Splash.h"
+
+#ifdef HAVE_POPPLER
+ #include "splash/SplashBitmap.h"
+ #include "splash/SplashPattern.h"
+ #include "splash/Splash.h"
+#else
+ #include "xpdf/config.h"
+ #include "SplashBitmap.h"
+ #include "SplashPattern.h"
+ #include "Splash.h"
+#endif
+
#include "../log.h"
#include "../png.h"
#include "../devices/record.h"
void FullBitmapOutputDev::setParameter(const char*key, const char*value)
{
}
-void FullBitmapOutputDev::preparePage(int pdfpage, int outputpage)
+void FullBitmapOutputDev::setPageMap(int*pagemap, int pagemap_len)
{
- gfxdev->preparePage(pdfpage, outputpage);
+ gfxdev->setPageMap(pagemap, pagemap_len);
}
static void getBitmapBBox(Guchar*alpha, int width, int height, int*xmin, int*ymin, int*xmax, int*ymax)
gfxcolor_t*out = &img->data[y*rangex];
Guchar*ain = &alpha[(y+ymin)*width+xmin];
for(x=0;x<rangex;x++) {
- /* according to endPage()/compositeBackground() in xpdf/SplashOutputDev.cc, we
- have to premultiply alpha (mix background and pixel according to the alpha channel).
- */
- out[x].r = (in[x*3+0]*ain[x])/255;
- out[x].g = (in[x*3+1]*ain[x])/255;
- out[x].b = (in[x*3+2]*ain[x])/255;
- out[x].a = ain[x];
+ // blend against a white background
+ out[x].r = (in[x*3+0]*ain[x])/255 + 255-ain[x];
+ out[x].g = (in[x*3+1]*ain[x])/255 + 255-ain[x];
+ out[x].b = (in[x*3+2]*ain[x])/255 + 255-ain[x];
+ out[x].a = 255;//ain[x];
}
}
/* transform bitmap rectangle to "device space" */
dev->fillbitmap(dev, line, img, &m, 0);
gfxline_free(line);
- memset(rgbdev->getBitmap()->getAlphaPtr(), 0, rgbdev->getBitmap()->getWidth()*rgbdev->getBitmap()->getHeight());
- memset(rgbdev->getBitmap()->getDataPtr(), 0, rgbdev->getBitmap()->getRowSize()*rgbdev->getBitmap()->getHeight());
-
free(img->data);img->data=0;free(img);img=0;
}
-void FullBitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+GBool FullBitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data),
+ void *abortCheckCbkData)
+{
+ this->setPage(page);
+ gfxdev->setPage(page);
+ return gTrue;
+}
+
+void FullBitmapOutputDev::startPage(int pageNum, GfxState *state)
{
double x1,y1,x2,y2;
- state->transform(crop_x1,crop_y1,&x1,&y1);
- state->transform(crop_x2,crop_y2,&x2,&y2);
+ PDFRectangle *r = page->getCropBox();
+ state->transform(r->x1,r->y1,&x1,&y1);
+ state->transform(r->x2,r->y2,&x2,&y2);
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
this->height = (int)(y2-y1);
msg("<debug> startPage");
- rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- gfxdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
+ rgbdev->startPage(pageNum, state);
+ gfxdev->startPage(pageNum, state);
}
void FullBitmapOutputDev::endPage()
msg("<debug> eoFill");
rgbdev->eoFill(state);
}
-#if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207
-void FullBitmapOutputDev::tilingPatternFill(GfxState *state, Object *str,
+POPPLER_TILING_PATERN_RETURN FullBitmapOutputDev::tilingPatternFill(GfxState *state, POPPLER_TILING_PATERN_GFX
+ Object *str,
int paintType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep)
{
msg("<debug> tilingPatternFill");
- rgbdev->tilingPatternFill(state, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);
-}
-#else
-void FullBitmapOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
- int paintType, Dict *resDict,
- double *mat, double *bbox,
- int x0, int y0, int x1, int y1,
- double xStep, double yStep)
-{
- msg("<debug> tilingPatternFill");
- rgbdev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);
-}
+#ifdef HAVE_POPPLER
+ return
#endif
+ rgbdev->tilingPatternFill(state, POPPLER_TILING_PATERN_GFX_ARG str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);
+}
GBool FullBitmapOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading)
{
msg("<debug> functionShadedFill");
return rgbdev->functionShadedFill(state, shading);
}
-GBool FullBitmapOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading)
+GBool FullBitmapOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading POPPLER_RAXIAL_MIN_MAX)
{
msg("<debug> axialShadedFill");
- return rgbdev->axialShadedFill(state, shading);
+ return rgbdev->axialShadedFill(state, shading POPPLER_RAXIAL_MIN_MAX_ARG);
}
-GBool FullBitmapOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading)
+GBool FullBitmapOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading POPPLER_RAXIAL_MIN_MAX)
{
msg("<debug> radialShadedFill");
- return rgbdev->radialShadedFill(state, shading);
+ return rgbdev->radialShadedFill(state, shading POPPLER_RAXIAL_MIN_MAX_ARG);
}
void FullBitmapOutputDev::clip(GfxState *state)
rgbdev->endType3Char(state);
}
void FullBitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
- int width, int height, GBool invert,
+ int width, int height, GBool invert, POPPLER_INTERPOLATE
GBool inlineImg)
{
msg("<debug> drawImageMask");
- rgbdev->drawImageMask(state, ref, str, width, height, invert, inlineImg);
+ rgbdev->drawImageMask(state, ref, str, width, height, invert, POPPLER_INTERPOLATE_ARG inlineImg);
}
void FullBitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
- int width, int height, GfxImageColorMap *colorMap,
+ int width, int height, GfxImageColorMap *colorMap, POPPLER_INTERPOLATE
int *maskColors, GBool inlineImg)
{
msg("<debug> drawImage");
- rgbdev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg);
+ rgbdev->drawImage(state, ref, str, width, height, colorMap,
+ POPPLER_INTERPOLATE_ARG maskColors, inlineImg);
}
void FullBitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
- GfxImageColorMap *colorMap,
+ GfxImageColorMap *colorMap, POPPLER_INTERPOLATE
Stream *maskStr, int maskWidth, int maskHeight,
- GBool maskInvert)
+ GBool maskInvert POPPLER_MASK_INTERPOLATE)
{
msg("<debug> drawMaskedImage");
- rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert);
+ rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap,
+ POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight,
+ maskInvert POPPLER_MASK_INTERPOLATE_ARG);
}
void FullBitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
- GfxImageColorMap *colorMap,
- Stream *maskStr,
- int maskWidth, int maskHeight,
- GfxImageColorMap *maskColorMap)
+ GfxImageColorMap *colorMap, POPPLER_INTERPOLATE
+ Stream *maskStr, int maskWidth, int maskHeight,
+ GfxImageColorMap *maskColorMap POPPLER_MASK_INTERPOLATE)
{
msg("<debug> drawSoftMaskedImage");
- rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap);
+ rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap,
+ POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight,
+ maskColorMap POPPLER_MASK_INTERPOLATE_ARG);
}
void FullBitmapOutputDev::drawForm(Ref id)
{
msg("<debug> clearSoftMask");
rgbdev->clearSoftMask(state);
}
+
+
+