summaryrefslogtreecommitdiff
path: root/metapost/context/base/mp-mlib.mp
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-05-18 23:40:14 +0300
committerMarius <mariausol@gmail.com>2011-05-18 23:40:14 +0300
commitb714ce8e20b324368a7ab233be6fa9a0e50befa4 (patch)
tree6c89c4f614b2c3f38180a77b937a26a330af015c /metapost/context/base/mp-mlib.mp
parentf68b6626917f73ba448040a8667d0b2b9700ca6c (diff)
downloadcontext-b714ce8e20b324368a7ab233be6fa9a0e50befa4.tar.gz
stable 2011.05.18 18:04
Diffstat (limited to 'metapost/context/base/mp-mlib.mp')
-rw-r--r--metapost/context/base/mp-mlib.mp52
1 files changed, 50 insertions, 2 deletions
diff --git a/metapost/context/base/mp-mlib.mp b/metapost/context/base/mp-mlib.mp
index 9929cfde5..6c7115cb7 100644
--- a/metapost/context/base/mp-mlib.mp
+++ b/metapost/context/base/mp-mlib.mp
@@ -359,8 +359,7 @@ vardef define_linear_shade (expr a, b, ca, cb) =
enddef ;
primarydef p withshade sc =
- p
- withprescript _defined_cs_pre_[sc]
+ p withprescript _defined_cs_pre_[sc]
enddef ;
% vardef predefined_linear_shade (expr p, n, ca, cb) =
@@ -376,6 +375,55 @@ enddef ;
% define_circular_shade(ab,ab,0,r,ca,cb)
% enddef ;
+% NEW EXPERIMENTAL CODE
+
+def withlinearshading (expr a, b) =
+ withprescript "sh_type=linear"
+ withprescript "sh_domain=0 1"
+ withprescript "sh_factor=" & decimal shadefactor
+ withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset)
+ withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset)
+enddef ;
+
+def withcircularshading (expr a, b, ra, rb) =
+ withprescript "sh_type=circular"
+ withprescript "sh_domain=0 1"
+ withprescript "sh_factor=" & decimal shadefactor
+ withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset)
+ withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset)
+ withprescript "sh_radius_a=" & decimal ra
+ withprescript "sh_radius_b=" & decimal rb
+enddef ;
+
+def withfromshadecolor expr t =
+ withprescript "sh_color=into"
+ withprescript "sh_color_a=" & colordecimals t
+enddef ;
+
+def withtoshadecolor expr t =
+ withprescript "sh_color=into"
+ withprescript "sh_color_b=" & colordecimals t
+enddef ;
+
+def withshading (expr how)(text rest) =
+ if how = "linear" :
+ withlinearshading(rest)
+ elseif how = "circular" :
+ withcircularshading(rest)
+ else :
+ % nothing
+ fi
+enddef ;
+
+primarydef a shadedinto b =
+ 1
+ withprescript "sh_color=into"
+ withprescript "sh_color_a=" & colordecimals a
+ withprescript "sh_color_b=" & colordecimals b
+enddef ;
+
+% END OF NEW
+
% Graphic text (we will move code here)
def graphictext primary t =