summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl')
-rw-r--r--Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl47
1 files changed, 47 insertions, 0 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl b/Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl
new file mode 100644
index 00000000000..1a99c138a99
--- /dev/null
+++ b/Master/texmf-dist/metapost/context/base/mpxl/mp-figs.mpxl
@@ -0,0 +1,47 @@
+%D \module
+%D [ file=mp-figs.mpiv,
+%D version=2003.01.15,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=figures,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
+
+if known metafun_loaded_figs : endinput ; fi ;
+
+newinternal boolean metafun_loaded_figs ; metafun_loaded_figs := true ; immutable metafun_loaded_figs ;
+
+% todo: check defined
+
+def registerfigure(expr name,width,height) =
+ begingroup ;
+ save s ; string s ; s := cleanstring(name) ;
+ scantokens( s & "_width := " & decimal(width )) ;
+ scantokens( s & "_height := " & decimal(height)) ;
+ endgroup ;
+enddef ;
+
+vardef figuresize(expr name) =
+ save s, p ; string s ; pair p ;
+ s := cleanstring(name) ;
+ scantokens( "p := " & "(" & s & "_width" & "," & s & "_height" & ")" ) ;
+ p
+enddef ;
+
+vardef figurewidth(expr name) =
+ xpart figuresize(name)
+enddef ;
+
+vardef figureheight(expr name) =
+ ypart figuresize(name)
+enddef ;
+
+let figuredimensions = figuresize ; % for old times sake
+
+def naturalfigure(expr name) =
+ externalfigure name xyscaled(figuresize(name))
+enddef ;