summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2002-04-17 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2002-04-17 00:00:00 +0200
commit64f02e3e5cbd20af19a0089553db5ee5c7d5eca1 (patch)
treeeb1ec97588f7ba468d649d8ca57812860e88618d /metapost
parent953aec80be6e084ee21459d3618af2221fc5df08 (diff)
downloadcontext-64f02e3e5cbd20af19a0089553db5ee5c7d5eca1.tar.gz
stable 2002.04.17
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/mp-core.mp8
-rw-r--r--metapost/context/mp-tool.mp39
2 files changed, 42 insertions, 5 deletions
diff --git a/metapost/context/mp-core.mp b/metapost/context/mp-core.mp
index fea67e1a8..0c409264f 100644
--- a/metapost/context/mp-core.mp
+++ b/metapost/context/mp-core.mp
@@ -326,6 +326,7 @@ pair boxgriddirection ; boxgriddirection := up ;
numeric boxgridwidth ; boxgridwidth := 1pt ;
numeric boxlinewidth ; boxlinewidth := 1pt ;
numeric boxlineradius ; boxlineradius := 0pt ;
+numeric boxfilloffset ; boxfilloffset := 0pt ;
def draw_box =
draw pxy withcolor boxlinecolor withpen pencircle scaled boxlinewidth ;
@@ -372,7 +373,14 @@ vardef do_draw_par (expr p) =
pp := p ;
fi ;
if boxfilltype>0 :
+if boxfilloffset>0 :
+ % temporary hack
+ begingroup ; interim linejoin := mitered ;
+ filldraw pp withcolor boxfillcolor withpen pencircle scaled (2*boxfilloffset) ;
+ endgroup ;
+else :
fill pp withcolor boxfillcolor ;
+fi ;
fi ;
if boxlinetype>0 :
draw pp withcolor boxlinecolor withpen pencircle scaled boxlinewidth ;
diff --git a/metapost/context/mp-tool.mp b/metapost/context/mp-tool.mp
index 95a89bf54..e24bd45e9 100644
--- a/metapost/context/mp-tool.mp
+++ b/metapost/context/mp-tool.mp
@@ -706,10 +706,26 @@ enddef ;
%D Saves typing:
-vardef bottomboundary primary p = (llcorner p -- lrcorner p) enddef ;
-vardef rightboundary primary p = (lrcorner p -- urcorner p) enddef ;
-vardef topboundary primary p = (urcorner p -- ulcorner p) enddef ;
-vardef leftboundary primary p = (ulcorner p -- llcorner p) enddef ;
+% vardef bottomboundary primary p = (llcorner p -- lrcorner p) enddef ;
+% vardef rightboundary primary p = (lrcorner p -- urcorner p) enddef ;
+% vardef topboundary primary p = (urcorner p -- ulcorner p) enddef ;
+% vardef leftboundary primary p = (ulcorner p -- llcorner p) enddef ;
+
+vardef bottomboundary primary p =
+ if pair p : p else : (llcorner p -- lrcorner p) fi
+enddef ;
+
+vardef rightboundary primary p =
+ if pair p : p else : (lrcorner p -- urcorner p) fi
+enddef ;
+
+vardef topboundary primary p =
+ if pair p : p else : (urcorner p -- ulcorner p) fi
+enddef ;
+
+vardef leftboundary primary p =
+ if pair p : p else : (ulcorner p -- llcorner p) fi
+enddef ;
%D Nice too:
@@ -1835,7 +1851,7 @@ if unknown darkyellow : color darkyellow ; darkyellow := .625(1,1,0) fi ;
if unknown darkgray : color darkgray ; darkgray := .625(1,1,1) fi ;
if unknown lightgray : color lightgray ; lightgray := .875(1,1,1) fi ;
-% an improeved plain mp macro
+% an improved plain mp macro
vardef center primary p =
if pair p : p else : .5[llcorner p, urcorner p] fi
@@ -1906,6 +1922,19 @@ def addbackground text t =
endgroup ;
enddef ;
+% makes a (line) into an infinite one (handy for calculating
+% intersection points
+
+vardef infinite expr p =
+ (-infinity*unitvector(direction 0 of p)
+ shifted point 0 of p
+ -- p --
+ +infinity*unitvector(direction length(p) of p)
+ shifted point length(p) of p)
+enddef ;
+
+
+
% done
endinput ;