1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: pdfioutdev_gpl.cxx,v $
9 * last change: $Author: cmc $ $Date: 2008/08/25 16:17:55 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU General Public License Version 2.
15 * GNU General Public License, version 2
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License as
22 * published by the Free Software Foundation; either version 2 of
23 * the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public
31 * License along with this program; if not, write to the Free
32 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
33 * Boston, MA 02110-1301, USA.
35 ************************************************************************/
37 #include "pdfioutdev_gpl.hxx"
38 #include "pnghelper.hxx"
46 #if defined __SUNPRO_CC
48 #elif defined _MSC_VER
49 #pragma warning(push, 1)
54 #if defined __SUNPRO_CC
56 #elif defined _MSC_VER
61 # define snprintf _snprintf
68 We stream human-readble tokens to stdout, and binary data (fonts,
69 bitmaps) to g_binary_out. Another process reads from those pipes, and
70 there lies the rub: things can deadlock, if the two involved
71 processes access the pipes in different order. At any point in
72 time, both processes must access the same pipe. To ensure this,
73 data must be flushed to the OS before writing to a different pipe,
74 otherwise not-yet-written data will leave the reading process
75 waiting on the wrong pipe.
81 /// cut off very small numbers & clamp value to zero
82 inline double normalize( double val
)
84 return fabs(val
) < 0.0000001 ? 0.0 : val
;
87 const char* escapeLineFeed( const char* pStr
)
89 // TODO(Q3): Escape linefeeds
93 /// for the temp char buffer the header gets snprintfed in
94 #define WRITE_BUFFER_SIZE 1024
96 /// for the initial std::vector capacity when copying stream from xpdf
97 #define WRITE_BUFFER_INITIAL_CAPACITY (1024*100)
99 void initBuf(OutputBuffer
& io_rBuffer
)
101 io_rBuffer
.reserve(WRITE_BUFFER_INITIAL_CAPACITY
);
104 void writeBinaryBuffer( const OutputBuffer
& rBuffer
)
106 // ---sync point--- see SYNC STREAMS above
109 // put buffer to stderr
110 if( !rBuffer
.empty() )
111 if( fwrite(&rBuffer
[0], sizeof(char),
112 rBuffer
.size(), g_binary_out
) != (size_t)rBuffer
.size() )
115 // ---sync point--- see SYNC STREAMS above
116 fflush(g_binary_out
);
119 void writeJpeg_( OutputBuffer
& o_rOutputBuf
, Stream
* str
, bool bWithLinefeed
)
121 // dump JPEG file as-is
122 str
= ((DCTStream
*)str
)->getRawStream();
126 o_rOutputBuf
.clear();
127 while((c
=str
->getChar()) != EOF
)
128 o_rOutputBuf
.push_back(static_cast<char>(c
));
130 printf( " JPEG %d", (int)o_rOutputBuf
.size() );
137 void writePbm_(OutputBuffer
& o_rOutputBuf
, Stream
* str
, int width
, int height
, bool bWithLinefeed
, bool bInvert
)
139 // write as PBM (char by char, to avoid stdlib lineend messing)
140 o_rOutputBuf
.clear();
141 o_rOutputBuf
.resize(WRITE_BUFFER_SIZE
);
142 o_rOutputBuf
[0] = 'P';
143 o_rOutputBuf
[1] = '4';
144 o_rOutputBuf
[2] = 0x0A;
145 int nOutLen
= snprintf(&o_rOutputBuf
[3], WRITE_BUFFER_SIZE
-10, "%d %d", width
, height
);
147 nOutLen
= WRITE_BUFFER_SIZE
-10;
148 o_rOutputBuf
[3+nOutLen
] =0x0A;
149 o_rOutputBuf
[3+nOutLen
+1]=0;
151 const int header_size
= 3+nOutLen
+1;
152 const int size
= height
* ((width
+ 7) / 8);
154 printf( " PBM %d", size
+ header_size
);
158 // trim buffer to exact header length
159 o_rOutputBuf
.resize(header_size
);
164 // copy the raw stream
167 for( int i
=0; i
<size
; ++i
)
168 o_rOutputBuf
.push_back(static_cast<char>(str
->getChar() ^ 0xff));
172 for( int i
=0; i
<size
; ++i
)
173 o_rOutputBuf
.push_back(static_cast<char>(str
->getChar()));
179 void writePpm_( OutputBuffer
& o_rOutputBuf
,
183 GfxImageColorMap
* colorMap
,
186 // write as PPM (char by char, to avoid stdlib lineend messing)
187 o_rOutputBuf
.clear();
188 o_rOutputBuf
.resize(WRITE_BUFFER_SIZE
);
189 o_rOutputBuf
[0] = 'P';
190 o_rOutputBuf
[1] = '6';
191 o_rOutputBuf
[2] = '\n';
192 int nOutLen
= snprintf(&o_rOutputBuf
[3], WRITE_BUFFER_SIZE
-10, "%d %d", width
, height
);
194 nOutLen
= WRITE_BUFFER_SIZE
-10;
195 o_rOutputBuf
[3+nOutLen
] ='\n';
196 o_rOutputBuf
[3+nOutLen
+1]='2';
197 o_rOutputBuf
[3+nOutLen
+2]='5';
198 o_rOutputBuf
[3+nOutLen
+3]='5';
199 o_rOutputBuf
[3+nOutLen
+4]='\n';
200 o_rOutputBuf
[3+nOutLen
+5]=0;
202 const int header_size
= 3+nOutLen
+5;
203 const int size
= width
*height
*3 + header_size
;
205 printf( " PPM %d", size
);
209 // trim buffer to exact header size
210 o_rOutputBuf
.resize(header_size
);
215 ImageStream
* imgStr
=
218 colorMap
->getNumPixelComps(),
219 colorMap
->getBits());
222 for( int y
=0; y
<height
; ++y
)
224 p
= imgStr
->getLine();
225 for( int x
=0; x
<width
; ++x
)
227 colorMap
->getRGB(p
, &rgb
);
228 o_rOutputBuf
.push_back(colToByte(rgb
.r
));
229 o_rOutputBuf
.push_back(colToByte(rgb
.g
));
230 o_rOutputBuf
.push_back(colToByte(rgb
.b
));
232 p
+=colorMap
->getNumPixelComps();
240 // call this only for 1 bit image streams !
241 void writePng_( OutputBuffer
& o_rOutputBuf
,
250 o_rOutputBuf
.clear();
253 PngHelper::createPng( o_rOutputBuf
, str
, width
, height
, zeroColor
, oneColor
, bIsMask
);
255 printf( " PNG %d", (int)o_rOutputBuf
.size() );
260 void writePng_( OutputBuffer
& o_rOutputBuf
,
262 int width
, int height
, GfxImageColorMap
* colorMap
,
264 int maskWidth
, int maskHeight
, GfxImageColorMap
* maskColorMap
,
267 o_rOutputBuf
.clear();
270 PngHelper::createPng( o_rOutputBuf
, str
, width
, height
, colorMap
, maskStr
, maskWidth
, maskHeight
, maskColorMap
);
272 printf( " PNG %d", (int)o_rOutputBuf
.size() );
277 void writePng_( OutputBuffer
& o_rOutputBuf
,
279 int width
, int height
, GfxImageColorMap
* colorMap
,
281 int maskWidth
, int maskHeight
, bool maskInvert
,
284 o_rOutputBuf
.clear();
287 PngHelper::createPng( o_rOutputBuf
, str
, width
, height
, colorMap
, maskStr
, maskWidth
, maskHeight
, maskInvert
);
289 printf( " PNG %d", (int)o_rOutputBuf
.size() );
294 // stolen from ImageOutputDev.cc
295 void writeMask_( OutputBuffer
& o_rOutputBuf
, Stream
* str
, int width
, int height
, bool bWithLinefeed
, bool bInvert
)
297 if( str
->getKind() == strDCT
)
298 writeJpeg_(o_rOutputBuf
, str
, bWithLinefeed
);
300 writePbm_(o_rOutputBuf
, str
, width
, height
, bWithLinefeed
, bInvert
);
303 void writeImage_( OutputBuffer
& o_rOutputBuf
,
307 GfxImageColorMap
* colorMap
,
311 if( str
->getKind() == strDCT
&&
312 (colorMap
->getNumPixelComps() == 1 ||
313 colorMap
->getNumPixelComps() == 3) )
315 writeJpeg_(o_rOutputBuf
, str
, bWithLinefeed
);
317 else if (colorMap
->getNumPixelComps() == 1 &&
318 colorMap
->getBits() == 1)
320 // this is a two color bitmap, write a png
321 // provide default colors
322 GfxRGB zeroColor
= { 0, 0, 0 },
323 oneColor
= { byteToCol( 0xff ), byteToCol( 0xff ), byteToCol( 0xff ) };
324 if( colorMap
->getColorSpace()->getMode() == csIndexed
|| colorMap
->getColorSpace()->getMode() == csDeviceGray
)
327 colorMap
->getRGB( &nIndex
, &zeroColor
);
329 colorMap
->getRGB( &nIndex
, &oneColor
);
331 writePng_( o_rOutputBuf
, str
, width
, height
, zeroColor
, oneColor
, false, bWithLinefeed
);
334 writePpm_( o_rOutputBuf
, str
, width
, height
, colorMap
, bWithLinefeed
);
338 // ------------------------------------------------------------------
340 inline void writeImage( OutputBuffer
& o_rOutputBuf
,
344 GfxImageColorMap
* colorMap
) { writeImage_(o_rOutputBuf
,str
,width
,height
,colorMap
,false); }
345 inline void writeImageLF( OutputBuffer
& o_rOutputBuf
,
349 GfxImageColorMap
* colorMap
) { writeImage_(o_rOutputBuf
,str
,width
,height
,colorMap
,true); }
350 inline void writeMask( OutputBuffer
& o_rOutputBuf
,
354 bool bInvert
) { writeMask_(o_rOutputBuf
,str
,width
,height
,false,bInvert
); }
355 inline void writeMaskLF( OutputBuffer
& o_rOutputBuf
,
359 bool bInvert
) { writeMask_(o_rOutputBuf
,str
,width
,height
,true,bInvert
); }
361 // ------------------------------------------------------------------
364 int PDFOutDev::parseFont( long long nNewId
, GfxFont
* gfxFont
, GfxState
* state
) const
366 FontAttributes aNewFont
;
369 GooString
* pFamily
= gfxFont
->getName();
371 pFamily
= gfxFont
->getOrigName();
374 aNewFont
.familyName
.clear();
375 aNewFont
.familyName
.append( gfxFont
->getName() );
379 aNewFont
.familyName
.clear();
380 aNewFont
.familyName
.append( "Arial" );
383 aNewFont
.isBold
= gfxFont
->isBold();
384 aNewFont
.isItalic
= gfxFont
->isItalic();
385 aNewFont
.size
= state
->getTransformedFontSize();
386 aNewFont
.isUnderline
= false;
388 if( gfxFont
->getType() == fontTrueType
|| gfxFont
->getType() == fontType1
)
390 // TODO(P3): Unfortunately, need to read stream twice, since
391 // we must write byte count to stdout before
392 char* pBuf
= gfxFont
->readEmbFontFile( m_pDoc
->getXRef(), &nSize
);
394 aNewFont
.isEmbedded
= true;
397 m_aFontMap
[ nNewId
] = aNewFont
;
401 void PDFOutDev::writeFontFile( GfxFont
* gfxFont
) const
403 if( gfxFont
->getType() != fontTrueType
&& gfxFont
->getType() != fontType1
)
407 char* pBuf
= gfxFont
->readEmbFontFile( m_pDoc
->getXRef(), &nSize
);
411 // ---sync point--- see SYNC STREAMS above
414 if( fwrite(pBuf
, sizeof(char), nSize
, g_binary_out
) != (size_t)nSize
)
417 // ---sync point--- see SYNC STREAMS above
418 fflush(g_binary_out
);
421 void PDFOutDev::printPath( GfxPath
* pPath
) const
423 int nSubPaths
= pPath
? pPath
->getNumSubpaths() : 0;
424 for( int i
=0; i
<nSubPaths
; i
++ )
426 GfxSubpath
* pSub
= pPath
->getSubpath( i
);
427 const int nPoints
= pSub
->getNumPoints();
429 printf( " subpath %d", pSub
->isClosed() );
431 for( int n
=0; n
<nPoints
; ++n
)
434 normalize(pSub
->getX(n
)),
435 normalize(pSub
->getY(n
)),
441 PDFOutDev::PDFOutDev( PDFDoc
* pDoc
) :
444 m_pUtf8Map( new UnicodeMap((char*)"UTF-8", gTrue
, &mapUTF8
) )
448 void PDFOutDev::startPage(int /*pageNum*/, GfxState
* state
)
451 printf("startPage %f %f\n",
452 normalize(state
->getPageWidth()),
453 normalize(state
->getPageHeight()));
456 void PDFOutDev::endPage()
461 void PDFOutDev::processLink(Link
* link
, Catalog
*)
466 link
->getRect( &x1
, &y1
, &x2
, &y2
);
468 LinkAction
* pAction
= link
->getAction();
469 if( pAction
->getKind() == actionURI
)
471 const char* pURI
= static_cast<LinkURI
*>(pAction
)->getURI()->getCString();
473 printf( "drawLink %f %f %f %f %s\n",
478 escapeLineFeed(pURI
) );
482 void PDFOutDev::saveState(GfxState
*)
484 printf( "saveState\n" );
487 void PDFOutDev::restoreState(GfxState
*)
489 printf( "restoreState\n" );
492 void PDFOutDev::setDefaultCTM(double *pMat
)
496 OutputDev::setDefaultCTM(pMat
);
498 printf( "updateCtm %f %f %f %f %f %f\n",
504 normalize(pMat
[5]) );
507 void PDFOutDev::updateCTM(GfxState
* state
,
514 const double* const pMat
= state
->getCTM();
517 printf( "updateCtm %f %f %f %f %f %f\n",
523 normalize(pMat
[5]) );
526 void PDFOutDev::updateLineDash(GfxState
*state
)
530 double* dashArray
; int arrayLen
; double startOffset
;
531 state
->getLineDash(&dashArray
, &arrayLen
, &startOffset
);
533 printf( "updateLineDash" );
534 if( arrayLen
&& dashArray
)
536 printf( " %f %d", normalize(startOffset
), arrayLen
);
537 for( int i
=0; i
<arrayLen
; ++i
)
538 printf( " %f", normalize(*dashArray
++) );
543 void PDFOutDev::updateFlatness(GfxState
*state
)
546 printf( "updateFlatness %d\n", state
->getFlatness() );
549 void PDFOutDev::updateLineJoin(GfxState
*state
)
552 printf( "updateLineJoin %d\n", state
->getLineJoin() );
555 void PDFOutDev::updateLineCap(GfxState
*state
)
558 printf( "updateLineCap %d\n", state
->getLineCap() );
561 void PDFOutDev::updateMiterLimit(GfxState
*state
)
564 printf( "updateMiterLimit %f\n", normalize(state
->getMiterLimit()) );
567 void PDFOutDev::updateLineWidth(GfxState
*state
)
570 printf( "updateLineWidth %f\n", normalize(state
->getLineWidth()) );
573 void PDFOutDev::updateFillColor(GfxState
*state
)
578 state
->getFillRGB( &aRGB
);
580 printf( "updateFillColor %f %f %f %f\n",
581 normalize(colToDbl(aRGB
.r
)),
582 normalize(colToDbl(aRGB
.g
)),
583 normalize(colToDbl(aRGB
.b
)),
584 normalize(state
->getFillOpacity()) );
587 void PDFOutDev::updateStrokeColor(GfxState
*state
)
592 state
->getStrokeRGB( &aRGB
);
594 printf( "updateStrokeColor %f %f %f %f\n",
595 normalize(colToDbl(aRGB
.r
)),
596 normalize(colToDbl(aRGB
.g
)),
597 normalize(colToDbl(aRGB
.b
)),
598 normalize(state
->getFillOpacity()) );
601 void PDFOutDev::updateFillOpacity(GfxState
*state
)
603 updateFillColor(state
);
606 void PDFOutDev::updateStrokeOpacity(GfxState
*state
)
608 updateStrokeColor(state
);
611 void PDFOutDev::updateBlendMode(GfxState
*)
615 void PDFOutDev::updateFont(GfxState
*state
)
619 GfxFont
*gfxFont
= state
->getFont();
622 FontAttributes aFont
;
625 Ref
* pID
= gfxFont
->getID();
626 // TODO(Q3): Portability problem
627 long long fontID
= (long long)pID
->gen
<< 32 | (long long)pID
->num
;
628 std::hash_map
< long long, FontAttributes
>::const_iterator it
=
629 m_aFontMap
.find( fontID
);
630 if( it
== m_aFontMap
.end() )
632 nEmbedSize
= parseFont( fontID
, gfxFont
, state
);
633 it
= m_aFontMap
.find( fontID
);
636 printf( "updateFont" );
637 if( it
!= m_aFontMap
.end() )
639 // conflating this with printf below crashes under Windoze
640 printf( " %lld", fontID
);
643 printf( " %d %d %d %d %f %d %s",
648 normalize(state
->getTransformedFontSize()),
650 escapeLineFeed(aFont
.familyName
.getCString()) );
655 writeFontFile(gfxFont
);
659 void PDFOutDev::updateRender(GfxState
*state
)
663 printf( "setTextRenderMode %d\n", state
->getRender() );
666 void PDFOutDev::stroke(GfxState
*state
)
670 printf( "strokePath" );
671 printPath( state
->getPath() );
675 void PDFOutDev::fill(GfxState
*state
)
679 printf( "fillPath" );
680 printPath( state
->getPath() );
684 void PDFOutDev::eoFill(GfxState
*state
)
688 printf( "eoFillPath" );
689 printPath( state
->getPath() );
693 void PDFOutDev::clip(GfxState
*state
)
697 printf( "clipPath" );
698 printPath( state
->getPath() );
702 void PDFOutDev::eoClip(GfxState
*state
)
706 printf( "eoClipPath" );
707 printPath( state
->getPath() );
715 horizontal skip for character (already scaled with font size) +
716 inter-char space: cursor is shifted by this amount for next char
719 vertical skip for character (zero for horizontal writing mode):
720 cursor is shifted by this amount for next char
723 local offset of character (zero for horizontal writing mode). not
724 taken into account for output pos updates. Used for vertical writing.
727 local offset of character (zero for horizontal writing mode). not
728 taken into account for output pos updates. Used for vertical writing.
730 void PDFOutDev::drawChar(GfxState
*state
, double x
, double y
,
731 double dx
, double dy
,
732 double originX
, double originY
,
733 CharCode
, int /*nBytes*/, Unicode
*u
, int uLen
)
740 // normalize coordinates: correct from baseline-relative to upper
741 // left corner of glyphs
742 double x2(0.0), y2(0.0);
743 state
->textTransformDelta( 0.0,
744 state
->getFont()->getAscent(),
746 const double fFontSize(state
->getFontSize());
750 const double aPositionX(x
-originX
);
751 const double aPositionY(y
-originY
);
752 // TODO(F2): use leading here, when set
753 const double nWidth(dx
!= 0.0 ? dx
: fFontSize
);
754 const double nHeight(dy
!= 0.0 ? dy
: fFontSize
);
756 const double* pTextMat
=state
->getTextMat();
757 printf( "drawChar %f %f %f %f %f %f %f %f ",
758 normalize(aPositionX
),
759 normalize(aPositionY
),
760 normalize(aPositionX
+nWidth
),
761 normalize(aPositionY
-nHeight
),
762 normalize(pTextMat
[0]),
763 normalize(pTextMat
[2]),
764 normalize(pTextMat
[1]),
765 normalize(pTextMat
[3]) );
767 // silence spurious warning
771 for( int i
=0; i
<uLen
; ++i
)
773 buf
[ m_pUtf8Map
->mapUnicode(u
[i
], buf
, sizeof(buf
)-1) ] = 0;
774 printf( "%s", escapeLineFeed(buf
) );
780 void PDFOutDev::drawString(GfxState
*, GooString
* /*s*/)
785 void PDFOutDev::endTextObject(GfxState
*)
787 printf( "endTextObject\n" );
790 void PDFOutDev::drawImageMask(GfxState
* pState
, Object
*, Stream
* str
,
791 int width
, int height
, GBool invert
,
792 GBool
/*inlineImg*/ )
794 OutputBuffer aBuf
; initBuf(aBuf
);
796 printf( "drawMask %d %d %d", width
, height
, invert
);
798 int bitsPerComponent
= 1;
799 StreamColorSpaceMode csMode
= streamCSNone
;
800 str
->getImageParams( &bitsPerComponent
, &csMode
);
801 if( bitsPerComponent
== 1 && (csMode
== streamCSNone
|| csMode
== streamCSDeviceGray
) )
803 GfxRGB oneColor
= { dblToCol( 1.0 ), dblToCol( 1.0 ), dblToCol( 1.0 ) };
804 GfxRGB zeroColor
= { dblToCol( 0.0 ), dblToCol( 0.0 ), dblToCol( 0.0 ) };
805 pState
->getFillColorSpace()->getRGB( pState
->getFillColor(), &zeroColor
);
807 writePng_( aBuf
, str
, width
, height
, oneColor
, zeroColor
, true, true );
809 writePng_( aBuf
, str
, width
, height
, zeroColor
, oneColor
, true, true );
812 writeMaskLF(aBuf
, str
, width
, height
, invert
!= 0);
813 writeBinaryBuffer(aBuf
);
816 void PDFOutDev::drawImage(GfxState
*, Object
*, Stream
* str
,
817 int width
, int height
, GfxImageColorMap
* colorMap
,
818 int* maskColors
, GBool
/*inlineImg*/ )
820 OutputBuffer aBuf
; initBuf(aBuf
);
821 OutputBuffer aMaskBuf
;
823 printf( "drawImage %d %d", width
, height
);
827 // write mask colors. nBytes must be even - first half is
828 // lower bound values, second half upper bound values
829 if( colorMap
->getColorSpace()->getMode() == csIndexed
)
831 aMaskBuf
.push_back( (char)maskColors
[0] );
832 aMaskBuf
.push_back( (char)maskColors
[gfxColorMaxComps
] );
837 colorMap
->getColorSpace()->getRGB(
838 (GfxColor
*)maskColors
,
842 colorMap
->getColorSpace()->getRGB(
843 (GfxColor
*)maskColors
+gfxColorMaxComps
,
846 aMaskBuf
.push_back( colToByte(aMinRGB
.r
) );
847 aMaskBuf
.push_back( colToByte(aMinRGB
.g
) );
848 aMaskBuf
.push_back( colToByte(aMinRGB
.b
) );
849 aMaskBuf
.push_back( colToByte(aMaxRGB
.r
) );
850 aMaskBuf
.push_back( colToByte(aMaxRGB
.g
) );
851 aMaskBuf
.push_back( colToByte(aMaxRGB
.b
) );
855 printf( " %d", (int)aMaskBuf
.size() );
856 writeImageLF( aBuf
, str
, width
, height
, colorMap
);
857 writeBinaryBuffer(aBuf
);
858 writeBinaryBuffer(aMaskBuf
);
861 void PDFOutDev::drawMaskedImage(GfxState
*, Object
*, Stream
* str
,
862 int width
, int height
,
863 GfxImageColorMap
* colorMap
,
865 int maskWidth
, int maskHeight
,
868 OutputBuffer aBuf
; initBuf(aBuf
);
869 printf( "drawImage %d %d 0", width
, height
);
870 writePng_( aBuf
, str
, width
, height
, colorMap
, maskStr
, maskWidth
, maskHeight
, maskInvert
, true );
871 writeBinaryBuffer( aBuf
);
873 OutputBuffer aBuf
; initBuf(aBuf
);
874 OutputBuffer aMaskBuf
; initBuf(aMaskBuf
);
876 printf( "drawMaskedImage %d %d %d %d %d", width
, height
, maskWidth
, maskHeight
, 0 /*maskInvert note: currently we do inversion here*/ );
877 writeImage( aBuf
, str
, width
, height
, colorMap
);
878 writeMaskLF( aMaskBuf
, maskStr
, width
, height
, maskInvert
);
879 writeBinaryBuffer(aBuf
);
880 writeBinaryBuffer(aMaskBuf
);
884 void PDFOutDev::drawSoftMaskedImage(GfxState
*, Object
*, Stream
* str
,
885 int width
, int height
,
886 GfxImageColorMap
* colorMap
,
888 int maskWidth
, int maskHeight
,
889 GfxImageColorMap
* maskColorMap
)
891 OutputBuffer aBuf
; initBuf(aBuf
);
892 printf( "drawImage %d %d 0", width
, height
);
893 writePng_( aBuf
, str
, width
, height
, colorMap
, maskStr
, maskWidth
, maskHeight
, maskColorMap
, true );
894 writeBinaryBuffer( aBuf
);
896 OutputBuffer aBuf
; initBuf(aBuf
);
897 OutputBuffer aMaskBuf
; initBuf(aMaskBuf
);
899 printf( "drawSoftMaskedImage %d %d %d %d", width
, height
, maskWidth
, maskHeight
);
900 writeImage( aBuf
, str
, width
, height
, colorMap
);
901 writeImageLF( aMaskBuf
, maskStr
, maskWidth
, maskHeight
, maskColorMap
);
902 writeBinaryBuffer(aBuf
);
903 writeBinaryBuffer(aMaskBuf
);
907 void PDFOutDev::setPageNum( int nNumPages
)
909 // TODO(F3): printf might format int locale-dependent!
910 printf("setPageNum %d\n", nNumPages
);