From 56bd1f5b8377f54b4af39a114362a7762d27f13c Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 7 May 2020 03:01:09 +0000 Subject: CTAN sync 202005070301 --- macros/latex/contrib/animate/ChangeLog | 3 + macros/latex/contrib/animate/animate.pdf | Bin 3911070 -> 3887744 bytes macros/latex/contrib/animate/animate.sty | 217 ++++++++++++++++++++----------- macros/latex/contrib/animate/animate.tex | 9 +- 4 files changed, 147 insertions(+), 82 deletions(-) (limited to 'macros/latex/contrib/animate') diff --git a/macros/latex/contrib/animate/ChangeLog b/macros/latex/contrib/animate/ChangeLog index 66592c1bb6..b67e5692c8 100644 --- a/macros/latex/contrib/animate/ChangeLog +++ b/macros/latex/contrib/animate/ChangeLog @@ -1,3 +1,6 @@ +2020-05-06 + * fix: control button transparency (all drivers) + 2020-04-25 * fix: compilation error in case of `dvisvgm' + [french]{babel}. For slightly better performance, \animategraphics doesn't pass `clip' anymore diff --git a/macros/latex/contrib/animate/animate.pdf b/macros/latex/contrib/animate/animate.pdf index 75dad51500..bc969083f5 100644 Binary files a/macros/latex/contrib/animate/animate.pdf and b/macros/latex/contrib/animate/animate.pdf differ diff --git a/macros/latex/contrib/animate/animate.sty b/macros/latex/contrib/animate/animate.sty index b4e05000ab..eaf27e7440 100644 --- a/macros/latex/contrib/animate/animate.sty +++ b/macros/latex/contrib/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} -\def\@anim@version{2020/04/25} +\def\@anim@version{2020/05/06} \ProvidesPackage{animate} [\@anim@version\space PDF & SVG animations from files and inline graphics] @@ -618,7 +618,6 @@ %dvips .OR. dvisvgm %stroking commands \def\@anim@btnend{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -632,8 +631,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 +647,6 @@ stroke } \def\@anim@btnstep{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -661,8 +660,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 +672,6 @@ stroke } \def\@anim@btnplay{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -682,8 +681,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 +698,6 @@ stroke } \def\@anim@btnpause{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -708,8 +707,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 +719,6 @@ stroke } \def\@anim@btnminus{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -733,8 +732,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 +744,6 @@ stroke } \def\@anim@btnplus{% - \@anim@fg\space 0.5 setlinewidth 1 setlinecap 1 setlinejoin @@ -758,8 +757,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 +770,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 +795,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 +829,137 @@ \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 +967,10 @@ \fi% %distill box into XObject \@anim@xform{0}{1}{}{% - \ifx\empty\@anim@alpha\empty\else% - \if@anim@dvisvgm% - opacity='\@anim@alpha'% - \else% - /Group <>% - \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 +1001,7 @@ 0 j 100 47 m 100 103 l - S + S% } \def\@anim@btnstep{% 5 w @@ -963,7 +1024,7 @@ 55 47 m 96 75 l 55 103 l - S + S% } \def\@anim@btnplay{% 5 w @@ -987,7 +1048,7 @@ 50 40 m 50 110 l 100 75 l - s + s% } \def\@anim@btnpause{% 5 w @@ -1007,7 +1068,7 @@ 20 w 22 40 m 22 110 l - S + S% } \def\@anim@btnminus{% 5 w @@ -1030,7 +1091,7 @@ 0 J 47 75 m 103 75 l - S + S% } \def\@anim@btnplus{% 5 w @@ -1055,7 +1116,7 @@ 103 75 l 75 47 m 75 103 l - S + S% } \def\@anim@btnreset{% 5 w @@ -1079,6 +1140,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 +1155,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 +1238,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 <>% - \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 <>% + \ifx\@anim@Reset\@anim@arg% + /R2 <>% + \fi% >>% - /XObject <>% >>% - }{/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 +1584,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 @@ -1962,7 +2020,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 +2106,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 diff --git a/macros/latex/contrib/animate/animate.tex b/macros/latex/contrib/animate/animate.tex index 0249961249..bd9c37de1e 100644 --- a/macros/latex/contrib/animate/animate.tex +++ b/macros/latex/contrib/animate/animate.tex @@ -112,7 +112,7 @@ \section{Introduction} This package provides an interface for creating PDF and SVG files with animated content from sets of graphics or image files, from inline graphics, such as \LaTeX-picture, PSTricks or pgf/TikZ generated pictures, or just from typeset text. Unlike standard movie/video formats, package `animate' allows for animating vector graphics. The result is roughly similar to the SWF (Flash) format, although not as space-efficient. -Package `animate' supports the usual workflows for making PDF, i.\,e. pdf\LaTeX{}, Lua\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+. For animated SVG, it supports the \verb+dvisvgm+ driver. The DVI/XDV used as input for \verb+dvisvgm+ can be generated with \LaTeX{}, Lua\LaTeX{} (in DVI mode with command `\verb+dvilualatex+') and \XeLaTeX{} (with option `\verb+--no-pdf+'). +Package `animate' supports the usual workflows for making PDF, i.\,e. pdf\LaTeX{}, Lua\-\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+. For animated SVG, it supports the \verb+dvisvgm+ driver. The DVI/XDV used as input for \verb+dvisvgm+ can be generated with \LaTeX{}, Lua\LaTeX{} (in DVI mode with command `\verb+dvilualatex+') and \XeLaTeX{} (with option `\verb+--no-pdf+'). PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), PDF-XChange and Foxit Reader. @@ -1377,8 +1377,11 @@ dvilualatex xelatex -no-pdf \end{verbatim} to produce DVI or XDV output from the \LaTeX{} source. After this, SVG is obtained by running +%\begin{verbatim} +%dvisvgm --font-format=woff --exact --zoom=-1 --page=1,- --optimize ... +%\end{verbatim} \begin{verbatim} -dvisvgm --font-format=woff --exact --zoom=-1 --page=1,- --optimize ... +dvisvgm --font-format=woff --exact --zoom=-1 --page=1,- ... \end{verbatim} on the intermediate DVI or XDV file. @@ -1390,7 +1393,7 @@ The purpose of `\verb+--zoom=-1+' is to produce responsive SVG. If embedded in a By default, \verb+dvisvgm+ processes only the very first page of the input file. To convert multipage DVI/XDV with several animations, add option `\verb+--page=1,-+'. -With option `\verb+--optimize+', \verb+dvisvgm+ applies several optimizations to reduce the output file size. +%With option `\verb+--optimize+', \verb+dvisvgm+ applies several optimizations to reduce the output file size. As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'. Also, option `\verb+--precision=1+' may be used to reduce the SVG file size. It limits the precision of floating point numbers, such as coordinates, to one decimal figure. Sometimes, animations may behave stangely after applying this option. Then, of course, it should be omitted. -- cgit v1.2.3