MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Saving animation frames



Hi. In the example vbfe, in the mathlink distribution, this is the
solution that is used to save the graphics output to a temporary file,
and then to load the graphics in a picture control in the front end:

Display := OpenTemporary[];
            $DisplayFunction = (Module[{tmpstream = $Display, tmpfile},
   tmpfile = tmpstream[[1]];
     Close[tmpstream];
   Display[tmpfile, #1,  "Metafile"];
   LinkWrite[$ParentLink, DisplayEndPacket[tmpfile]]]; #1)

and then:

Case DISPLAYENDPKT
                out = get_text
                Form1!PSOut.Picture = LoadPicture(out)

in the main loop for testing mathlink packet types.

    What I need is to extend this method, so it works for animations
too.

I was thinking along  the following lines, but my knowledge of
mathematica programming is limited, so I need some help with the code:

Somehow, the DisplayFunction should know if it is called from a
Animate[], ShowAnim, and so on,   and instead of saving the output in
temporary file, it should use something like picture1.wmf, and wait
with sending the DisplayEndPacket. If still inside Animation call, a
counter should be increased and the next frame should be saved in
picture2.wmf and so on. On the first call to the DisplayFunction, that
is outside some animation expression, the DisplayEndPacket, can be
sent, with the name of the last filename used, and the counter for the
numbering of the filenames should be reset.

Then in VB, the number can be extracted from the filename, and array can
be constructed from all the frames saved from picture1.wmf to
pictureX.wmf.

So if someone knows how to code this in the body of the DisplayFunction,
please reply.


    Tnx,  Vlado Handziski





  • Prev by Date: Re: Cell bracket <-> Inline
  • Next by Date: Importing HTML files into MATHEMATICA
  • Prev by thread: Announcement of PYML (Python/Mathematica Interface)
  • Next by thread: Saving animation frames