diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-07 21:24:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-07 21:24:22 +0000 |
commit | 713c3f96e876bca9b0516ae3d5fd5bd35f24d074 (patch) | |
tree | 51e9f7ad8e1417810e352008ff652e85291993f9 /Master/texmf-dist/tex/latex | |
parent | 9446eddfd01fdc4fa66d3978ee5948db7d85f98d (diff) |
animate (7may20)
git-svn-id: svn://tug.org/texlive/trunk@55056 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/animate/animate.sty | 229 |
1 files changed, 142 insertions, 87 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index b4e05000ab6..679dad68f38 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} -\def\@anim@version{2020/04/25} +\def\@anim@version{2020/05/07} \ProvidesPackage{animate} [\@anim@version\space PDF & SVG animations from files and inline graphics] @@ -316,12 +316,8 @@ \gdef\@anim@lscape{}% \gdef\@anim@@lscape{:ls}% \ifdefined\landscape% -% \if@anim@dvisvgm% disable `landscape' environment -% \renewenvironment{landscape}{}{}% -% \else% - \g@addto@macro{\landscape}{\gdef\@anim@lscape{:ls}}% - \g@addto@macro{\endlandscape}{\gdef\@anim@lscape{}}% -% \fi% + \g@addto@macro{\landscape}{\gdef\@anim@lscape{:ls}}% + \g@addto@macro{\endlandscape}{\gdef\@anim@lscape{}}% \fi% } @@ -618,7 +614,6 @@ %dvips .OR. dvisvgm %stroking commands \def\@anim@btnend{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -632,8 +627,9 @@ 14 1 6.5 1 2 arct closepath \ifx\empty\@anim@bg\empty\else - gsave \@anim@bg\space fill grestore + gsave \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke % 1 setlinewidth @@ -647,7 +643,6 @@ stroke } \def\@anim@btnstep{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -661,8 +656,9 @@ 14 1 6.5 1 2 arct closepath \ifx\empty\@anim@bg\empty\else - gsave \@anim@bg\space fill grestore + gsave \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke % 1 setlinewidth @@ -672,7 +668,6 @@ stroke } \def\@anim@btnplay{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -682,8 +677,9 @@ 14 14 1 14 2 arct 0 14 lineto \ifx\empty\@anim@bg\empty\else - gsave closepath \@anim@bg\space fill grestore + gsave closepath \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke 0.1 setlinewidth 0 14 moveto @@ -698,7 +694,6 @@ stroke } \def\@anim@btnpause{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -708,8 +703,9 @@ 14 14 1 14 2 arct 0 14 lineto \ifx\empty\@anim@bg\empty\else - gsave closepath \@anim@bg\space fill grestore + gsave closepath \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke % 0 setlinecap @@ -719,7 +715,6 @@ stroke } \def\@anim@btnminus{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -733,8 +728,9 @@ 14 1 6.5 1 2 arct closepath \ifx\empty\@anim@bg\empty\else - gsave \@anim@bg\space fill grestore + gsave \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke % 1.0 setlinewidth @@ -744,7 +740,6 @@ stroke } \def\@anim@btnplus{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -758,8 +753,9 @@ 14 1 6.5 1 2 arct closepath \ifx\empty\@anim@bg\empty\else - gsave \@anim@bg\space fill grestore + gsave \@anim@bg\space bgfill grestore \fi + \@anim@fg\space stroke % 1.0 setlinewidth @@ -770,8 +766,19 @@ 7.5 10.3 lineto stroke } + \def\@anim@btnresetbg{% Reset-button background for dvisvgm + 6.5 1 moveto + 1 1 1 6.5 2 arct + 1 6.5 lineto + 1 14 6.5 14 2 arct + 6.5 14 lineto + 14 14 14 6.5 2 arct + 14 6.5 lineto + 14 1 6.5 1 2 arct + closepath + \@anim@bg\space fill + } \def\@anim@btnreset{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -784,9 +791,10 @@ 14 6.5 lineto 14 1 6.5 1 2 arct closepath - \ifx\empty\@anim@bg\empty\else - gsave \@anim@bg\space fill grestore - \fi + \ifx\empty\@anim@bg\empty\else\if@anim@dvisvgm\else + gsave \@anim@bg\space bgfill grestore + \fi\fi + \@anim@fg\space stroke % 1 setlinewidth @@ -817,66 +825,135 @@ \ifx\@anim@EndLeft\@anim@arg% \@anim@xbutton{EndLeft}{% [-1 0 0 1 15 0] concat - \ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnend}{#2}% \fi% \ifx\@anim@EndRight\@anim@arg% \@anim@xbutton{EndRight}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnend}{#2}% \fi% \ifx\@anim@Minus\@anim@arg% \@anim@xbutton{Minus}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnminus}{#2}% \fi% \ifx\@anim@PauseLeft\@anim@arg% \@anim@xbutton{PauseLeft}{% [-1 0 0 1 15 0] concat - \ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnpause}{#2}% \fi% \ifx\@anim@PauseRight\@anim@arg% \@anim@xbutton{PauseRight}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnpause}{#2}% \fi% \ifx\@anim@PlayLeft\@anim@arg% \@anim@xbutton{PlayLeft}{% [-1 0 0 1 15 0] concat - \ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnplay}{#2}% \fi% \ifx\@anim@PlayRight\@anim@arg% \@anim@xbutton{PlayRight}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnplay}{#2}% \fi% \ifx\@anim@Plus\@anim@arg% \@anim@xbutton{Plus}{\@anim@btnplus}{#2}% \fi% \ifx\@anim@Reset\@anim@arg% - \@anim@xbutton{Reset}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% - \@anim@btnreset}{#2}% + \if@anim@dvisvgm% Reset btn has filled foreground parts. In dvisvgm, for + % filling and setting transparency correctly, BG and FG are treated + % separately. + \ifcsname btn#1:#2\endcsname\else% + \ifx\empty\@anim@bg\empty\else% + \@anim@xbutton{ResetBG}{\@anim@btnresetbg}{#2}% + \fi% + \begingroup% + \def\@anim@alpha{}% + \@anim@xbutton{ResetFG}{\@anim@btnreset}{#2}% + \endgroup% + \ifx\empty\@anim@bg\empty\else% + \global\setbox\@anim@box=\hbox to \@anim@btnsize {% + \vbox to \@anim@btnsize {\vss% + \@anim@refxform{\@anim@getkeyval{btnResetBG:#2}}% + \@anim@refxform{\@anim@lastxform}% + }\hss% + }% + \@anim@xform{0}{1}{}{}{\@anim@box}% + \fi% + \@anim@newkey{btn#1:#2}{\@anim@lastxform}% + \fi% + \else% + \@anim@xbutton{Reset}{% + \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \@anim@btnreset}{#2}% + \fi% \fi% \ifx\@anim@StepLeft\@anim@arg% \@anim@xbutton{StepLeft}{% [-1 0 0 1 15 0] concat - \ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnstep}{#2}% \fi% \ifx\@anim@StepRight\@anim@arg% \@anim@xbutton{StepRight}{% - \ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi% + \if@anim@dvisvgm\else\ifx\@anim@lscape\@anim@@lscape + [0 1 -1 0 15 0] concat + \fi\fi% \@anim@btnstep}{#2}% \fi% } \def\@anim@xbutton#1#2#3{% #1: name; #2: stroking commands, + % only create if button face doesn't exist yet \ifcsname btn#1:#3\endcsname\else% #3: current colour+alpha+ ... combination - % only create if button face doesn't exist yet \global\setbox\@anim@box=\hbox to 15bp {\vbox to 15bp {\vss% - \@anim@literal{}{#2}% + \@anim@literal{}{% + save + \ifx\empty\@anim@alpha\empty% + /bgfill {fill} bind def + \else\if@anim@dvisvgm + /bgfill {fill} bind def + \else% + /bgfill {% + /.setfillconstantalpha where {% + pop gsave \@anim@alpha\space .setfillconstantalpha fill + 1 .setfillconstantalpha newpath fill grestore newpath% + }{% + /.setopacityalpha where {% + pop gsave \@anim@alpha\space .setopacityalpha fill + 1 .setopacityalpha newpath fill grestore newpath% + }{% + %Distiller + gsave + mark /ca \@anim@alpha\space/SetTransparency pdfmark fill + mark /ca 1.0 /SetTransparency pdfmark newpath fill + grestore newpath% + } ifelse% + } ifelse% + } bind def + \fi\fi% + #2 + restore% + }% }\hss}% \if@anim@dvisvgm% \global\setbox\@anim@box=\hbox{% @@ -884,32 +961,10 @@ \fi% %distill box into XObject \@anim@xform{0}{1}{}{% - \ifx\empty\@anim@alpha\empty\else% - \if@anim@dvisvgm% - opacity='\@anim@alpha'% - \else% - /Group <</S/Transparency>>% - \fi% - \fi% + \ifx\empty\@anim@alpha\empty\else\if@anim@dvisvgm% + fill-opacity='\@anim@alpha'% + \fi\fi% }{\@anim@box}% - %nested XObject if transparency is to be added - \if@anim@dvisvgm\else% - \ifx\empty\@anim@alpha\empty\else% - \global\setbox\@anim@box=\hbox to 15bp {\vbox to 15bp {\vss% - \@anim@literal{direct}{% - /.setopacityalpha where {% - %Ghostscript - pop \@anim@alpha\space .setopacityalpha% - }{% - %Distiller - mark /CA \@anim@alpha /ca \@anim@alpha /SetTransparency pdfmark% - } ifelse% - }% - \@anim@refxform{\@anim@lastxform}% - }\hss}% - \@anim@xform{0}{0}{}{}{\@anim@box}% - \fi% - \fi% \@anim@newkey{btn#1:#3}{\@anim@lastxform}% \fi% } @@ -940,7 +995,7 @@ 0 j 100 47 m 100 103 l - S + S% } \def\@anim@btnstep{% 5 w @@ -963,7 +1018,7 @@ 55 47 m 96 75 l 55 103 l - S + S% } \def\@anim@btnplay{% 5 w @@ -987,7 +1042,7 @@ 50 40 m 50 110 l 100 75 l - s + s% } \def\@anim@btnpause{% 5 w @@ -1007,7 +1062,7 @@ 20 w 22 40 m 22 110 l - S + S% } \def\@anim@btnminus{% 5 w @@ -1030,7 +1085,7 @@ 0 J 47 75 m 103 75 l - S + S% } \def\@anim@btnplus{% 5 w @@ -1055,7 +1110,7 @@ 103 75 l 75 47 m 75 103 l - S + S% } \def\@anim@btnreset{% 5 w @@ -1079,6 +1134,7 @@ 75 103 l S \@anim@@@fg\space + \ifx\empty\@anim@alpha\empty\else/R2 gs \fi 35 50 m 70 75 l 35 100 l @@ -1093,7 +1149,7 @@ 35 75 l 120 75 m 115 75 l - S + S% } \def\@anim@makebutton#1#2{% #1: name ; #2: current colour, alpha, ... \edef\@anim@arg{#1}% @@ -1176,26 +1232,21 @@ } %XObject creation \def\@anim@xbutton#1#2#3{% #1 name, #2 stroking commands, #3 @anim@num - \ifcsname btn#1:#3\endcsname\else% only create if button face doesn't - \@anim@streamobj{% % exist yet - /Type/XObject/Subtype/Form/BBox [0 0 15 15] + \ifcsname btn#1:#3\endcsname\else% only create if button face doesn't% exist yet + \edef\@anim@arg{#1}% + \@anim@streamobj{% + /Type/XObject/Subtype/Form/BBox [0 0 15 15]% \ifx\empty\@anim@alpha\empty\else% - /Group <</S/Transparency>>% - \fi% - }{#2}% - \ifx\empty\@anim@alpha\empty\else% - \@anim@streamobj{% - /Type/XObject/Subtype/Form/BBox [0 0 15 15]% /Resources <<% /ExtGState <<% - /R1 <<% - /Type/ExtGState/ca \@anim@alpha/CA \@anim@alpha/AIS false% - >>% + /R1 <</Type/ExtGState/ca \@anim@alpha>>% + \ifx\@anim@Reset\@anim@arg% + /R2 <</Type/ExtGState/ca 1.0>>% + \fi% >>% - /XObject <</R2 \@anim@lastobj>>% >>% - }{/R1 gs /R2 Do}% - \fi% + \fi% + }{\ifx\empty\@anim@alpha\empty\else/R1 gs\fi\space #2}% \@anim@newkey{btn#1:#3}{\@anim@lastobj}% \fi% } @@ -1527,6 +1578,7 @@ \let\input@path\Ginput@path% \fi% \setkeys{anim@user}{#1}% + \ifx\empty\@anim@bg\empty\xdef\@anim@alpha{}\fi% \xdef\@anim@btnsize{\the\dimexpr\@anim@btnsize\relax}% %correct wrong option combination; totalheight overrides height \ifnum\@anim@resizeflags=3\relax% height+totalheight->totalheight @@ -1662,11 +1714,12 @@ \if@anim@export\else% % insert <script> part \if@anim@dvisvgm\@anim@script{\the\@anim@num}\fi% - \@anim@insertwidgets{\the\@anim@num}{% + \edef\@anim@btnattrs{% \@anim@bgcolour:\@anim@fgcolour:\@anim@alpha% \if@anim@dvisvgm:\@anim@btnsize:\@anim@abspage\fi% \@anim@lscape% }% + \@anim@insertwidgets{\the\@anim@num}{\@anim@btnattrs}% \fi% \fi% \@anim@endLTR% @@ -1962,7 +2015,7 @@ \@anim@annot{\@anim@btnsize}{\@anim@btnsize}{\z@}{% cursor='pointer' onmousedown='\@anim@btnJS{#1}{\@anim@arg}'% }% - \@anim@updatebbox{\@anim@btnsize}{\@anim@btnsize}{\z@}% + \@anim@updatebbox{\@anim@btnsize}{\@anim@btnsize}{0pt}% \hbox to \@anim@btnsize {% \vrule width \z@ height \@anim@btnsize depth \z@% \hss% @@ -2048,6 +2101,7 @@ \let\input@path\Ginput@path% \fi% \setkeys{anim@user}{#1}% + \ifx\empty\@anim@bg\empty\xdef\@anim@alpha{}\fi% \xdef\@anim@btnsize{\the\dimexpr\@anim@btnsize\relax}% %correct wrong option combination; totalheight overrides height \ifnum\@anim@resizeflags=3\relax% height+totalheight->totalheight @@ -2108,11 +2162,12 @@ \if@anim@export\else% % insert <script> part \if@anim@dvisvgm\@anim@script{\the\@anim@num}\fi% - \@anim@insertwidgets{\the\@anim@num}{% + \edef\@anim@btnattrs{% \@anim@bgcolour:\@anim@fgcolour:\@anim@alpha% \if@anim@dvisvgm:\@anim@btnsize:\@anim@abspage\fi% \@anim@lscape% }% + \@anim@insertwidgets{\the\@anim@num}{\@anim@btnattrs}% \fi% % if last frame used as poster, write frame num to aux file \ifnum\@anim@poster=\@anim@mone\relax% |