3 Output Device which creates a bitmap.
5 Swftools is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 Swftools is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with swftools; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
23 #include "BitmapOutputDev.h"
24 #include "GFXOutputDev.h"
25 #include "SplashBitmap.h"
26 #include "SplashPattern.h"
30 static SplashColor splash_white = {255,255,255};
31 static SplashColor splash_black = {255,255,255};
33 ClipState::ClipState()
40 BitmapOutputDev::BitmapOutputDev(InfoOutputDev*info, PDFDoc*doc)
44 this->xref = doc->getXRef();
45 this->rgbdev = new SplashOutputDev(splashModeRGB8, 1, gFalse, splash_white, gTrue, gTrue);
46 this->clip0dev = new SplashOutputDev(splashModeMono1, 1, gFalse, splash_black, gTrue, gFalse);
47 this->clip1dev = new SplashOutputDev(splashModeMono1, 1, gFalse, splash_black, gTrue, gFalse);
48 this->gfxdev = new GFXOutputDev(info, this->doc);
49 this->rgbdev->startDoc(this->xref);
50 this->clip0dev->startDoc(this->xref);
51 this->clip1dev->startDoc(this->xref);
53 this->config_bitmapfonts = 0;
54 this->config_extrafontdata = 0;
57 //this->clipstates = 0;
59 BitmapOutputDev::~BitmapOutputDev()
62 delete this->bboxpath;this->bboxpath = 0;
65 delete this->rgbdev;this->rgbdev= 0;
68 delete this->clip0dev;this->clip0dev= 0;
71 delete this->clip1dev;this->clip1dev= 0;
73 //if(this->clipbitmap) {
74 // delete this->clipbitmap;this->clipbitmap = 0;
77 // delete this->clipdev;this->clipdev = 0;
82 void BitmapOutputDev::setDevice(gfxdevice_t*dev)
85 this->gfxdev->setDevice(dev);
87 void BitmapOutputDev::setMove(int x,int y)
89 this->gfxdev->setMove(x,y);
93 void BitmapOutputDev::setClip(int x1,int y1,int x2,int y2)
95 this->gfxdev->setClip(x1,y1,x2,y2);
96 this->user_clipx1 = x1;
97 this->user_clipy1 = y1;
98 this->user_clipx2 = x2;
99 this->user_clipy2 = y2;
101 void BitmapOutputDev::setParameter(const char*key, const char*value)
103 if(!strcmp(key, "extrafontdata")) {
104 this->config_extrafontdata = atoi(value);
105 } else if(!strcmp(key, "bitmapfonts")) {
106 this->config_bitmapfonts = atoi(value);
108 this->gfxdev->setParameter(key, value);
110 void BitmapOutputDev::preparePage(int pdfpage, int outputpage)
114 void getBitmapBBox(Guchar*alpha, int width, int height, int*xmin, int*ymin, int*xmax, int*ymax)
120 for(y=0;y<height;y++) {
121 Guchar*a = &alpha[y*width];
122 for(x=0;x<width;x++) {
125 int left = x; //first occupied pixel from left
126 int right = x+1; //last non-occupied pixel from right
135 if(left<*xmin) *xmin = left;
136 if(right>*xmax) *xmax = right;
139 if(*xmin>=*xmax || *ymin>=*ymax) {
147 void BitmapOutputDev::flush()
149 int width = rgbdev->getBitmapWidth();
150 int height = rgbdev->getBitmapHeight();
151 SplashColorPtr rgb = rgbdev->getBitmap()->getDataPtr();
152 Guchar*alpha = rgbdev->getBitmap()->getAlphaPtr();
154 int xmin,ymin,xmax,ymax;
155 getBitmapBBox(alpha, width, height, &xmin,&ymin,&xmax,&ymax);
157 /* clip against (-movex, -movey, -movex+width, -movey+height) */
158 if(xmin < -this->movex) xmin = -this->movex;
159 if(ymin < -this->movey) ymin = -this->movey;
160 if(xmax > -this->movex + width) xmax = -this->movex+this->width;
161 if(ymax > -this->movey + height) ymax = -this->movey+this->height;
163 msg("<verbose> Flushing graphics (bbox: %d,%d,%d,%d)", xmin,ymin,xmax,ymax);
165 if((xmax-xmin)<=0 || (ymax-ymin)<=0) // no bitmap, nothing to do
168 if(sizeof(SplashColor)!=3) {
169 msg("<error> sizeof(SplashColor)!=3");
176 int rangex = xmax-xmin;
177 int rangey = ymax-ymin;
178 gfximage_t*img = (gfximage_t*)malloc(sizeof(gfximage_t));
179 img->data = (gfxcolor_t*)malloc(rangex * rangey * 4);
181 img->height = rangey;
183 for(y=0;y<rangey;y++) {
184 SplashColorPtr in=&rgb[((y+ymin)*width+xmin)*sizeof(SplashColor)];
185 gfxcolor_t*out = &img->data[y*rangex];
186 Guchar*ain = &alpha[(y+ymin)*width+xmin];
187 for(x=0;x<rangex;x++) {
188 out[x].r = in[x*3+0];
189 out[x].g = in[x*3+1];
190 out[x].b = in[x*3+2];
194 /* transform bitmap rectangle to "device space" */
206 gfxline_t* line = gfxline_makerectangle(xmin, ymin, xmax, ymax);
207 dev->fillbitmap(dev, line, img, &m, 0);
210 memset(rgbdev->getBitmap()->getAlphaPtr(), 0, rgbdev->getBitmap()->getWidth()*rgbdev->getBitmap()->getHeight());
211 memset(rgbdev->getBitmap()->getDataPtr(), 0, rgbdev->getBitmap()->getWidth()*rgbdev->getBitmap()->getHeight()*sizeof(SplashColor));
213 free(img->data);img->data=0;free(img);img=0;
216 void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
219 state->transform(crop_x1,crop_y1,&x1,&y1);
220 state->transform(crop_x2,crop_y2,&x2,&y2);
221 if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
222 if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
224 this->movex = -(int)x1 - user_movex;
225 this->movey = -(int)y1 - user_movey;
227 if(user_clipx1|user_clipy1|user_clipx2|user_clipy2) {
233 this->width = (int)(x2-x1);
234 this->height = (int)(y2-y1);
236 msg("<verbose> startPage");
237 rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
238 clip0dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
239 clip1dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
240 gfxdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
242 /*int width = this->rgbdev->getBitmap()->getWidth();
243 int height = this->rgbdev->getBitmap()->getHeight();
244 this->bboxpath = new SplashPath();
245 this->bboxpath->moveTo(0,0);
246 this->bboxpath->lineTo(width,0);
247 this->bboxpath->lineTo(width,height);
248 this->bboxpath->lineTo(0,height);
249 this->bboxpath->lineTo(0,0);
251 if(this->clipbitmap) {
252 delete this->clipbitmap;this->clipbitmap = 0;
254 this->clipbitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse, gTrue);
256 delete this->clipdev;this->clipdev = 0;
258 SplashScreenParams params;
259 params.type = splashScreenDispersed;
261 params.dotRadius = 0;
262 this->clipdev = new Splash(this->clipbitmap, 0, (SplashScreenParams*)0);*/
265 void BitmapOutputDev::endPage()
267 msg("<verbose> endPage");
270 /* splash will now destroy alpha, and paint the
271 background color into the "holes" in the bitmap */
277 GBool BitmapOutputDev::upsideDown()
279 clip0dev->upsideDown();
280 clip1dev->upsideDown();
281 return rgbdev->upsideDown();
284 GBool BitmapOutputDev::useDrawChar()
286 clip0dev->useDrawChar();
287 clip1dev->useDrawChar();
288 return rgbdev->useDrawChar();
291 GBool BitmapOutputDev::useTilingPatternFill()
293 clip0dev->useTilingPatternFill();
294 clip1dev->useTilingPatternFill();
295 return rgbdev->useTilingPatternFill();
298 GBool BitmapOutputDev::useShadedFills()
300 clip0dev->useTilingPatternFill();
301 clip1dev->useTilingPatternFill();
302 return rgbdev->useTilingPatternFill();
305 GBool BitmapOutputDev::useDrawForm()
307 clip0dev->useDrawForm();
308 clip1dev->useDrawForm();
309 return rgbdev->useDrawForm();
312 GBool BitmapOutputDev::interpretType3Chars()
314 if(!config_bitmapfonts) {
315 clip0dev->interpretType3Chars();
316 clip1dev->interpretType3Chars();
317 return rgbdev->interpretType3Chars();
319 return gfxdev->interpretType3Chars();
323 GBool BitmapOutputDev::needNonText()
325 clip0dev->needNonText();
326 clip1dev->needNonText();
327 return rgbdev->needNonText();
329 /*GBool BitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
330 int rotate, GBool useMediaBox, GBool crop,
331 int sliceX, int sliceY, int sliceW, int sliceH,
332 GBool printing, Catalog *catalog,
333 GBool (*abortCheckCbk)(void *data),
334 void *abortCheckCbkData)
338 void BitmapOutputDev::setDefaultCTM(double *ctm)
340 rgbdev->setDefaultCTM(ctm);
341 clip0dev->setDefaultCTM(ctm);
342 clip1dev->setDefaultCTM(ctm);
344 void BitmapOutputDev::saveState(GfxState *state)
346 rgbdev->saveState(state);
347 clip0dev->saveState(state);
348 clip1dev->saveState(state);
350 /*ClipState*cstate = new ClipState();
351 cstate->next = this->clipstates;
352 this->clipstates = cstate;*/
354 void BitmapOutputDev::restoreState(GfxState *state)
356 rgbdev->restoreState(state);
357 clip0dev->restoreState(state);
358 clip1dev->restoreState(state);
360 /*if(this->clipstates) {
361 ClipState*old = this->clipstates;
363 gfxdev->restoreState(state);
365 this->clipstates = this->clipstates->next;
368 msg("<error> invalid restoreState()");
371 void BitmapOutputDev::updateAll(GfxState *state)
373 rgbdev->updateAll(state);
374 clip0dev->updateAll(state);
375 clip1dev->updateAll(state);
377 void BitmapOutputDev::updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32)
379 rgbdev->updateCTM(state,m11,m12,m21,m22,m31,m32);
380 clip0dev->updateCTM(state,m11,m12,m21,m22,m31,m32);
381 clip1dev->updateCTM(state,m11,m12,m21,m22,m31,m32);
383 void BitmapOutputDev::updateLineDash(GfxState *state)
385 rgbdev->updateLineDash(state);
386 clip0dev->updateLineDash(state);
387 clip1dev->updateLineDash(state);
389 void BitmapOutputDev::updateFlatness(GfxState *state)
391 rgbdev->updateFlatness(state);
392 clip0dev->updateFlatness(state);
393 clip1dev->updateFlatness(state);
395 void BitmapOutputDev::updateLineJoin(GfxState *state)
397 rgbdev->updateLineJoin(state);
398 clip0dev->updateLineJoin(state);
399 clip1dev->updateLineJoin(state);
401 void BitmapOutputDev::updateLineCap(GfxState *state)
403 rgbdev->updateLineCap(state);
404 clip0dev->updateLineCap(state);
405 clip1dev->updateLineCap(state);
407 void BitmapOutputDev::updateMiterLimit(GfxState *state)
409 rgbdev->updateMiterLimit(state);
410 clip0dev->updateMiterLimit(state);
411 clip1dev->updateMiterLimit(state);
413 void BitmapOutputDev::updateLineWidth(GfxState *state)
415 rgbdev->updateLineWidth(state);
416 clip0dev->updateLineWidth(state);
417 clip1dev->updateLineWidth(state);
419 void BitmapOutputDev::updateStrokeAdjust(GfxState *state)
421 rgbdev->updateStrokeAdjust(state);
422 clip0dev->updateStrokeAdjust(state);
423 clip1dev->updateStrokeAdjust(state);
425 void BitmapOutputDev::updateFillColorSpace(GfxState *state)
427 rgbdev->updateFillColorSpace(state);
428 clip0dev->updateFillColorSpace(state);
429 clip1dev->updateFillColorSpace(state);
431 void BitmapOutputDev::updateStrokeColorSpace(GfxState *state)
433 rgbdev->updateStrokeColorSpace(state);
434 clip0dev->updateStrokeColorSpace(state);
435 clip1dev->updateStrokeColorSpace(state);
437 void BitmapOutputDev::updateFillColor(GfxState *state)
439 rgbdev->updateFillColor(state);
440 clip0dev->updateFillColor(state);
441 clip0dev->updateFillColor(state);
442 clip1dev->updateFillColor(state);
444 void BitmapOutputDev::updateStrokeColor(GfxState *state)
446 rgbdev->updateStrokeColor(state);
447 clip0dev->updateStrokeColor(state);
448 clip1dev->updateStrokeColor(state);
450 void BitmapOutputDev::updateBlendMode(GfxState *state)
452 rgbdev->updateBlendMode(state);
453 clip0dev->updateBlendMode(state);
454 clip1dev->updateBlendMode(state);
456 void BitmapOutputDev::updateFillOpacity(GfxState *state)
458 rgbdev->updateFillOpacity(state);
459 clip0dev->updateFillOpacity(state);
460 clip1dev->updateFillOpacity(state);
462 void BitmapOutputDev::updateStrokeOpacity(GfxState *state)
464 rgbdev->updateStrokeOpacity(state);
465 clip0dev->updateStrokeOpacity(state);
466 clip1dev->updateStrokeOpacity(state);
468 void BitmapOutputDev::updateFillOverprint(GfxState *state)
470 rgbdev->updateFillOverprint(state);
471 clip0dev->updateFillOverprint(state);
472 clip1dev->updateFillOverprint(state);
474 void BitmapOutputDev::updateStrokeOverprint(GfxState *state)
476 rgbdev->updateStrokeOverprint(state);
477 clip0dev->updateStrokeOverprint(state);
478 clip1dev->updateStrokeOverprint(state);
480 void BitmapOutputDev::updateTransfer(GfxState *state)
482 rgbdev->updateTransfer(state);
483 clip0dev->updateTransfer(state);
484 clip1dev->updateTransfer(state);
486 void BitmapOutputDev::updateFont(GfxState *state)
488 rgbdev->updateFont(state);
489 clip0dev->updateFont(state);
490 clip1dev->updateFont(state);
491 if(!config_bitmapfonts)
492 gfxdev->updateFont(state);
494 void BitmapOutputDev::updateTextMat(GfxState *state)
496 rgbdev->updateTextMat(state);
497 clip0dev->updateTextMat(state);
498 clip1dev->updateTextMat(state);
499 if(!config_bitmapfonts)
500 gfxdev->updateTextMat(state);
502 void BitmapOutputDev::updateCharSpace(GfxState *state)
504 rgbdev->updateCharSpace(state);
505 clip0dev->updateCharSpace(state);
506 clip1dev->updateCharSpace(state);
507 if(!config_bitmapfonts)
508 gfxdev->updateCharSpace(state);
510 void BitmapOutputDev::updateRender(GfxState *state)
512 rgbdev->updateRender(state);
513 clip0dev->updateRender(state);
514 clip1dev->updateRender(state);
515 if(!config_bitmapfonts)
516 gfxdev->updateRender(state);
518 void BitmapOutputDev::updateRise(GfxState *state)
520 rgbdev->updateRise(state);
521 clip0dev->updateRise(state);
522 clip1dev->updateRise(state);
523 if(!config_bitmapfonts)
524 gfxdev->updateRise(state);
526 void BitmapOutputDev::updateWordSpace(GfxState *state)
528 rgbdev->updateWordSpace(state);
529 clip0dev->updateWordSpace(state);
530 clip1dev->updateWordSpace(state);
531 if(!config_bitmapfonts)
532 gfxdev->updateWordSpace(state);
534 void BitmapOutputDev::updateHorizScaling(GfxState *state)
536 rgbdev->updateHorizScaling(state);
537 clip0dev->updateHorizScaling(state);
538 clip1dev->updateHorizScaling(state);
539 if(!config_bitmapfonts)
540 gfxdev->updateHorizScaling(state);
542 void BitmapOutputDev::updateTextPos(GfxState *state)
544 rgbdev->updateTextPos(state);
545 clip0dev->updateTextPos(state);
546 clip1dev->updateTextPos(state);
547 if(!config_bitmapfonts)
548 gfxdev->updateTextPos(state);
550 void BitmapOutputDev::updateTextShift(GfxState *state, double shift)
552 rgbdev->updateTextShift(state, shift);
553 clip0dev->updateTextShift(state, shift);
554 clip1dev->updateTextShift(state, shift);
557 void BitmapOutputDev::stroke(GfxState *state)
559 msg("<verbose> stroke");
560 rgbdev->stroke(state);
562 void BitmapOutputDev::fill(GfxState *state)
564 msg("<verbose> fill");
567 void BitmapOutputDev::eoFill(GfxState *state)
569 msg("<verbose> eoFill");
570 rgbdev->eoFill(state);
572 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
573 void BitmapOutputDev::tilingPatternFill(GfxState *state, Object *str,
574 int paintType, Dict *resDict,
575 double *mat, double *bbox,
576 int x0, int y0, int x1, int y1,
577 double xStep, double yStep)
579 msg("<verbose> tilingPatternFill");
580 rgbdev->tilingPatternFill(state, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);
583 void BitmapOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
584 int paintType, Dict *resDict,
585 double *mat, double *bbox,
586 int x0, int y0, int x1, int y1,
587 double xStep, double yStep)
589 msg("<verbose> tilingPatternFill");
590 rgbdev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);
594 GBool BitmapOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading)
596 msg("<verbose> functionShadedFill");
597 return rgbdev->functionShadedFill(state, shading);
599 GBool BitmapOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading)
601 msg("<verbose> axialShadedFill");
602 return rgbdev->axialShadedFill(state, shading);
604 GBool BitmapOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading)
606 msg("<verbose> radialShadedFill");
607 return rgbdev->radialShadedFill(state, shading);
610 SplashColor black = {0,0,0};
611 SplashColor white = {255,255,255};
613 void BitmapOutputDev::doClip(GfxState *state, GBool eo)
617 clip1dev->clip(state);
619 rgbdev->eoClip(state);
620 clip1dev->eoClip(state);
623 //SplashPattern *pblack = new SplashSolidColor(black);
624 //SplashPattern *pwhite = new SplashSolidColor(white);
625 //SplashPath* path = rgbdev->convertPath(state, state->getPath());
626 //clipdev->clear(black, 0);
627 //clipdev->clipToPath(path, eo);
628 //clipdev->setFillPattern(pwhite);
629 //clipdev->fill(bboxpath,gFalse);
633 void BitmapOutputDev::clip(GfxState *state)
635 msg("<verbose> clip");
636 doClip(state, gFalse);
638 void BitmapOutputDev::eoClip(GfxState *state)
640 msg("<verbose> eoClip");
641 doClip(state, gTrue);
643 void BitmapOutputDev::clipToStrokePath(GfxState *state)
645 msg("<verbose> clipToStrokePath");
646 rgbdev->clipToStrokePath(state);
647 clip1dev->clipToStrokePath(state);
650 void BitmapOutputDev::beginStringOp(GfxState *state)
652 msg("<verbose> beginStringOp");
653 if(this->config_bitmapfonts) {
654 rgbdev->beginStringOp(state);
655 clip0dev->beginStringOp(state);
656 clip1dev->beginStringOp(state);
658 gfxdev->beginStringOp(state);
661 void BitmapOutputDev::endStringOp(GfxState *state)
663 msg("<verbose> endStringOp");
664 if(this->config_bitmapfonts) {
665 rgbdev->endStringOp(state);
666 clip0dev->endStringOp(state);
667 clip1dev->endStringOp(state);
669 gfxdev->endStringOp(state);
672 void BitmapOutputDev::beginString(GfxState *state, GString *s)
674 msg("<verbose> beginString");
675 if(this->config_bitmapfonts) {
676 rgbdev->beginString(state, s);
677 clip0dev->beginString(state, s);
678 clip1dev->beginString(state, s);
680 gfxdev->beginString(state, s);
683 void BitmapOutputDev::endString(GfxState *state)
685 msg("<verbose> endString");
686 if(this->config_bitmapfonts) {
687 rgbdev->endString(state);
688 clip0dev->endString(state);
689 clip1dev->endString(state);
691 gfxdev->endString(state);
694 void BitmapOutputDev::drawChar(GfxState *state, double x, double y,
695 double dx, double dy,
696 double originX, double originY,
697 CharCode code, int nBytes, Unicode *u, int uLen)
699 msg("<verbose> drawChar");
700 if(this->config_bitmapfonts || (state->getRender()&4) /*clip*/ ) {
701 rgbdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
703 SplashBitmap*clip0 = clip0dev->getBitmap();
704 SplashBitmap*clip1 = clip1dev->getBitmap();
705 int width8 = (clip0->getWidth()+7)/8;
706 int width = clip0->getWidth();
707 int height = clip0->getHeight();
708 memset(clip0->getDataPtr(), 0, width8*height);
709 memset(clip1->getDataPtr(), 0, width8*height);
710 clip0dev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
711 clip1dev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
713 /* if this character is affected somehow by the various clippings (i.e., it looks
714 different on a device without clipping), then draw it on the bitmap, not as
716 if(memcmp(clip0->getDataPtr(), clip1->getDataPtr(), width8*height)) {
717 msg("<verbose> Char %d is affected by clipping", code);
719 rgbdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
720 if(config_extrafontdata) {
721 int oldrender = state->getRender();
722 state->setRender(3); //invisible
723 gfxdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
724 state->setRender(oldrender);
727 /* this char is not at all affected by clipping. Now just find out whether the
728 bitmap we're currently working on needs to be dumped out first */
730 Guchar*alpha = rgbdev->getBitmap()->getAlphaPtr();
731 Guchar*charpixels = clip1dev->getBitmap()->getDataPtr();
733 for(yy=0;yy<height;yy++) {
734 Guchar*aline = &alpha[yy*width];
735 Guchar*cline = &charpixels[yy*width8];
736 for(xx=0;xx<width;xx++) {
739 /* TODO: is the bit order correct? */
740 if(aline[xx] && (cline[bytepos]&(1<<bit)))
748 /* yes, the graphic data and the characters overlap (the char is
749 above the current bitmap. Flush the bitmap to the output. */
750 msg("<verbose> Char %d is above current bitmap data", code);
753 gfxdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);
757 void BitmapOutputDev::drawString(GfxState *state, GString *s)
759 msg("<verbose> drawString");
760 if(this->config_bitmapfonts) {
761 rgbdev->drawString(state, s);
762 clip0dev->drawString(state, s);
763 clip1dev->drawString(state, s);
765 gfxdev->drawString(state, s);
768 void BitmapOutputDev::endTextObject(GfxState *state)
770 msg("<verbose> endTextObject");
771 if(this->config_bitmapfonts) {
772 rgbdev->endTextObject(state);
773 clip0dev->endTextObject(state);
774 clip1dev->endTextObject(state);
776 gfxdev->endType3Char(state);
779 GBool BitmapOutputDev::beginType3Char(GfxState *state, double x, double y,
780 double dx, double dy,
781 CharCode code, Unicode *u, int uLen)
783 msg("<verbose> beginType3Char");
784 if(this->config_bitmapfonts) {
785 return rgbdev->beginType3Char(state, x, y, dx, dy, code, u, uLen);
787 return gfxdev->beginType3Char(state, x, y, dx, dy, code, u, uLen);
790 void BitmapOutputDev::type3D0(GfxState *state, double wx, double wy)
792 msg("<verbose> type3D0");
793 if(this->config_bitmapfonts) {
794 rgbdev->type3D0(state, wx, wy);
796 return gfxdev->type3D0(state, wx, wy);
799 void BitmapOutputDev::type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury)
801 msg("<verbose> type3D1");
802 if(this->config_bitmapfonts) {
803 rgbdev->type3D1(state, wx, wy, llx, lly, urx, ury);
805 return gfxdev->type3D1(state, wx, wy, llx, lly, urx, ury);
808 void BitmapOutputDev::endType3Char(GfxState *state)
810 msg("<verbose> endType3Char");
811 if(this->config_bitmapfonts) {
812 rgbdev->endType3Char(state);
814 gfxdev->endType3Char(state);
817 void BitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
818 int width, int height, GBool invert,
821 msg("<verbose> drawImageMask");
822 rgbdev->drawImageMask(state, ref, str, width, height, invert, inlineImg);
824 void BitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
825 int width, int height, GfxImageColorMap *colorMap,
826 int *maskColors, GBool inlineImg)
828 msg("<verbose> drawImage");
829 rgbdev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg);
831 void BitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str,
832 int width, int height,
833 GfxImageColorMap *colorMap,
834 Stream *maskStr, int maskWidth, int maskHeight,
837 msg("<verbose> drawMaskedImage");
838 rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert);
840 void BitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
841 int width, int height,
842 GfxImageColorMap *colorMap,
844 int maskWidth, int maskHeight,
845 GfxImageColorMap *maskColorMap)
847 msg("<verbose> drawSoftMaskedImage");
848 rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap);
850 void BitmapOutputDev::drawForm(Ref id)
852 msg("<verbose> drawForm");
853 rgbdev->drawForm(id);
856 void BitmapOutputDev::processLink(Link *link, Catalog *catalog)
858 msg("<verbose> processLink");
859 gfxdev->processLink(link, catalog);
862 void BitmapOutputDev::beginTransparencyGroup(GfxState *state, double *bbox,
863 GfxColorSpace *blendingColorSpace,
864 GBool isolated, GBool knockout,
867 msg("<verbose> beginTransparencyGroup");
868 rgbdev->beginTransparencyGroup(state, bbox, blendingColorSpace, isolated, knockout, forSoftMask);
869 clip1dev->beginTransparencyGroup(state, bbox, blendingColorSpace, isolated, knockout, forSoftMask);
871 void BitmapOutputDev::endTransparencyGroup(GfxState *state)
873 msg("<verbose> endTransparencyGroup");
874 rgbdev->endTransparencyGroup(state);
875 clip1dev->endTransparencyGroup(state);
877 void BitmapOutputDev::paintTransparencyGroup(GfxState *state, double *bbox)
879 msg("<verbose> paintTransparencyGroup");
880 rgbdev->paintTransparencyGroup(state,bbox);
882 void BitmapOutputDev::setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor)
884 msg("<verbose> setSoftMask");
885 rgbdev->setSoftMask(state, bbox, alpha, transferFunc, backdropColor);
886 clip1dev->setSoftMask(state, bbox, alpha, transferFunc, backdropColor);
888 void BitmapOutputDev::clearSoftMask(GfxState *state)
890 msg("<verbose> clearSoftMask");
891 rgbdev->clearSoftMask(state);
892 clip1dev->clearSoftMask(state);