polygon intersector: added horizontal line reconstruction
[swftools.git] / lib / pdf / FullBitmapOutputDev.cc
index d35956d..9cd2cc1 100644 (file)
@@ -87,9 +87,9 @@ void FullBitmapOutputDev::setClip(int x1,int y1,int x2,int y2)
 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)
@@ -167,13 +167,11 @@ void FullBitmapOutputDev::flushBitmap()
        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" */
@@ -192,9 +190,6 @@ void FullBitmapOutputDev::flushBitmap()
     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;
 }
 
@@ -594,3 +589,6 @@ void FullBitmapOutputDev::clearSoftMask(GfxState *state)
     msg("<debug> clearSoftMask");
     rgbdev->clearSoftMask(state);
 }
+
+
+