diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-05-18 18:04:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-05-18 18:04:00 +0200 |
commit | 1a4587e7d792561d779de21e88eb424539085090 (patch) | |
tree | 9c53cc6de8d0fc4497f4efb7b57071127e1785ea /metapost | |
parent | 5eca07d318d43832522e3482a000ab933c25a420 (diff) | |
download | context-1a4587e7d792561d779de21e88eb424539085090.tar.gz |
stable 2011.05.18 18:04
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-mlib.mp | 52 |
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 = |