summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-11-16 10:48:02 +0000
committerNorbert Preining <preining@logic.at>2007-11-16 10:48:02 +0000
commit1d94bb0c3a2cd2e5df114394eda1d998ef264585 (patch)
tree249a682c72cf65f6c34429b5d4c28e3f3d007cdb /Master/texmf-dist/tex/latex/animate
parentf5fd3fed4e77eb3ba97c4405d64beb24abbfed5d (diff)
update animate 2007/11/12 from ctan
git-svn-id: svn://tug.org/texlive/trunk@5444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty152
1 files changed, 102 insertions, 50 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 19d52b55ee6..28ae8abb784 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/10/23]
+\ProvidesPackage{animate}[2007/11/12]
\RequirePackage{keyval}
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
@@ -98,8 +98,8 @@
\@anim@@posterocgs=\pdflastobj
\pdfcatalog{
/OCProperties <<
- /OCGs \the\@anim@@ocgs\space 0 R
- /D <</BaseState/OFF /ON \the\@anim@@posterocgs\space 0 R
+ /OCGs \the\@anim@@ocgs\space 0 R
+ /D <</BaseState/OFF /ON \the\@anim@@posterocgs\space 0 R
/Order \the\@anim@@ocgs\space 0 R>>
>>
}
@@ -179,8 +179,7 @@
\newboolean{@anim@timeline} %true if `timeline' option was set
-%creates Form XObject from box contents and associates it with a newly
-%created OCG
+%creates Form XObject from box contents
\ifpdf%
%#1: @anim@num, #2:@anim@curframe@zb, #3: empty (`') or box number,
%#4: `!' or form xobj identifier
@@ -200,15 +199,28 @@
}%
\immediate\pdfxform\@anim@box%
\xdef\@anim@lastxform{\the\pdflastxform}%
- \xdef\@anim@xobject{%XObject resource entry of container XObject
- \@anim@xobject\space/im#2\space\@anim@lastxform\space 0 R%
- }%
+ \if@anim@timeline%
+ %keep record of XObject number
+ \@anim@newkey{img@#2}{\@anim@lastxform\space 0 R}%
+ \else%
+ \xdef\@anim@xobject{%XObject resource entry of container XObject
+ \@anim@xobject\space/im#2\space\@anim@lastxform\space 0 R%
+ }%
+ \fi%
}{%
- \xdef\@anim@xobject{\@anim@xobject\space/im#2\space #4\space 0 R}%
+ \if@anim@timeline%
+ \@anim@newkey{img@#2}{#4\space 0 R}%
+ \else%
+ \xdef\@anim@xobject{\@anim@xobject\space/im#2\space #4\space 0 R}%
+ \fi%
}%
\if@anim@timeline\else%
- \@anim@newocg{#1}{#2}%new ocg
- %compose content stream of container XObject
+ \@anim@newocg{#1}{#2}%
+ %Properties entry for use in container XObject
+ \xdef\@anim@properties{%
+ \@anim@properties\space/oc#2\space\@anim@curocg%
+ }%
+ %content stream of container XObject
\xdef\@anim@content{%
\@anim@content\space /OC/oc#2\space BDC q /im#2\space Do Q EMC%
}%
@@ -257,10 +269,9 @@
/frame@dydx {1 frame@dxdy div} bind def
/frame@cx {frame@urx frame@llx add 2 div} bind def
/frame@cy {frame@ury frame@lly add 2 div} bind def
- [% graphics needs to be rescaled for some reason ...
- frame@dxdy 0 0 frame@dydx 1 frame@dxdy sub frame@cx mul
- 1 frame@dydx sub frame@cy mul%
- ] concat
+ % graphics needs to be rescaled for some reason ...
+ [frame@dxdy 0 0 frame@dydx 1 frame@dxdy sub frame@cx mul
+ 1 frame@dydx sub frame@cy mul] concat
%... rotated by 270 degrees ...
[0 -1 1 0 frame@cx frame@cy sub frame@cx frame@cy add] concat
%... and flipped around vertical axis
@@ -278,17 +289,29 @@
grestore
}%
\xdef\@anim@lastxform{@anim@frm@#1@#2}%
- \xdef\@anim@xobject{% XObject resource entry of container XObject
- \@anim@xobject\space/im#2\space {@anim@frm@#1@#2}%
- }%
+ \if@anim@timeline%
+ \@anim@newkey{img@#2}{{@anim@frm@#1@#2}}%
+ \else%
+ \xdef\@anim@xobject{% XObject resource entry of container XObject
+ \@anim@xobject\space/im#2\space {@anim@frm@#1@#2}%
+ }%
+ \fi%
}{%
- \xdef\@anim@xobject{% XObject resource entry of container XObject
- \@anim@xobject\space/im#2\space {#4}%
- }%
+ \if@anim@timeline%
+ \@anim@newkey{img@#2}{{#4}}%
+ \else%
+ \xdef\@anim@xobject{% XObject resource entry of container XObject
+ \@anim@xobject\space/im#2\space {#4}%
+ }%
+ \fi%
}%
\if@anim@timeline\else%
- \@anim@newocg{#1}{#2}% new ocg
- %compose content stream of container XObject
+ \@anim@newocg{#1}{#2}%
+ %Properties entry for use in container XObject
+ \xdef\@anim@properties{%
+ \@anim@properties\space/oc#2\space {@anim@ocg@#1@#2}%
+ }%
+ %content stream of container XObject
\xdef\@anim@content{%
\@anim@content\space /OC/oc#2\space BDC q /im#2\space Do Q EMC%
}%
@@ -296,7 +319,7 @@
}
\fi
-%creates OCG and builds Properties entry for use in container XObject
+%creates OCG
\ifpdf
\def\@anim@newocg#1#2{%#1:@anim@num, #2:@anim@curframe@zb
\immediate\pdfobj{<</Type/OCG /Name (#1.#2)>>}% new ocg
@@ -312,10 +335,6 @@
\ifx\@anim@poster\@anim@posterframe%
\xdef\@anim@posterocg{\@anim@curocg}%
\fi%
- %compose Properties entry for use in container XObject
- \xdef\@anim@properties{%
- \@anim@properties\space/oc#2\space\@anim@curocg%
- }%
}
\else
\def\@anim@newocg#1#2{%#1:@anim@num, #2:@anim@curframe@zb
@@ -334,9 +353,6 @@
\ifx\@anim@poster\@anim@posterframe%
\xdef\@anim@posterocg{@anim@ocg@#1@#2}%
\fi%
- \xdef\@anim@properties{%
- \@anim@properties\space/oc#2\space {@anim@ocg@#1@#2}%
- }%
}
\fi
@@ -351,8 +367,8 @@
\pdfliteral{Q\@anim@content}%
}%
\immediate\pdfxform resources {%
- /Properties <<\@anim@properties>>
- /XObject <<\@anim@xobject>>
+ \if@anim@timeline\else/Properties <<\@anim@properties>>\fi
+ /XObject <<\@anim@xobject>>
}\@anim@box%
\xdef\@anim@container{\the\pdflastxform\space 0 R}%
}
@@ -365,7 +381,7 @@
/Type/XObject/Subtype/Form/FormType 1
/BBox [frame@llx frame@lly frame@urx frame@ury]
/Resources <<
- /Properties <<\@anim@properties>>
+ \if@anim@timeline\else/Properties <<\@anim@properties>>\fi
/XObject <<\@anim@xobject>>
>>
>> /PUT pdfmark
@@ -373,6 +389,44 @@
}
\fi
+%intermediate container XObject, for use with the timeline option, which
+%represents one animation frame and which contains all the transparencies
+%that compose the frame
+\ifpdf
+ \def\@anim@makeframe#1#2{% #1:@anim@num, #2:@anim@curframe@zb
+ \@anim@newocg{#1}{#2}%
+ \setlength{\unitlength}{1pt}%
+ \global\setbox\@anim@box=\hbox{%
+ \pdfliteral{q}%
+ \begin{picture}(\@anim@animwidth,\@anim@animtotalheight)%
+ \end{picture}%
+ \pdfliteral{Q\@anim@getkeyval{frmcontent@#2}}%
+ }%
+ \immediate\pdfxform attr {/OC\space\@anim@curocg} resources {%
+ /XObject <<\@anim@getkeyval{frmxobject@#2}>>}\@anim@box%
+ \xdef\@anim@xobject{\@anim@xobject\space /fr#2\space%
+ \the\pdflastxform\space 0 R}%
+ \xdef\@anim@content{\@anim@content\space q /fr#2\space Do Q}%
+ }
+\else
+ \def\@anim@makeframe#1#2{%
+ \@anim@newocg{#1}{#2}%
+ \special{ps:
+ mark /_objdef {@anim@anmfrm@#1@#2} /type/stream /OBJ pdfmark
+ mark {@anim@anmfrm@#1@#2} (\@anim@getkeyval{frmcontent@#2}) /PUT
+ pdfmark
+ mark {@anim@anmfrm@#1@#2} <<
+ /Type/XObject/Subtype/Form/FormType 1
+ /BBox [frame@llx frame@lly frame@urx frame@ury]
+ /OC {@anim@ocg@#1@#2}
+ /Resources <</XObject <<\@anim@getkeyval{frmxobject@#2}>>>>
+ >> /PUT pdfmark
+ }%
+ \xdef\@anim@xobject{\@anim@xobject\space /fr#2\space {@anim@anmfrm@#1@#2}}%
+ \xdef\@anim@content{\@anim@content\space q /fr#2\space Do Q}%
+ }
+\fi
+
%create container XObjects for play & pause button faces;
\ifpdf
\def\@anim@makeppcontainer#1#2#3{% #1: @anim@num, #2: Right or Left,
@@ -1543,8 +1597,9 @@
\setboolean{@anim@eof}{false}\fi%
\whiledo{\NOT\boolean{@anim@eof}}{%
\ifthenelse{\equal{\@anim@inputline}{}}{}{%
- %initialise contents of each frame (to be filled with refs to XObjects
- \@anim@newkey{@anim@content@\the\@anim@curframe@zb}{}% to be drawn)
+ %initialise contents and resource list of each frame
+ \@anim@newkey{frmxobject@\the\@anim@curframe@zb}{}%
+ \@anim@newkey{frmcontent@\the\@anim@curframe@zb}{}%
\global\advance\@anim@curframe@zb by \@ne%
}%
\read\@anim@@tmlnfile to \@anim@inputline%
@@ -1567,15 +1622,9 @@
\whiledo{\NOT\boolean{@anim@eof}}{%
\ifthenelse{\equal{\@anim@inputline}{}}{}{%
\expandafter\@anim@parseline\@anim@inputline;%
- %create OCG and compose Properties entry
- \@anim@newocg{#1}{\the\@anim@curframe@zb}%
- %compose content stream of container XObject
- \xdef\@anim@content{%
- \@anim@content\space%
- /OC/oc\the\@anim@curframe@zb\space%
- BDC\@anim@getkeyval{@anim@content@\the\@anim@curframe@zb} EMC%
- }%
- \@anim@newkey{@anim@content@\the\@anim@curframe@zb}{}%
+ \@anim@makeframe{#1}{\the\@anim@curframe@zb}%
+ \@anim@newkey{frmxobject@\the\@anim@curframe@zb}{}%
+ \@anim@newkey{frmcontent@\the\@anim@curframe@zb}{}%
\global\advance\@anim@curframe@zb by \@ne%
}%
\read\@anim@@tmlnfile to \@anim@inputline%
@@ -1624,7 +1673,6 @@
%parses 3rd column of timeline file (comma separated list of transp. specs)
\def\@anim@parsethird#1,#2;{%
- \def\@anim@firstarg{#1}%
\ifthenelse{\equal{#1}{}}{}{\@anim@process#1x:;}%process one transparency spec
\ifthenelse{\equal{#2}{:}}{}{\@anim@parsethird#2;}%
}
@@ -1650,14 +1698,18 @@
\edef\@anim@repeatuntil{\the\@anim@tmpcnt}%
\fi%
\fi%
- %build contents of animation frames according to transparency specifications
+ %build contents and xobject resource list of animation frames 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{@anim@content@\the\@anim@tmpcnt}{%
- \@anim@getkeyval{@anim@content@\the\@anim@tmpcnt}
- q /im#1\space Do Q%
+ \@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%
}%
\advance\@anim@tmpcnt by \@ne%
\repeat%