From db880f87c095b00754b51e7f7995f63b1f3ff554 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Sat, 17 Aug 2013 00:58:00 +0200
Subject: beta 2013.08.17 00:58

---
 metapost/context/base/metafun.mpii |  2 +-
 metapost/context/base/metafun.mpiv |  2 +-
 metapost/context/base/mp-base.mpii | 32 +++++++++++++++++++++++++++-----
 metapost/context/base/mp-base.mpiv | 30 ++++++++++++++++++++++++++----
 metapost/context/base/mp-tool.mpii |  2 ++
 metapost/context/base/mp-tool.mpiv |  2 ++
 6 files changed, 59 insertions(+), 11 deletions(-)

(limited to 'metapost')

diff --git a/metapost/context/base/metafun.mpii b/metapost/context/base/metafun.mpii
index 0de186ed2..9c55191f7 100644
--- a/metapost/context/base/metafun.mpii
+++ b/metapost/context/base/metafun.mpii
@@ -62,4 +62,4 @@ def end =
   ; message "" ; message metafunversion ; message "" ; normalend ;
 enddef ;
 
-dump ;
+% dump ;
diff --git a/metapost/context/base/metafun.mpiv b/metapost/context/base/metafun.mpiv
index 8247c121f..601b0562e 100644
--- a/metapost/context/base/metafun.mpiv
+++ b/metapost/context/base/metafun.mpiv
@@ -48,4 +48,4 @@ def end =
   ; message "" ; message metafunversion ; message "" ; normalend ;
 enddef ;
 
-dump ; % obsolete in mplib
+% dump ; % obsolete in mplib
diff --git a/metapost/context/base/mp-base.mpii b/metapost/context/base/mp-base.mpii
index 20b346cfc..0f8104447 100644
--- a/metapost/context/base/mp-base.mpii
+++ b/metapost/context/base/mp-base.mpii
@@ -1,14 +1,17 @@
 % This is (currently) a copy of the plain.mp file. We use a copy
 % because (1) we want to make sure that there are no unresolved
 % dependencies, and (2) we may patch this file eventually.
+%
+% colorpart will be overloaded later (we already had that one)
+% _findarr now has a filldraw, was fill in 0.63
 
 % This file gives the macros for plain MetaPost
 % It contains all the features of plain METAFONT except those specific to
 % font-making.  (See The METAFONTbook by D.E. Knuth).
 % There are also a number of macros for labeling figures, etc.
-string base_name, base_version; base_name="plain"; base_version="0.63";
+string base_name, base_version; base_name="plain"; base_version="1.004 for metafun ii";
 
-message "loading metafun, including plain.mp version " & base_version ;
+message "Preloading the plain mem file, version "&base_version;
 
 delimiters ();  % this makes parentheses behave like parentheses
 def upto = step 1 until enddef; % syntactic sugar
@@ -115,6 +118,26 @@ green = (0,1,0);
 blue = (0,0,1);
 background = white;   % The user can reset this
 
+% color part selection for within
+def colorpart primary t =
+  if colormodel t=7:
+    (cyanpart t, magentapart t, yellowpart t, blackpart t)
+  elseif colormodel t=5:
+    (redpart t, greenpart t, bluepart t)
+  elseif colormodel t=3:
+    (greypart t)
+  elseif colormodel t=1:
+    false
+  else:
+    %%% For clipping and bounding paths, etc.
+    if defaultcolormodel=7: (0,0,0,1)
+    elseif defaultcolormodel=5: black
+    elseif defaultcolormodel=3: 0
+    else: false
+    fi
+  fi
+enddef;
+
 % picture constants
 picture blankpicture,evenly,withdots;
 blankpicture=nullpicture; % `display blankpicture...'
@@ -441,8 +464,8 @@ enddef;
 
 def _findarr text t =
   draw _apth t;
-  fill arrowhead _apth withpen currentpen  t;
-  fill arrowhead  reverse _apth  withpen currentpen  t
+  filldraw arrowhead _apth withpen currentpen  t;
+  filldraw arrowhead  reverse _apth  withpen currentpen  t
 enddef;
 
 
@@ -479,7 +502,6 @@ def label = draw thelabel enddef;
 newinternal dotlabeldiam; dotlabeldiam:=3bp;
 vardef dotlabel@#(expr s,z) text t_ =
   label@#(s,z) t_;
-% label@#(s,z);
   interim linecap:=rounded;
   draw z withpen pencircle scaled dotlabeldiam t_;
 enddef;
diff --git a/metapost/context/base/mp-base.mpiv b/metapost/context/base/mp-base.mpiv
index d800fbb78..2887cc462 100644
--- a/metapost/context/base/mp-base.mpiv
+++ b/metapost/context/base/mp-base.mpiv
@@ -13,7 +13,7 @@
 string base_name, base_version ;
 
 base_name    := "plain" ;
-base_version := "0.63"  ;
+base_version := "1.004 for metafun iv"  ;
 
 message "loading metafun, including plain.mp version " & base_version ;
 
@@ -197,6 +197,28 @@ background := white ; % obsolete
 let graypart  = greypart  ;
 let graycolor = greycolor ;
 
+% color part (will be overloaded)
+
+def colorpart primary t =
+    if colormodel t=7:
+        (cyanpart t, magentapart t, yellowpart t, blackpart t)
+    elseif colormodel t = 5 :
+        (redpart t, greenpart t, bluepart t)
+    elseif colormodel t = 3 :
+        (greypart t)
+    elseif colormodel t = 1 :
+        false
+    elseif defaultcolormodel = 7 :
+        (0,0,0,1)
+    elseif defaultcolormodel = 5 :
+        black
+    elseif defaultcolormodel = 3 :
+        0
+    else :
+        false
+    fi
+enddef ;
+
 % picture constants
 
 picture blankpicture, evenly, withdots ;
@@ -704,10 +726,10 @@ def _finarr text t =
     filldraw arrowhead _apth t
 enddef ;
 
-def _findarr text t =
+def _findarr text t = % this had fill in 0.63 (potential incompatibility)
     draw _apth t ;
-    fill arrowhead         _apth withpen currentpen t ;
-    fill arrowhead reverse _apth withpen currentpen t ; % ; added HH
+    filldraw arrowhead         _apth withpen currentpen t ;
+    filldraw arrowhead reverse _apth withpen currentpen t ; % ; added HH
 enddef ;
 
 %% macros for labels
diff --git a/metapost/context/base/mp-tool.mpii b/metapost/context/base/mp-tool.mpii
index 8d8c9d920..8ec3fab9d 100644
--- a/metapost/context/base/mp-tool.mpii
+++ b/metapost/context/base/mp-tool.mpii
@@ -2562,3 +2562,5 @@ primarydef p snapped s =
   fi ; )
   p
 enddef ;
+
+let dump = relax ;
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 59bd4e75a..a6b39bfe3 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -2322,3 +2322,5 @@ def mfun_apply_max_dimensions = % not a generic helper, we want to protect this
 enddef;
 
 extra_endfig := extra_endfig & "mfun_apply_max_dimensions ;" ;
+
+let dump = relax ;
-- 
cgit v1.2.3