diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-08 01:04:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-08 01:04:41 +0000 |
commit | efda44c2e2e6bd08bf58ebdfb2f1879cff9e6f37 (patch) | |
tree | 105b5092688d84851b40816150f4a5c77df3ed08 /Master/texmf/asymptote/plain_shipout.asy | |
parent | 9e32dd6aee7faf4e59888cfbd7a927d497b563ad (diff) |
first commit of asymptote binaries + support
git-svn-id: svn://tug.org/texlive/trunk@13665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/asymptote/plain_shipout.asy')
-rw-r--r-- | Master/texmf/asymptote/plain_shipout.asy | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/Master/texmf/asymptote/plain_shipout.asy b/Master/texmf/asymptote/plain_shipout.asy new file mode 100644 index 00000000000..22aeef7121f --- /dev/null +++ b/Master/texmf/asymptote/plain_shipout.asy @@ -0,0 +1,113 @@ +// Default file prefix used for inline LaTeX mode +string defaultfilename; + +string outprefix(string prefix=defaultfilename) { + string s=prefix != "" ? prefix : + (settings.outname == "" && interactive()) ? "out" : settings.outname; + return stripextension(s); +} + +string outformat(string format="") +{ + if(format == "") format=settings.outformat; + if(format == "") format=nativeformat(); + return format; +} + + +bool shipped; // Was a picture or frame already shipped out? + +frame currentpatterns; + +frame Portrait(frame f) {return f;}; +frame Landscape(frame f) {return rotate(90)*f;}; +frame UpsideDown(frame f) {return rotate(180)*f;}; +frame Seascape(frame f) {return rotate(-90)*f;}; +typedef frame orientation(frame); +orientation orientation=Portrait; + +// Forward references to functions defined in module three. +object embed3(string, frame, string, string, string, projection); +string Embed(string name, string options="", real width=0, real height=0); +string Link(string label, string text, string options=""); + +bool prc0(string format="") +{ + return settings.prc && (outformat(format) == "pdf" || settings.inlineimage); +} + +bool prc(string format="") { + return prc0(format) && Embed != null; +} + +bool is3D(string format="") +{ + return prc(format) || settings.render != 0; +} + +frame enclose(string prefix=defaultfilename, object F, string format="") +{ + if(prc(format)) { + frame f; + label(f,F.L); + return f; + } return F.f; +} + +include plain_xasy; + +void shipout(string prefix=defaultfilename, frame f, + string format="", bool wait=false, bool view=true, + string options="", string script="", + projection P=currentprojection) +{ + if(is3D(f)) { + f=enclose(prefix,embed3(prefix,f,format,options,script,P)); + if(settings.render != 0 && !prc(format)) { + shipped=true; + return; + } + } + + if(inXasyMode) { + erase(); + add(f,group=false); + return; + } + + // Applications like LaTeX cannot handle large PostScript coordinates. + pair m=min(f); + int limit=2000; + if(abs(m.x) > limit || abs(m.y) > limit) f=shift(-m)*f; + + shipout(prefix,f,currentpatterns,format,wait,view,xformStack.pop0); + shipped=true; +} + +void shipout(string prefix=defaultfilename, picture pic=currentpicture, + orientation orientation=orientation, + string format="", bool wait=false, bool view=true, + string options="", string script="", + projection P=currentprojection) +{ + if(!uptodate()) { + bool inlinetex=settings.inlinetex; + bool prc=prc(format); + if(prc && !pic.empty3()) + settings.inlinetex=settings.inlineimage; + frame f=pic.fit(prefix,format,view=view,options,script,P); + if(!pic.empty2() || settings.render == 0 || prc) + shipout(prefix,orientation(f),format,wait,view); + settings.inlinetex=inlinetex; + } + + pic.uptodate=true; + shipped=true; +} + +void newpage(picture pic=currentpicture) +{ + pic.add(new void(frame f, transform) { + newpage(f); + },true); +} |