From: kramm Date: Wed, 19 Mar 2008 21:47:58 +0000 (+0000) Subject: device which creates a bitmap and links X-Git-Tag: buttons-working~387 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=eed4136dd1e5d7036630bd9ef29faa7e11a8f0ef device which creates a bitmap and links --- diff --git a/lib/pdf/FullBitmapOutputDev.cc b/lib/pdf/FullBitmapOutputDev.cc new file mode 100644 index 0000000..d35956d --- /dev/null +++ b/lib/pdf/FullBitmapOutputDev.cc @@ -0,0 +1,596 @@ +/* FullBitmapOutputDev.cc + + Output Device which creates a bitmap. + + Swftools is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Swftools is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with swftools; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include "config.h" +#include "FullBitmapOutputDev.h" +#include "GFXOutputDev.h" +#include "SplashBitmap.h" +#include "SplashPattern.h" +#include "Splash.h" +#include "../log.h" +#include "../png.h" +#include "../devices/record.h" + +static SplashColor splash_white = {255,255,255}; +static SplashColor splash_black = {0,0,0}; + +FullBitmapOutputDev::FullBitmapOutputDev(InfoOutputDev*info, PDFDoc*doc) +{ + this->doc = doc; + this->xref = doc->getXRef(); + + msg(" Rendering everything to a bitmap"); + + /* color graphic output device, for creating bitmaps */ + this->rgbdev = new SplashOutputDev(splashModeRGB8, 1, gFalse, splash_white, gTrue, gTrue); + + /* device for handling links */ + this->gfxdev = new GFXOutputDev(info, this->doc); + + this->rgbdev->startDoc(this->xref); +} +FullBitmapOutputDev::~FullBitmapOutputDev() +{ + if(this->rgbdev) { + delete this->rgbdev;this->rgbdev = 0; + } + if(this->gfxdev) { + delete this->gfxdev;this->gfxdev= 0; + } +} + +GBool FullBitmapOutputDev::getVectorAntialias() +{ + return this->rgbdev->getVectorAntialias(); +} +void FullBitmapOutputDev::setVectorAntialias(GBool vaa) +{ + this->rgbdev->setVectorAntialias(vaa); +} +void FullBitmapOutputDev::setDevice(gfxdevice_t*dev) +{ + this->dev = dev; + gfxdev->setDevice(dev); +} +void FullBitmapOutputDev::setMove(int x,int y) +{ + this->user_movex = x; + this->user_movey = y; + gfxdev->setMove(x,y); +} +void FullBitmapOutputDev::setClip(int x1,int y1,int x2,int y2) +{ + this->user_clipx1 = x1; + this->user_clipy1 = y1; + this->user_clipx2 = x2; + this->user_clipy2 = y2; + gfxdev->setClip(x1,y1,x2,y2); +} +void FullBitmapOutputDev::setParameter(const char*key, const char*value) +{ +} +void FullBitmapOutputDev::preparePage(int pdfpage, int outputpage) +{ + gfxdev->preparePage(pdfpage, outputpage); +} + +static void getBitmapBBox(Guchar*alpha, int width, int height, int*xmin, int*ymin, int*xmax, int*ymax) +{ + *ymin = -1; + *xmin = width; + *xmax = 0; + int x,y; + for(y=0;y*xmax) *xmax = right; + } + } + if(*xmin>=*xmax || *ymin>=*ymax) { + *xmin = 0; + *ymin = 0; + *xmax = 0; + *ymax = 0; + } +} + +void FullBitmapOutputDev::flushBitmap() +{ + int width = rgbdev->getBitmapWidth(); + int height = rgbdev->getBitmapHeight(); + + SplashColorPtr rgb = rgbdev->getBitmap()->getDataPtr(); + Guchar*alpha = rgbdev->getBitmap()->getAlphaPtr(); + + int xmin,ymin,xmax,ymax; + getBitmapBBox(alpha, width, height, &xmin,&ymin,&xmax,&ymax); + + /* clip against (-movex, -movey, -movex+width, -movey+height) */ + if(xmin < -this->movex) xmin = -this->movex; + if(ymin < -this->movey) ymin = -this->movey; + if(xmax > -this->movex + width) xmax = -this->movex+this->width; + if(ymax > -this->movey + height) ymax = -this->movey+this->height; + + msg(" Flushing bitmap (bbox: %d,%d,%d,%d)", xmin,ymin,xmax,ymax); + + if((xmax-xmin)<=0 || (ymax-ymin)<=0) // no bitmap, nothing to do + return; + + if(sizeof(SplashColor)!=3) { + msg(" sizeof(SplashColor)!=3"); + return; + } + //xmin = ymin = 0; + //xmax = width; + //ymax = height; + + int rangex = xmax-xmin; + int rangey = ymax-ymin; + gfximage_t*img = (gfximage_t*)malloc(sizeof(gfximage_t)); + img->data = (gfxcolor_t*)malloc(rangex * rangey * 4); + img->width = rangex; + img->height = rangey; + int x,y; + for(y=0;ydata[y*rangex]; + Guchar*ain = &alpha[(y+ymin)*width+xmin]; + for(x=0;xfillbitmap(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) +{ + double x1,y1,x2,y2; + state->transform(crop_x1,crop_y1,&x1,&y1); + state->transform(crop_x2,crop_y2,&x2,&y2); + if(x2movex = -(int)x1 - user_movex; + this->movey = -(int)y1 - user_movey; + + if(user_clipx1|user_clipy1|user_clipx2|user_clipy2) { + x1 = user_clipx1; + x2 = user_clipx2; + y1 = user_clipy1; + y2 = user_clipy2; + } + this->width = (int)(x2-x1); + this->height = (int)(y2-y1); + + msg(" 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); +} + +void FullBitmapOutputDev::endPage() +{ + msg(" endPage (FullBitmapOutputDev)"); + flushBitmap(); + rgbdev->endPage(); + gfxdev->endPage(); +} +GBool FullBitmapOutputDev::upsideDown() +{ + return rgbdev->upsideDown(); +} +GBool FullBitmapOutputDev::useDrawChar() +{ + return rgbdev->useDrawChar(); +} +GBool FullBitmapOutputDev::useTilingPatternFill() +{ + return rgbdev->useTilingPatternFill(); +} +GBool FullBitmapOutputDev::useShadedFills() +{ + return rgbdev->useShadedFills(); +} +GBool FullBitmapOutputDev::useDrawForm() +{ + return rgbdev->useDrawForm(); +} +GBool FullBitmapOutputDev::interpretType3Chars() +{ + return rgbdev->interpretType3Chars(); +} +GBool FullBitmapOutputDev::needNonText() +{ + return rgbdev->needNonText(); +} +void FullBitmapOutputDev::setDefaultCTM(double *ctm) +{ + rgbdev->setDefaultCTM(ctm); + gfxdev->setDefaultCTM(ctm); +} +void FullBitmapOutputDev::saveState(GfxState *state) +{ + rgbdev->saveState(state); +} +void FullBitmapOutputDev::restoreState(GfxState *state) +{ + rgbdev->restoreState(state); +} +void FullBitmapOutputDev::updateAll(GfxState *state) +{ + rgbdev->updateAll(state); +} +void FullBitmapOutputDev::updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) +{ + rgbdev->updateCTM(state,m11,m12,m21,m22,m31,m32); + gfxdev->updateCTM(state,m11,m12,m21,m22,m31,m32); +} +void FullBitmapOutputDev::updateLineDash(GfxState *state) +{ + rgbdev->updateLineDash(state); +} +void FullBitmapOutputDev::updateFlatness(GfxState *state) +{ + rgbdev->updateFlatness(state); +} +void FullBitmapOutputDev::updateLineJoin(GfxState *state) +{ + rgbdev->updateLineJoin(state); +} +void FullBitmapOutputDev::updateLineCap(GfxState *state) +{ + rgbdev->updateLineCap(state); +} +void FullBitmapOutputDev::updateMiterLimit(GfxState *state) +{ + rgbdev->updateMiterLimit(state); +} +void FullBitmapOutputDev::updateLineWidth(GfxState *state) +{ + rgbdev->updateLineWidth(state); +} +void FullBitmapOutputDev::updateStrokeAdjust(GfxState *state) +{ + rgbdev->updateStrokeAdjust(state); +} +void FullBitmapOutputDev::updateFillColorSpace(GfxState *state) +{ + rgbdev->updateFillColorSpace(state); +} +void FullBitmapOutputDev::updateStrokeColorSpace(GfxState *state) +{ + rgbdev->updateStrokeColorSpace(state); +} +void FullBitmapOutputDev::updateFillColor(GfxState *state) +{ + rgbdev->updateFillColor(state); +} +void FullBitmapOutputDev::updateStrokeColor(GfxState *state) +{ + rgbdev->updateStrokeColor(state); +} +void FullBitmapOutputDev::updateBlendMode(GfxState *state) +{ + rgbdev->updateBlendMode(state); +} +void FullBitmapOutputDev::updateFillOpacity(GfxState *state) +{ + rgbdev->updateFillOpacity(state); +} +void FullBitmapOutputDev::updateStrokeOpacity(GfxState *state) +{ + rgbdev->updateStrokeOpacity(state); +} +void FullBitmapOutputDev::updateFillOverprint(GfxState *state) +{ + rgbdev->updateFillOverprint(state); +} +void FullBitmapOutputDev::updateStrokeOverprint(GfxState *state) +{ + rgbdev->updateStrokeOverprint(state); +} +void FullBitmapOutputDev::updateTransfer(GfxState *state) +{ + rgbdev->updateTransfer(state); +} +void FullBitmapOutputDev::updateFont(GfxState *state) +{ + rgbdev->updateFont(state); +} +void FullBitmapOutputDev::updateTextMat(GfxState *state) +{ + rgbdev->updateTextMat(state); +} +void FullBitmapOutputDev::updateCharSpace(GfxState *state) +{ + rgbdev->updateCharSpace(state); +} +void FullBitmapOutputDev::updateRender(GfxState *state) +{ + rgbdev->updateRender(state); +} +void FullBitmapOutputDev::updateRise(GfxState *state) +{ + rgbdev->updateRise(state); +} +void FullBitmapOutputDev::updateWordSpace(GfxState *state) +{ + rgbdev->updateWordSpace(state); +} +void FullBitmapOutputDev::updateHorizScaling(GfxState *state) +{ + rgbdev->updateHorizScaling(state); +} +void FullBitmapOutputDev::updateTextPos(GfxState *state) +{ + rgbdev->updateTextPos(state); +} +void FullBitmapOutputDev::updateTextShift(GfxState *state, double shift) +{ + rgbdev->updateTextShift(state, shift); +} + +void FullBitmapOutputDev::stroke(GfxState *state) +{ + msg(" stroke"); + rgbdev->stroke(state); +} +void FullBitmapOutputDev::fill(GfxState *state) +{ + msg(" fill"); + rgbdev->fill(state); +} +void FullBitmapOutputDev::eoFill(GfxState *state) +{ + msg(" eoFill"); + rgbdev->eoFill(state); +} +#if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207 +void FullBitmapOutputDev::tilingPatternFill(GfxState *state, Object *str, + int paintType, Dict *resDict, + double *mat, double *bbox, + int x0, int y0, int x1, int y1, + double xStep, double yStep) +{ + msg(" 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(" tilingPatternFill"); + rgbdev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); +} +#endif + +GBool FullBitmapOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) +{ + msg(" functionShadedFill"); + return rgbdev->functionShadedFill(state, shading); +} +GBool FullBitmapOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading) +{ + msg(" axialShadedFill"); + return rgbdev->axialShadedFill(state, shading); +} +GBool FullBitmapOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading) +{ + msg(" radialShadedFill"); + return rgbdev->radialShadedFill(state, shading); +} + +void FullBitmapOutputDev::clip(GfxState *state) +{ + msg(" clip"); + rgbdev->clip(state); +} +void FullBitmapOutputDev::eoClip(GfxState *state) +{ + msg(" eoClip"); + rgbdev->eoClip(state); +} +void FullBitmapOutputDev::clipToStrokePath(GfxState *state) +{ + msg(" clipToStrokePath"); + rgbdev->clipToStrokePath(state); +} + +void FullBitmapOutputDev::beginStringOp(GfxState *state) +{ + msg(" beginStringOp"); + rgbdev->beginStringOp(state); +} +void FullBitmapOutputDev::endStringOp(GfxState *state) +{ + msg(" endStringOp"); + rgbdev->endStringOp(state); +} +void FullBitmapOutputDev::beginString(GfxState *state, GString *s) +{ + msg(" beginString"); + rgbdev->beginString(state, s); +} +void FullBitmapOutputDev::endString(GfxState *state) +{ + msg(" endString"); + rgbdev->endString(state); +} +void FullBitmapOutputDev::drawChar(GfxState *state, double x, double y, + double dx, double dy, + double originX, double originY, + CharCode code, int nBytes, Unicode *u, int uLen) +{ + msg(" drawChar"); + rgbdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); +} +void FullBitmapOutputDev::drawString(GfxState *state, GString *s) +{ + msg(" internal error: drawString not implemented"); + rgbdev->drawString(state, s); +} +void FullBitmapOutputDev::endTextObject(GfxState *state) +{ + /* FIXME: the below might render things (stroke outlines etc.) to gfxdev which + might end up unflushed- should be handled similarily as + drawChar() above + */ + msg(" endTextObject"); + rgbdev->endTextObject(state); +} + +/* TODO: these four operations below *should* do nothing, as type3 + chars are drawn using operations like fill() */ +GBool FullBitmapOutputDev::beginType3Char(GfxState *state, double x, double y, + double dx, double dy, + CharCode code, Unicode *u, int uLen) +{ + msg(" beginType3Char"); + return rgbdev->beginType3Char(state, x, y, dx, dy, code, u, uLen); +} +void FullBitmapOutputDev::type3D0(GfxState *state, double wx, double wy) +{ + msg(" type3D0"); + rgbdev->type3D0(state, wx, wy); +} +void FullBitmapOutputDev::type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) +{ + msg(" type3D1"); + rgbdev->type3D1(state, wx, wy, llx, lly, urx, ury); +} +void FullBitmapOutputDev::endType3Char(GfxState *state) +{ + msg(" endType3Char"); + rgbdev->endType3Char(state); +} +void FullBitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) +{ + msg(" drawImageMask"); + rgbdev->drawImageMask(state, ref, str, width, height, invert, inlineImg); +} +void FullBitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, + int width, int height, GfxImageColorMap *colorMap, + int *maskColors, GBool inlineImg) +{ + msg(" drawImage"); + rgbdev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); +} +void FullBitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Stream *maskStr, int maskWidth, int maskHeight, + GBool maskInvert) +{ + msg(" drawMaskedImage"); + rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); +} +void FullBitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap) +{ + msg(" drawSoftMaskedImage"); + rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); +} +void FullBitmapOutputDev::drawForm(Ref id) +{ + msg(" drawForm"); + rgbdev->drawForm(id); +} + +void FullBitmapOutputDev::processLink(Link *link, Catalog *catalog) +{ + msg(" processLink"); + gfxdev->processLink(link, catalog); +} + +void FullBitmapOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, + GfxColorSpace *blendingColorSpace, + GBool isolated, GBool knockout, + GBool forSoftMask) +{ + msg(" beginTransparencyGroup"); + rgbdev->beginTransparencyGroup(state, bbox, blendingColorSpace, isolated, knockout, forSoftMask); +} +void FullBitmapOutputDev::endTransparencyGroup(GfxState *state) +{ + msg(" endTransparencyGroup"); + rgbdev->endTransparencyGroup(state); +} +void FullBitmapOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) +{ + msg(" paintTransparencyGroup"); + rgbdev->paintTransparencyGroup(state,bbox); +} +void FullBitmapOutputDev::setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor) +{ + msg(" setSoftMask"); + rgbdev->setSoftMask(state, bbox, alpha, transferFunc, backdropColor); +} +void FullBitmapOutputDev::clearSoftMask(GfxState *state) +{ + msg(" clearSoftMask"); + rgbdev->clearSoftMask(state); +} diff --git a/lib/pdf/FullBitmapOutputDev.h b/lib/pdf/FullBitmapOutputDev.h new file mode 100644 index 0000000..59e4ef7 --- /dev/null +++ b/lib/pdf/FullBitmapOutputDev.h @@ -0,0 +1,197 @@ +/* FullBitmapOutputDev.cc + Output device which creates a bitmap. + + This file is part of swftools. + + Swftools is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Swftools is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with swftools; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef __FullBitmapOutputDev_h__ +#define __FullBitmapOutputDev_h__ + +#include "../gfxdevice.h" +#include "../gfxsource.h" +#include "../gfxtools.h" + +#include "config.h" +#include "GFXOutputDev.h" +#include "InfoOutputDev.h" +#include "PDFDoc.h" +#include "CommonOutputDev.h" + +#define STATE_PARALLEL 0 +#define STATE_TEXT_IS_ABOVE 1 +#define STATE_BITMAP_IS_ABOVE 2 + +class FullBitmapOutputDev: public CommonOutputDev { +public: + FullBitmapOutputDev(InfoOutputDev*info, PDFDoc*doc); + virtual ~FullBitmapOutputDev(); + + // CommonOutputDev: + virtual void setDevice(gfxdevice_t*dev); + virtual void setMove(int x,int y); + virtual void setClip(int x1,int y1,int x2,int y2); + virtual void setParameter(const char*key, const char*value); + virtual void preparePage(int pdfpage, int outputpage); + + // OutputDev: + virtual GBool upsideDown(); + virtual GBool useDrawChar(); + virtual GBool useTilingPatternFill(); + virtual GBool useShadedFills(); + virtual GBool useDrawForm(); + virtual GBool interpretType3Chars(); + virtual GBool needNonText(); + virtual void setDefaultCTM(double *ctm); +/* virtual GBool 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) = NULL, + void *abortCheckCbkData = NULL);*/ + + virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2); + virtual void endPage(); + + virtual void saveState(GfxState *state); + virtual void restoreState(GfxState *state); + + virtual void updateAll(GfxState *state); + virtual void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32); + virtual void updateLineDash(GfxState *state); + virtual void updateFlatness(GfxState *state); + virtual void updateLineJoin(GfxState *state); + virtual void updateLineCap(GfxState *state); + virtual void updateMiterLimit(GfxState *state); + virtual void updateLineWidth(GfxState *state); + virtual void updateStrokeAdjust(GfxState *state); + virtual void updateFillColorSpace(GfxState *state); + virtual void updateStrokeColorSpace(GfxState *state); + virtual void updateFillColor(GfxState *state); + virtual void updateStrokeColor(GfxState *state); + virtual void updateBlendMode(GfxState *state); + virtual void updateFillOpacity(GfxState *state); + virtual void updateStrokeOpacity(GfxState *state); + virtual void updateFillOverprint(GfxState *state); + virtual void updateStrokeOverprint(GfxState *state); + virtual void updateTransfer(GfxState *state); + virtual void updateFont(GfxState *state); + virtual void updateTextMat(GfxState *state); + virtual void updateCharSpace(GfxState *state); + virtual void updateRender(GfxState *state); + virtual void updateRise(GfxState *state); + virtual void updateWordSpace(GfxState *state); + virtual void updateHorizScaling(GfxState *state); + virtual void updateTextPos(GfxState *state); + virtual void updateTextShift(GfxState *state, double shift); + + virtual void stroke(GfxState *state); + virtual void fill(GfxState *state); + virtual void eoFill(GfxState *state); +#if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7) + virtual void tilingPatternFill(GfxState *state, Object *str, + int paintType, Dict *resDict, + double *mat, double *bbox, + int x0, int y0, int x1, int y1, + double xStep, double yStep); +#else + virtual void 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); +#endif + + virtual GBool functionShadedFill(GfxState *state, + GfxFunctionShading *shading); + virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading); + virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading); + + virtual void clip(GfxState *state); + virtual void eoClip(GfxState *state); + virtual void clipToStrokePath(GfxState *state); + + virtual void beginStringOp(GfxState *state); + virtual void endStringOp(GfxState *state); + virtual void beginString(GfxState *state, GString *s); + virtual void endString(GfxState *state); + virtual void drawChar(GfxState *state, double x, double y, + double dx, double dy, + double originX, double originY, + CharCode code, int nBytes, Unicode *u, int uLen); + virtual void drawString(GfxState *state, GString *s); + virtual GBool beginType3Char(GfxState *state, double x, double y, + double dx, double dy, + CharCode code, Unicode *u, int uLen); + virtual void endType3Char(GfxState *state); + virtual void endTextObject(GfxState *state); + + virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, + int width, int height, GBool invert, + GBool inlineImg); + virtual void drawImage(GfxState *state, Object *ref, Stream *str, + int width, int height, GfxImageColorMap *colorMap, + int *maskColors, GBool inlineImg); + virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Stream *maskStr, int maskWidth, int maskHeight, + GBool maskInvert); + virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap); + + virtual void type3D0(GfxState *state, double wx, double wy); + virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury); + + virtual void drawForm(Ref id); + + virtual void beginTransparencyGroup(GfxState *state, double *bbox, + GfxColorSpace *blendingColorSpace, + GBool isolated, GBool knockout, + GBool forSoftMask); + virtual void endTransparencyGroup(GfxState *state); + virtual void paintTransparencyGroup(GfxState *state, double *bbox); + virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor); + virtual void clearSoftMask(GfxState *state); + + virtual void processLink(Link *link, Catalog *catalog); + + virtual void setVectorAntialias(GBool vaa); + virtual GBool getVectorAntialias(); + + +private: + void flushBitmap(); + char config_extrafontdata; + PDFDoc*doc; + XRef*xref; + SplashOutputDev*rgbdev; + + GFXOutputDev*gfxdev; + gfxdevice_t*dev; + + int movex, movey; + int width, height; + + int user_movex, user_movey; + int user_clipx1, user_clipy1; + int user_clipx2, user_clipy2; +}; + +#endif