summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-06-15 14:15:04 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-06-15 14:15:04 +0200
commitce4c6e98782de9bab14ed3963c403edbac974879 (patch)
tree3023797c740501bc60ad7a37533c34fd4491cb67 /metapost
parentbafe29de59fdc2a37922e198aebc9b04f518f152 (diff)
downloadcontext-ce4c6e98782de9bab14ed3963c403edbac974879.tar.gz
2015-06-15 13:45:00
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-mlib.mpiv42
1 files changed, 37 insertions, 5 deletions
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv
index 94377e52d..decdda15b 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mp-mlib.mpiv
@@ -476,10 +476,24 @@ boolean trace_shades ; trace_shades := false ; % still there
% withshadecolors (red,green)
% ;
-path mfun_shade_path ;
+path mfun_shade_path ;
+numeric mfun_shade_step ; mfun_shade_step := 0 ;
+
+def withshadestep =
+ hide(mfun_shade_step := mfun_shade_step + 1 ;)
+ mfun_withshadestep
+enddef ;
+
+def mfun_withshadestep (text t) =
+ withprescript "sh_step=" & decimal mfun_shade_step
+ t
+enddef ;
primarydef p withshademethod m =
- hide(mfun_shade_path := p ;)
+ hide(
+ mfun_shade_path := p ;
+ mfun_shade_step := 1 ;
+ )
p
withprescript "sh_domain=0 1"
withprescript "sh_color=into"
@@ -527,10 +541,28 @@ def withshadefactor expr f =
withprescript "sh_factor=" & decimal f
enddef ;
+% def withshadebound (expr a) =
+% if mfun_shade_step > 0 :
+% withprescript "sh_bound_" & decimal mfun_shade_step & "=" & decimal a
+% fi
+% enddef ;
+
+def withshadefraction expr a =
+ if mfun_shade_step > 0 :
+ withprescript "sh_fraction_" & decimal mfun_shade_step & "=" & decimal a
+ fi
+enddef ;
+
def withshadecolors (expr a, b) =
- withprescript "sh_color=into"
- withprescript "sh_color_a=" & colordecimals a
- withprescript "sh_color_b=" & colordecimals b
+ if mfun_shade_step > 0 :
+ withprescript "sh_color=into"
+ withprescript "sh_color_a_" & decimal mfun_shade_step & "=" & colordecimals a
+ withprescript "sh_color_b_" & decimal mfun_shade_step & "=" & colordecimals b
+ else :
+ withprescript "sh_color=into"
+ withprescript "sh_color_a=" & colordecimals a
+ withprescript "sh_color_b=" & colordecimals b
+ fi
enddef ;
primarydef a shadedinto b = % withcolor red shadedinto green