From d167e9ccebdae0d0081d3c8abd95a440d96a867c Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 11 Aug 2019 20:47:52 +0200 Subject: 2019-08-11 20:11:00 --- metapost/context/base/mpiv/minifun.mpxl | 2 +- metapost/context/base/mpiv/mp-lmtx.mpxl | 102 +++++++++++++++++++++++--------- metapost/context/base/mpiv/mp-luas.mpxl | 2 + 3 files changed, 76 insertions(+), 30 deletions(-) (limited to 'metapost/context/base') diff --git a/metapost/context/base/mpiv/minifun.mpxl b/metapost/context/base/mpiv/minifun.mpxl index ec5cb364c..6769d26e4 100644 --- a/metapost/context/base/mpiv/minifun.mpxl +++ b/metapost/context/base/mpiv/minifun.mpxl @@ -24,7 +24,7 @@ input "mp-tool.mpiv" ; input "mp-mlib.mpiv" ; input "mp-luas.mpxl" ; input "mp-math.mpxl" ; -input "mp-cont.mpiv" ; +input "mp-cont.mpxl" ; input "mp-page.mpiv" ; string minifunversion ; minifunversion = "minifun xl " & mfun_timestamp; diff --git a/metapost/context/base/mpiv/mp-lmtx.mpxl b/metapost/context/base/mpiv/mp-lmtx.mpxl index 070440916..02d04afbb 100644 --- a/metapost/context/base/mpiv/mp-lmtx.mpxl +++ b/metapost/context/base/mpiv/mp-lmtx.mpxl @@ -537,35 +537,77 @@ def lmt_connection expr t = -- t enddef ; -% also - -presetparameters "path" [ - labels = false, - controls = false, - points = false, - path = origin -] ; - -def lmt_path = applyparameters "path" "lmt_do_path" enddef ; - -vardef lmt_do_path = - image ( - pushparameters "path" ; - save p ; path p ; p := getparameter "path" ; - drawpath p ; - if getparameter "points" : - drawpoints p ; - if getparameter "labels" : - drawpointlabels p ; - fi ; - fi ; - if getparameter "controls" : - drawcontrolpoints p ; - drawcontrollines p ; - fi ; - popparameters ; - ) -enddef ; +% also (todo) + +% % draw lmt_path [ +% % points = [ color = "darkred", size = 6 ], +% % controls = [ color = "darkgreen", size = 4 ], +% % lines = [ color = "darkgray", size = 1 ], +% % shape = [ color = "middlegray", size = 8 ], +% % labels = [ ], +% % path = ((1cm,1cm) -- (1.5cm,1.5cm) .. (2cm,0cm) .. cycle) +% % ] ; +% +% presetparameters "path" [ +% labels = [ +% color = "", +% size = 1 +% ], +% controls = [ +% color = "black", +% size = 2.5 +% ], +% lines = [ +% color = "middlegray", +% size = 1 +% ], +% points = [ +% color = "black", +% size = 4 +% ], +% path = [ +% color = "lightgray", +% size = 5, +% path = origin +% ] +% ] ; +% +% def lmt_path = applyparameters "path" "lmt_do_path" enddef ; +% +% vardef lmt_do_path = +% image ( +% % This one is not that efficient ... we can better inline the drawing routines here, but +% % it's just an interfacing test after all. +% if hasparameter "path" "path" : +% save p ; path p ; p := getparameter "path" "path" ; +% drawpath p +% withpen pencircle scaled (drawoptionsfactor * getparameterdefault "path" "shape" "size" "*") +% withcolor getparameterdefault "path" "shape" "color" "*" +% ; +% if hasparameter "path" "controls" : +% drawcontrollines p +% withpen pencircle scaled (drawoptionsfactor * getparameterdefault "path" "lines" "size" "*" ) +% withcolor getparameterdefault "path" "lines" "color" "*" +% ; +% drawcontrolpoints p +% withpen pencircle scaled (drawoptionsfactor * getparameterdefault "path" "controls" "size" "*") +% withcolor getparameterdefault "path" "controls" "color" "*" +% ; +% fi ; +% if hasparameter "path" "points" : +% drawpoints p +% withpen pencircle scaled (drawoptionsfactor * getparameterdefault "path" "points" "size" "*") +% withcolor getparameterdefault "path" "points" "color" "*" +% ; +% if hasparameter "path" "labels" : +% drawpointlabels p +% withcolor getparameterdefault "path" "labels" "color" "*" +% ; +% fi ; +% fi ; +% fi ; +% ) +% enddef ; % more @@ -789,12 +831,14 @@ vardef lmt_do_function = option := getparameter "xcaption" ; if (option <> "") : draw textext.bot(option) transformed tt + shifted (0,-tl) shifted center bottomboundary currentpicture ; fi ; option := getparameter "ycaption" ; if (option <> "") : draw textext.lft(option) transformed tt + shifted (-tl,0) shifted center leftboundary currentpicture ; fi ; ) diff --git a/metapost/context/base/mpiv/mp-luas.mpxl b/metapost/context/base/mpiv/mp-luas.mpxl index 1396a1f52..0fcac55e6 100644 --- a/metapost/context/base/mpiv/mp-luas.mpxl +++ b/metapost/context/base/mpiv/mp-luas.mpxl @@ -202,6 +202,7 @@ vardef utfsub(expr s,f,t) = lua.mp.utfsub(s,f,t) enddef ; newinternal mfid_getparameters ; mfid_getparameters := scriptindex "getparameters" ; newinternal mfid_presetparameters ; mfid_presetparameters := scriptindex "presetparameters" ; +newinternal mfid_hasparameter ; mfid_hasparameter := scriptindex "hasparameter" ; newinternal mfid_getparameter ; mfid_getparameter := scriptindex "getparameter" ; newinternal mfid_getparameterdefault ; mfid_getparameterdefault := scriptindex "getparameterdefault" ; newinternal mfid_getparametercount ; mfid_getparametercount := scriptindex "getparametercount" ; @@ -214,6 +215,7 @@ newinternal mfid_popparameters ; mfid_popparameters := scriptindex " def getparameters = runscript mfid_getparameters enddef ; def presetparameters = runscript mfid_presetparameters enddef ; +def hasparameter = runscript mfid_hasparameter enddef ; def getparameter = runscript mfid_getparameter enddef ; def getparameterdefault = runscript mfid_getparameterdefault enddef ; def getparametercount = runscript mfid_getparametercount enddef ; -- cgit v1.2.3