diff options
author | Norbert Preining <preining@logic.at> | 2007-11-23 19:43:31 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-23 19:43:31 +0000 |
commit | 103fa01eacdf470af9d47acbbd0f8cd3add32dcf (patch) | |
tree | 33942937250861aee01dd534c1ca79669cfa726c /Master/texmf-dist/tex/latex/animate | |
parent | fb0a76e55e2bbb6ff31506cdb4fd9e3f63b9f665 (diff) |
animate update 07-11-23
git-svn-id: svn://tug.org/texlive/trunk@5570 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r-- | Master/texmf-dist/tex/latex/animate/animate.sty | 156 |
1 files changed, 122 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index 28ae8abb784..209611cebf2 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -13,7 +13,7 @@ % Supports LaTeX->dvips->ps2pdf or pdfLaTeX workflows. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{animate}[2007/11/12] +\ProvidesPackage{animate}[2007/11/23] \RequirePackage{keyval} \RequirePackage{ifthen} \RequirePackage{ifpdf} @@ -59,7 +59,7 @@ \ifpdf \ifnum\pdftexversion<120 \PackageError{animate}{% - pdfeTeX, version >= 1.20, required% + pdfTeX, version >= 1.20, required% }{% Install a newer version!% }% @@ -75,7 +75,11 @@ %creating and using global definitions \def\@anim@newkey#1#2{{\expandafter\xdef\csname#1\endcsname{#2}}} -\def\@anim@getkeyval#1{\csname#1\endcsname} +\def\@anim@getkeyval#1{% + \expandafter\ifx\csname#1\endcsname\relax\else% + \csname#1\endcsname% + \fi% +} %missing package error message \def\@anim@missing#1{% @@ -200,7 +204,7 @@ \immediate\pdfxform\@anim@box% \xdef\@anim@lastxform{\the\pdflastxform}% \if@anim@timeline% - %keep record of XObject number + %keep a record of XObject number \@anim@newkey{img@#2}{\@anim@lastxform\space 0 R}% \else% \xdef\@anim@xobject{%XObject resource entry of container XObject @@ -427,7 +431,7 @@ } \fi -%create container XObjects for play & pause button faces; +%create container XObjects for play & pause button faces \ifpdf \def\@anim@makeppcontainer#1#2#3{% #1: @anim@num, #2: Right or Left, % #3: index of existing button face colour combination @@ -1557,7 +1561,7 @@ %prints zero padded integers % #1: arbitrary integer number as template specifying the % width, e. g. `987654' for a width of 6 digits -% #2: the number to be formatted (zero padded) +% #2: the number to be formatted \def\@anim@pad#1#2{% \@anim@@pad{\@anim@template{0}{#1}}{#2}% } @@ -1584,6 +1588,9 @@ %building timeline from timeline file \newread\@anim@@tmlnfile \newboolean{@anim@eof} +\newcount\@anim@tmpcnt %scratch counter for different uses +\newcount\@anim@curlayer %takes the number of the current layer being processed + \def\@anim@buildtmln#1{% #1:@anim@num \endlinechar=-1% suppress trailing space at input line end \global\@anim@curframe@zb=0% @@ -1609,9 +1616,10 @@ \setboolean{@anim@eof}{false}\fi% }% \closein\@anim@@tmlnfile% - \xdef\@anim@transp{\@anim@frames}% total number of transp + \xdef\@anim@transp{\@anim@frames}% total number of transparencies \xdef\@anim@frames{\the\@anim@curframe@zb}%total number of actual frames \global\@anim@curframe@zb=0% + \gdef\@anim@maxlayer{0}% highest layer index %reopen timeline file and build timeline \openin\@anim@@tmlnfile=\@anim@tmlnfile% \read\@anim@@tmlnfile to \@anim@inputline% @@ -1621,8 +1629,25 @@ \setboolean{@anim@eof}{false}\fi% \whiledo{\NOT\boolean{@anim@eof}}{% \ifthenelse{\equal{\@anim@inputline}{}}{}{% - \expandafter\@anim@parseline\@anim@inputline;% + %process input line + \expandafter\@anim@parseline\@anim@inputline\@nil% + %combine the layers of the current frame + \@anim@curlayer=0% + \loop\ifnum\@anim@curlayer>\@anim@maxlayer\else% + \@anim@newkey{frmcontent@\the\@anim@curframe@zb}{% + \@anim@getkeyval{frmcontent@\the\@anim@curframe@zb}% + \@anim@getkeyval{% + layercontent@\the\@anim@curframe@zb.\the\@anim@curlayer}% + }% + \@anim@newkey{% + layercontent@\the\@anim@curframe@zb.\the\@anim@curlayer}{}% + \advance\@anim@curlayer by \@ne% + \repeat% + %build frame xobject \@anim@makeframe{#1}{\the\@anim@curframe@zb}% + %clean-up + \edef\@anim@usedlist{\@anim@getkeyval{usedin@\the\@anim@curframe@zb}}% + \expandafter\@anim@resetusedlist\@anim@usedlist,:\@nil% \@anim@newkey{frmxobject@\the\@anim@curframe@zb}{}% \@anim@newkey{frmcontent@\the\@anim@curframe@zb}{}% \global\advance\@anim@curframe@zb by \@ne% @@ -1637,9 +1662,9 @@ } %reads one line of timeline file and splits into its colon separated parts -\def\@anim@parseline#1:#2:#3;{% +\def\@anim@parseline#1:#2:#3\@nil{% \if@anim@step\else% - \ifthenelse{\equal{#1}{*}}{%first column is a star (pause frame) + \ifthenelse{\equal{#1}{*}}{%first field is a star (pause frame) \xdef\@anim@pauseat{% \@anim@pauseat% a\the\@anim@num.pauseAt[\the\@anim@curframe@zb]=1;% @@ -1667,25 +1692,38 @@ \setboolean{@anim@chfps}{true}% change fps \fi% \fi% - %parse the third column - \@anim@parsethird#3,:;% + %parse the third field (list of layer specifications) + \global\@anim@curlayer=0 + \@anim@parsethird#3;:\@nil% } -%parses 3rd column of timeline file (comma separated list of transp. specs) -\def\@anim@parsethird#1,#2;{% - \ifthenelse{\equal{#1}{}}{}{\@anim@process#1x:;}%process one transparency spec - \ifthenelse{\equal{#2}{:}}{}{\@anim@parsethird#2;}% +%parses frame contents specification (semicolon separated list of layer +%specifications) +\def\@anim@parsethird#1;#2\@nil{% + \ifthenelse{\equal{#1}{}}{}{\@anim@parselayer#1,:\@nil}%process one layer spec + \ifthenelse{\equal{#2}{:}}{}{% + \global\advance\@anim@curlayer by \@ne% + \ifnum\@anim@curlayer>\@anim@maxlayer + \xdef\@anim@maxlayer{\the\@anim@curlayer}% + \fi% + \@anim@parsethird#2\@nil% + }% } -\newcount\@anim@tmpcnt %scratch counter for different uses +%parses contents of one layer specification (comma separated list of transp. +%specs) +\def\@anim@parselayer#1,#2\@nil{% + \ifthenelse{\equal{#1}{}}{}{\@anim@process#1x:\@nil}%process one transp spec + \ifthenelse{\equal{#2}{:}}{}{\@anim@parselayer#2\@nil}% +} %process transparency spec, such as 123 or 456x78 or 9x0 -\def\@anim@process#1x#2;{% +\def\@anim@process#1x#2\@nil{% %determine number of repetitions of current transparency \ifthenelse{\equal{#2}{:}}{% \gdef\@anim@repeats{1}% }{% - \@anim@processsecond#2;% + \@anim@getrepetitions#2\@nil% }% \ifnum\@anim@repeats=0 %0= means: repeat until end of timeline \edef\@anim@repeatuntil{\@anim@frames}% @@ -1698,18 +1736,57 @@ \edef\@anim@repeatuntil{\the\@anim@tmpcnt}% \fi% \fi% - %build contents and xobject resource list of animation frames according to - %transparency specifications + %build contents of animation layer and update frame xobject resource list + %according to transparency specifications \ifnum\@anim@transp<#1\else%ignore non-existing transparencies \ifnum\@anim@transp=#1\else% \@anim@tmpcnt=\@anim@curframe@zb% \loop\ifnum\@anim@repeatuntil>\@anim@tmpcnt - \@anim@newkey{frmxobject@\the\@anim@tmpcnt}{% - \@anim@getkeyval{frmxobject@\the\@anim@tmpcnt}\space% - /im#1\space\@anim@getkeyval{img@#1}% - }% - \@anim@newkey{frmcontent@\the\@anim@tmpcnt}{% - \@anim@getkeyval{frmcontent@\the\@anim@tmpcnt} q /im#1\space Do Q% + %detect multiple inclusion of the same transparency in the + %current frame + \expandafter\ifx\csname used@#1@\the\@anim@tmpcnt\endcsname\relax% + %append transparency to ressource list + \@anim@newkey{frmxobject@\the\@anim@tmpcnt}{% + \@anim@getkeyval{frmxobject@\the\@anim@tmpcnt}\space% + /im#1\space\@anim@getkeyval{img@#1}% + }% + %mark current transparency as used within the current frame + \@anim@newkey{used@#1@\the\@anim@tmpcnt}{}% + %append it to the list of transparencies used in current frame + \@anim@newkey{usedin@\the\@anim@tmpcnt}{% + \@anim@getkeyval{usedin@\the\@anim@tmpcnt}#1,}% + \else% + \PackageWarning{animate}{% + Transparency #1 multiply included in frame \the\@anim@tmpcnt.% + \MessageBreak% + File \jobname.tex% + }% + \ifx\@anim@warned\@undefined% + \AtEndDocument{% + \PackageWarningNoLine{animate}{% + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% + \MessageBreak% + @ In certain animation frames, transparencies were% + \space\space @\MessageBreak% + @ multiply included. This may considerably slow\space% + \space\space\space\space @\MessageBreak% + @ down animation speed. Revise the timeline file of\space @% + \MessageBreak% + @ the corresponding animations! See the transcript\space% + \space @\MessageBreak% + @ file \jobname.log\MessageBreak% + @ for additional information!\space\space\space\space\space% + \space\space\space\space\space\space\space\space\space\space% + \space\space\space\space\space\space\space\space @\MessageBreak% + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% + }% + }% + \gdef\@anim@warned{}% + \fi% + \fi% + \@anim@newkey{layercontent@\the\@anim@tmpcnt.\the\@anim@curlayer}{% + \@anim@getkeyval{layercontent@\the\@anim@tmpcnt.\the\@anim@curlayer} + q /im#1\space Do Q% }% \advance\@anim@tmpcnt by \@ne% \repeat% @@ -1717,8 +1794,19 @@ \fi% } +%reset embedded transparency list +\def\@anim@resetusedlist#1,#2\@nil{% + \ifthenelse{\equal{#1}{}}{}{% + \expandafter\global\expandafter\let\csname + used@#1@\the\@anim@curframe@zb\endcsname\@undefined% + }% + \ifthenelse{\equal{#2}{:}}{% + \@anim@newkey{usedin@\the\@anim@curframe@zb}{}% + }{\@anim@resetusedlist#2\@nil}% +} + %get number of repetitions of frame -\def\@anim@processsecond#1x:;{% +\def\@anim@getrepetitions#1x:\@nil{% \gdef\@anim@repeats{#1}% } @@ -1742,11 +1830,11 @@ \define@key{anim@user}{buttonsize}{% \gdef\@anim@btnsize{#1}% } -\def\@anim@colours#1:#2;{% helper macro to get number of colour components and +\def\@anim@colours#1:#2\@nil{% helper macro to get number of colour components and \xdef\@anim@colour{\@anim@colour\space #1}% to replace : by ` ' in the arg \ifthenelse{\equal{#2}{!}}{}{% \global\advance\@anim@tmpcnt by \@ne% - \@anim@colours#2;% + \@anim@colours#2\@nil% }% } \ifpdf %background frame of buttons @@ -1769,7 +1857,7 @@ \define@key{anim@user}{buttonbg}{%background colour of buttons \global\@anim@tmpcnt=\@ne% \gdef\@anim@colour{}% - \@anim@colours#1:!;% + \@anim@colours#1:!\@nil% \xdef\@anim@bgcolour{\@anim@colour}% \ifpdf% \ifnum\@anim@tmpcnt=\@ne @@ -1800,7 +1888,7 @@ \define@key{anim@user}{buttonfg}{%stroking colour of buttons \global\@anim@tmpcnt=\@ne% \gdef\@anim@colour{}% - \@anim@colours#1:!;% + \@anim@colours#1:!\@nil% \xdef\@anim@fgcolour{\@anim@colour}% \ifpdf% \ifthenelse{\the\@anim@tmpcnt=\@ne}{% @@ -1957,7 +2045,7 @@ \define@key{anim@pkg}{buttonbg}{%background colour of buttons \global\@anim@tmpcnt=\@ne% \gdef\@anim@colour{}% - \@anim@colours#1:!;% + \@anim@colours#1:!\@nil% \xdef\@anim@@bgcolour{\@anim@colour}% \ifpdf% \ifnum\@anim@tmpcnt=\@ne @@ -1990,7 +2078,7 @@ \define@key{anim@pkg}{buttonfg}{%stroking colour of buttons \global\@anim@tmpcnt=\@ne% \gdef\@anim@colour{}% - \@anim@colours#1:!;% + \@anim@colours#1:!\@nil% \xdef\@anim@@fgcolour{\@anim@colour}% \ifpdf% \ifthenelse{\the\@anim@tmpcnt=\@ne}{% |