diff options
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpxl/mp-blob.mpxl | 8 | ||||
-rw-r--r-- | metapost/context/base/mpxl/mp-lmtx.mpxl | 33 | ||||
-rw-r--r-- | metapost/context/base/mpxl/mp-luas.mpxl | 10 | ||||
-rw-r--r-- | metapost/context/base/mpxl/mp-mlib.mpxl | 2 |
4 files changed, 45 insertions, 8 deletions
diff --git a/metapost/context/base/mpxl/mp-blob.mpxl b/metapost/context/base/mpxl/mp-blob.mpxl index c6b0843b5..555578114 100644 --- a/metapost/context/base/mpxl/mp-blob.mpxl +++ b/metapost/context/base/mpxl/mp-blob.mpxl @@ -53,14 +53,15 @@ vardef followtext(expr pth, txt) = image ( mfun_blob_n := mfun_blob_n + 1 ; lua.mp.mf_inject_blob(mfun_blob_n,txt); - save pat, al, at, pl, pc, wid, pos, ap, ad, pic, len, n, b, sc ; + save pat, al, at, pl, pc, wid, pos, ap, ad, pic, len, n, b, sc, sb ; path pat, b ; pat := pth ; - numeric al, at, pl, pc, wid, pos, len[], n, sc ; + numeric al, at, pl, pc, wid, pos, len[], n, sc, sb ; pair ap, ad ; picture pic[] ; len[0] := 0 ; n := lua.mp.mf_blob_size(mfun_blob_n) ; sc := 0 ; + sb := .25pt; for i=1 upto n : pic[i] := mfun_inject_blob(i) ; pic[i] := pic[i] shifted - llcorner pic[i] ; @@ -105,10 +106,11 @@ vardef followtext(expr pth, txt) = endfor ; if ((autoscaleupfollowtext = 2) or (autoscaledownfollowtext = 2)) and (sc <> 0) and (sc <> 1): currentpicture := currentpicture scaled (1/sc) ; + sb := 2 * sb / sc ; fi ; b := boundingbox currentpicture ; if tracingfollowtext = 1 : - draw b withpen pencircle scaled .25pt withcolor blue ; + draw b withpen pencircle scaled sb withcolor blue ; fi ; draw fullcircle scaled 100bp withprescript "mf_object=followtext" diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl index 3a6028954..2835dc89a 100644 --- a/metapost/context/base/mpxl/mp-lmtx.mpxl +++ b/metapost/context/base/mpxl/mp-lmtx.mpxl @@ -2368,3 +2368,36 @@ permanent mpvar ; % for old times sake (metafun manual) vardef textual primary p = false enddef ; + +% also for the menafun manual: + +newscriptindex mfid_labtorgb ; mfid_labtorgb := scriptindex "labtorgb" ; + +def labtorgb(expr l,a,b) = runscript mfid_labtorgb l a b enddef ; + +permanent labtorgb ; + +presetparameters "labtorgb" [ + mina = -100, + maxa = 100, + minb = -100, + maxb = 100, + step = 5, + l = 50, +] ; + +def lmt_labtorgb = applyparameters "labtorgb" "lmt_do_labtorgb" enddef ; + +vardef lmt_do_labtorgb = + image ( + pushparameters "labtorgb" ; + save l ; l := getparameter "l" ; + for a = getparameter "mina" step getparameter "step" until getparameter "maxa" : + for b = getparameter "minb" step getparameter "step" until getparameter "maxb" : + % draw (a,b) withcolor labtorgb(l,a,b) ; + draw (a,b) withcolor runscript mfid_labtorgb l a b ; + endfor ; + endfor ; + popparameters ; + ) +enddef ; diff --git a/metapost/context/base/mpxl/mp-luas.mpxl b/metapost/context/base/mpxl/mp-luas.mpxl index 05f7cef05..3e99ae7f7 100644 --- a/metapost/context/base/mpxl/mp-luas.mpxl +++ b/metapost/context/base/mpxl/mp-luas.mpxl @@ -154,10 +154,12 @@ newscriptindex mfid_getdimen ; mfid_getdimen := scriptindex "getdimen" ; def get newscriptindex mfid_getcount ; mfid_getcount := scriptindex "getcount" ; def getcount = runscript mfid_getcount enddef ; newscriptindex mfid_gettoks ; mfid_gettoks := scriptindex "gettoks" ; def gettoks = runscript mfid_gettoks enddef ; -newscriptindex mfid_setmacro ; mfid_setmacro := scriptindex "setmacro" ; def setmacro = runscript mfid_setmacro enddef ; -newscriptindex mfid_setdimen ; mfid_setdimen := scriptindex "setdimen" ; def setdimen = runscript mfid_setdimen enddef ; -newscriptindex mfid_setcount ; mfid_setcount := scriptindex "setcount" ; def setcount = runscript mfid_setcount enddef ; -newscriptindex mfid_settoks ; mfid_settoks := scriptindex "settoks" ; def settoks = runscript mfid_settoks enddef ; +% todo: figure out a mixed interface: setdimen "foo" 123pt ; setdimen("foo", 123pt) ; + +newscriptindex mfid_setmacro ; mfid_setmacro := scriptindex "setmacro" ; def setmacro(expr k, v) = runscript mfid_setmacro k v ; enddef ; +newscriptindex mfid_setdimen ; mfid_setdimen := scriptindex "setdimen" ; def setdimen(expr k, v) = runscript mfid_setdimen k v ; enddef ; +newscriptindex mfid_setcount ; mfid_setcount := scriptindex "setcount" ; def setcount(expr k, v) = runscript mfid_setcount k v ; enddef ; +newscriptindex mfid_settoks ; mfid_settoks := scriptindex "settoks" ; def settoks (expr k, v) = runscript mfid_settoks k v ; enddef ; permanent getmacro, getdimen, getcount, gettoks, setmacro, setdimen, setcount, settoks ; diff --git a/metapost/context/base/mpxl/mp-mlib.mpxl b/metapost/context/base/mpxl/mp-mlib.mpxl index ff733ce24..ce0d14b41 100644 --- a/metapost/context/base/mpxl/mp-mlib.mpxl +++ b/metapost/context/base/mpxl/mp-mlib.mpxl @@ -1135,7 +1135,7 @@ vardef mfun_do_outline_text_flush (expr kind, n, x, y, c) (text t) = enddef ; vardef mfun_do_outline_rule_flush (expr kind, x, y, w, h) = -% mfun_do_outline_text_flush (kind, 1, x, y, "") (fullsquare xyscaled(w,h)) + % mfun_do_outline_text_flush (kind, 1, x, y, "") (fullsquare xyscaled(w,h)) mfun_do_outline_text_flush (kind, 1, x, y, "") (unitsquare xyscaled(w,h)) enddef ; |