diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def | 143 |
1 files changed, 102 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def index b9669434a4a..a5806aeab78 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfmx.def,v 1.3 2009/05/22 07:25:48 jinhwancho Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfmx.def,v 1.12 2013/08/28 11:00:54 tantau Exp $ % Driver commands for dvipdfmx % @@ -20,6 +20,7 @@ % \input pgfsys-common-pdf.def + % For unique object name: \newcount\pgfsys@objnum\pgfsys@objnum\@ne @@ -38,41 +39,65 @@ % To avoid this problem, we need to change the color temporarily to another. % % We assume that black is the default color when no color is specified. -\def\start@force@reset@color{% +\def\pgfsys@dvipdfmx@start@force@reset@color{% \special{pdf:bcolor [1]}% \special{pdf:bcolor [0]}% } -\def\stop@force@reset@color{% +\def\pgfsys@dvipdfmx@stop@force@reset@color{% \special{pdf:ecolor}% \special{pdf:ecolor}% } + +\def\pgfsys@dvipdfmx@suspendcontent{% + \special{pdf:code q -1 0 0 -1 0 0 cm q}% + \special{pdf: econtent}% + \special{pdf: bcontent}% + \special{pdf:code -1 0 0 -1 0 0 cm}% + \special{pdf:code q}% translate to original system + \special{pdf: econtent}% +} + +\def\pgfsys@dvipdfmx@unsuspendcontent{% + \special{pdf: bcontent}% + \special{pdf:code Q Q Q}% +} + +\def\pgfsys@hbox#1{% + \pgfsys@beginscope% + \setbox#1=\hbox{\box#1}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \pgfsys@dvipdfmx@suspendcontent% + \pgfsys@invoke{0 J [] 0 d}% reset line cap and dash + \pgfsys@dvipdfmx@start@force@reset@color% + \box#1% + \pgfsys@dvipdfmx@stop@force@reset@color% + \pgfsys@dvipdfmx@unsuspendcontent% + \pgfsys@endscope% +} + % We cannot use many codes in pgfsys-common-pdf-via-dvi.def. % So it is rewritten here (with some bugs fixed). \def\pgfsys@hboxsynced#1{% - {% - \pgfsys@beginscope% - \setbox\pgf@hbox=\hbox{% - \hskip\pgf@pt@x% - \raise\pgf@pt@y\hbox{% - \pgf@pt@x=0pt% - \pgf@pt@y=0pt% - % The order of `pdf:bcontent' is important here. It should be - % followed by \pgflowlevelsynccm, not reverse order. - \special{pdf:bcontent}% - \pgflowlevelsynccm% - \start@force@reset@color% - \pgfsys@hbox#1% - \stop@force@reset@color% - \special{pdf:econtent}}% - \hss% - }% - \wd\pgf@hbox=0pt% - \ht\pgf@hbox=0pt% - \dp\pgf@hbox=0pt% - \box\pgf@hbox% - \pgfsys@endscope% - }% + \pgfsys@beginscope% + \setbox#1=\hbox{\box#1}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \pgfsys@dvipdfmx@suspendcontent% + \pgfsys@invoke{0 J [] 0 d}% reset line cap and dash + \pgfsys@dvipdfmx@start@force@reset@color% + \pgf@sys@bp@correct\pgf@pt@x% + \pgf@sys@bp@correct\pgf@pt@y% + \special{pdf:btrans matrix \pgf@pt@aa\space \pgf@pt@ab\space \pgf@pt@ba\space \pgf@pt@bb\space + \pgf@sys@tonumber{\pgf@pt@x} \pgf@sys@tonumber{\pgf@pt@y}}% + \box#1% + \special{pdf:etrans}% + \pgfsys@dvipdfmx@stop@force@reset@color% + \pgfsys@dvipdfmx@unsuspendcontent% + \pgfsys@endscope% } % All text materials between `pdf:bcontent' and `pdf:econtent' are @@ -202,7 +227,7 @@ \def\pgfsys@markposition##1{% \pdfsavepos% \edef\pgf@temp{##1}% - \expandafter\write\expandafter\pgfutil@auxout\expandafter{% + \expandafter\pgfutil@writetoaux\expandafter{% \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}% } \def\pgfsyspdfmark##1##2##3{% @@ -272,7 +297,7 @@ % Image Mask came from pgfsys-pdftex.def % generic/pgf/basiclayer/pgfcoreimage.code.tex must be modified! \def\pgfsys@defineimage{% width, height, page number - \ifx\includegraphics\relax + \ifx\includegraphics\undefined \ifx\pgf@imagewidth\pgfutil@empty\edef\pgf@imagewidth{1bp}\fi% width? \ifx\pgf@imageheight\pgfutil@empty\edef\pgf@imageheight{1bp}\fi% height? \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{ page \pgf@imagepage}\fi% @@ -316,18 +341,32 @@ \pgf@sys@bp@correct\pgf@xc% \pgf@sys@bp@correct\pgf@yc% % Now create the pattern object: - \special{pdf:stream @pgf@patternobject@#1 (#8) - << /Type /Pattern - /PatternType 1 - /PaintType \ifnum#9=0 2 \else 1 \fi - /TilingType 1 - /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] - /XStep \pgf@sys@tonumber\pgf@xc\space - /YStep \pgf@sys@tonumber\pgf@yc\space - /Resources << >> %<< - >>}% - \pgfutil@addpdfresource@patterns{/pgfpat#1\space @pgf@patternobject@#1}% + \pgfsys@dvipdfmx@patternobj{% + \pgfsys@dvipdfmx@stream{@pgfpatternobject#1}{#8}{% + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /Resources << >> %<< + }% + }% + \pgfutil@addpdfresource@patterns{/pgfpat#1\space @pgfpatternobject#1}% } + +% hook for xdvipdfmx: +\def\pgfsys@dvipdfmx@patternobj#1{% + #1% +}% + +% hook for xdvipdfmx: +\def\pgfsys@dvipdfmx@stream#1#2#3{% + \special{pdf:stream #1 (#2) << #3 >>}% +}% + + \def\pgfsys@setpatternuncolored#1#2#3#4{% \pgfsysprotocol@literal{/pgfprgb cs #2 #3 #4 /pgfpat#1\space scn}% } @@ -356,6 +395,12 @@ \ht#2=0pt% \dp#2=0pt% \box#2% + \special{pdf:put @resources + << + \ifpgf@sys@pdf@extgs@exists /ExtGState @pgfextgs \fi + \ifpgf@sys@pdf@patterns@exists /Pattern @pgfpatterns \fi + \ifpgf@sys@pdf@colorspaces@exists /ColorSpace @pgfcolorspaces \fi + >>}% << \special{pdf:exobj <</Group <</S/Transparency /CS/DeviceGray>> >>}}}\@tempa% \expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pgfsys@objnum}% }% @@ -364,7 +409,7 @@ } \def\pgfsys@usefading#1#2#3#4#5#6#7{% \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax% - \PackageError{pgf}{Undefined fading '#1'}{}% + \pgferror{Undefined fading '#1'}% \else% {% \expandafter\ifx\csname pgfsmask@#1\endcsname\relax% @@ -405,7 +450,16 @@ \ht#1=0pt% \dp#1=0pt% \hskip\pgf@picminx bp\box#1\hskip-\pgf@picminx bp% - \special{pdf:exobj <</Group <</S/Transparency>> >>}}}\@tempa% + \special{pdf:put @resources + << + \ifpgf@sys@pdf@extgs@exists /ExtGState @pgfextgs \fi + \ifpgf@sys@pdf@patterns@exists /Pattern @pgfpatterns \fi + \ifpgf@sys@pdf@colorspaces@exists /ColorSpace @pgfcolorspaces \fi + >>}% << + \special{pdf:exobj <</Group << /S /Transparency + /I \ifpgfsys@transparency@group@isolated true \else false \fi + /K \ifpgfsys@transparency@group@knockout true \else false \fi>> >>}% + }}\@tempa% \special{pdf:uxobj @pgftransgroup\the\pgfsys@objnum}% }% \global\advance\pgfsys@objnum\@ne% @@ -421,6 +475,13 @@ \fi \fi +\def\pgfsys@papersize#1#2{% +% \expandafter\gdef\expandafter\pgfsys@atbegindocument%% +% \expandafter{\pgfsys@atbegindocument + \special{papersize=#1,#2}% +% } +} + \endinput %%% Local Variables: |