summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/context/base/mp-base.mpiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mp-base.mpiv')
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-base.mpiv103
1 files changed, 94 insertions, 9 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mp-base.mpiv b/Master/texmf-dist/metapost/context/base/mp-base.mpiv
index 7b3a69bb031..0b655ef479a 100644
--- a/Master/texmf-dist/metapost/context/base/mp-base.mpiv
+++ b/Master/texmf-dist/metapost/context/base/mp-base.mpiv
@@ -13,9 +13,9 @@
string base_name, base_version ;
base_name := "plain" ;
-base_version := "0.63" ;
+base_version := "1.004 for metafun iv" ;
-message "Preloading the plain mem file, version " & base_version ;
+message "loading metafun, including plain.mp version " & base_version ;
delimiters () ; % this makes parentheses behave like parentheses
@@ -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 ;
@@ -301,7 +323,7 @@ primarydef w dotprod z =
enddef ;
primarydef x**y =
- if y=2 :
+ if y = 2 :
x*x
else :
takepower y of x
@@ -326,11 +348,46 @@ def takepower expr y of x =
endfor
fi
else :
- hide(errmessage "Undefined power: " & decimal x&"**"&decimal y)
+ hide(errmessage "Undefined power: " & decimal x & "**" & decimal y)
fi
fi
enddef ;
+% for big number systems:
+%
+% primarydef x**y =
+% if y = 1 :
+% x
+% elseif y = 2 :
+% x*x
+% elseif y = 3 :
+% x*x*x
+% else :
+% takepower y of x
+% fi
+% enddef ;
+%
+% vardef takepower expr y of x =
+% if (x=0) and (y>0) :
+% 0
+% else :
+% 1
+% if y = floor y :
+% if y >= 0 :
+% for n=1 upto y :
+% *x
+% endfor
+% else :
+% for n=-1 downto y :
+% /x
+% endfor
+% fi
+% else :
+% hide(errmessage "Undefined power: " & decimal x & "**" & decimal y)
+% fi
+% fi
+% enddef ;
+
vardef direction expr t of p =
postcontrol t of p - precontrol t of p
enddef ;
@@ -572,8 +629,36 @@ def filldraw expr c =
addto currentpicture contour c withpen currentpen _op_
enddef ;
-def drawdot expr z =
- addto currentpicture contour makepath currentpen shifted z _op_
+% def drawdot expr z =
+% addto currentpicture contour makepath currentpen shifted z _op_
+% enddef ;
+%
+% testcase DEK:
+%
+% for j=1 upto 9 :
+% pickup pencircle xscaled .4 yscaled .2 ;
+% drawdot (10j,0) withpen pencircle xscaled .5j yscaled .25j rotated 45 ;
+% pickup pencircle xscaled .5j yscaled .25j rotated 45 ;
+% drawdot (10j,10);
+% endfor ;
+%
+% or:
+%
+%\startMPpage
+%
+% def drawdot expr z =
+% addto currentpicture contour (makepath currentpen shifted z) _op_
+% enddef;
+%
+% drawdot origin shifted (0,-3cm) withpen pencircle scaled 2cm ;
+% pickup pencircle scaled 2cm ; drawdot origin withcolor red ;
+
+def drawdot expr p =
+ if pair p :
+ addto currentpicture doublepath p withpen currentpen _op_
+ else :
+ errmessage("drawdot only accepts a pair expression")
+ fi
enddef ;
def unfill expr c = fill c withcolor background enddef ;
@@ -704,10 +789,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