summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/roundrect
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-07-29 20:44:49 +0000
committerKarl Berry <karl@freefriends.org>2015-07-29 20:44:49 +0000
commit476e23fc645b7f0eb1ffcaae59622b9f62bf198b (patch)
treef61dc390a811accf13cdadebde8d84fcfb089c44 /Master/texmf-dist/metapost/roundrect
parent9a477aa1877f9f798c26d3bee9d239db61fc7838 (diff)
roundrect (29jul15)
git-svn-id: svn://tug.org/texlive/trunk@37994 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/roundrect')
-rw-r--r--Master/texmf-dist/metapost/roundrect/roundrect.mp192
1 files changed, 192 insertions, 0 deletions
diff --git a/Master/texmf-dist/metapost/roundrect/roundrect.mp b/Master/texmf-dist/metapost/roundrect/roundrect.mp
new file mode 100644
index 00000000000..e14be7511e4
--- /dev/null
+++ b/Master/texmf-dist/metapost/roundrect/roundrect.mp
@@ -0,0 +1,192 @@
+%%
+%% This is file `roundrect.mp',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% roundrect.dtx (with options: `package')
+%% This is a generated file.
+%%
+%% This document is copyright 2015 by Donald P. Goodman, and is
+%% released publicly under the LaTeX Project Public License. The
+%% distribution and modification of this work is constrained by the
+%% conditions of that license. See
+%% http://www.latex-project.org/lppl.txt
+%% for the text of the license. This document is released
+%% under version 1.3 of that license, and this work may be distributed
+%% or modified under the terms of that license or, at your option, any
+%% later version.
+%%
+%% This work has the LPPL maintenance status 'maintained'.
+%%
+%% The Current Maintainer of this work is Donald P. Goodman
+%% (dgoodmaniii@gmail.com).
+%%
+%% This work consists of the files roundrect.dtx and
+%% roundrect.ins, along with the generated file roundrect.mp
+%% and roundrect.pdf, and the README.
+
+
+input TEX;
+color rrinnercolor; rrinnercolor := white;
+color rrbordercolor; rrbordercolor := black;
+numeric rrborderwd; rrborderwd := 2pt;
+numeric rrborderrad; rrborderrad := 40pt;
+string rrtitlefont; rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+string rrtextfont; rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
+color rrtitlecolor; rrtitlecolor := black;
+color rrtextcolor; rrtextcolor := black;
+color rrtitlebgcolor; rrtitlebgcolor := white;
+color rrtitlebordercolor; rrtitlebordercolor := black;
+boolean rrtitlebar; rrtitlebar := false;
+string rrtitleside; rrtitleside := "top";
+numeric rrtitleht; rrtitleht := 0pt;
+string rrtitlepos; rrtitlepos := "center";
+boolean rrtitlebotborder; rrtitlebotborder := true;
+color rrtitlebotbordercolor; rrtitlebotbordercolor := black;
+string rrtitletext; rrtitletext := "";
+string rrbodytext; rrbodytext := "";
+string rrbodyalign; rrbodyalign := "justify";
+string rrbodyaligncom; rrbodyaligncom := "";
+def rrrestorevals =
+rrinnercolor := white;
+rrbordercolor := black;
+rrborderwd := 2pt;
+rrborderrad := 40pt;
+rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
+rrtitlecolor := black;
+rrtextcolor := black;
+rrtitlebgcolor := white;
+rrtitlebordercolor := black;
+rrtitlebar := false;
+rrtitleside := "top";
+rrtitleht := 0pt;
+rrtitlepos := "center";
+rrtitlebotborder := true;
+rrtitlebotbordercolor := black;
+rrtitletext := "";
+rrbodytext := "";
+rrbodyalign := "justify";
+rrbodyaligncom := "";
+enddef;
+def roundrect(expr rrht, rrwd)(suffix name) =
+TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}");
+TEXPOST("\end{document}");
+if (rrtitleht = 0pt):
+rrtitleht := rrht/6;
+fi
+path rra; path rrb; path rrc; path rrd;
+pair a; pair b; pair c; pair d;
+a := (0,0) shifted (-rrwd/2,-rrht/2);
+b := (0,0) shifted (rrwd/2,-rrht/2);
+c := (0,0) shifted (rrwd/2,rrht/2);
+d := (0,0) shifted (-rrwd/2,rrht/2);
+rra := fullcircle scaled rrborderrad shifted (xpart a +
+(rrborderrad/2),ypart a + (rrborderrad/2));
+rrb := fullcircle scaled rrborderrad shifted (xpart b -
+(rrborderrad/2),ypart b + (rrborderrad/2));
+rrd := fullcircle scaled rrborderrad shifted (xpart d +
+(rrborderrad/2),ypart d - (rrborderrad/2));
+rrc := fullcircle scaled rrborderrad shifted (xpart c -
+(rrborderrad/2),ypart c - (rrborderrad/2));
+pair f; f := (a--b) intersectionpoint rra;
+pair g; g := (a--b) intersectionpoint rrb;
+pair h; h := (b--c) intersectionpoint rrb;
+pair i; i := (b--c) intersectionpoint rrc;
+pair j; j := (c--d) intersectionpoint rrc;
+pair k; k := (c--d) intersectionpoint rrd;
+pair l; l := (d--a) intersectionpoint rrd;
+pair m; m := (d--a) intersectionpoint rra;
+picture name;
+picture border;
+pair n; pair o; path rrtitlepath; path rrfinalline;
+name := image(fill f--g{right}..{up}h--i{up}..{left}j--
+k{left}..{down}l--m{down}..{right}f--cycle
+withcolor rrinnercolor);
+border := image(pickup pencircle scaled rrborderwd;
+draw f--g{right}..{up}h--i{up}..{left}j--
+k{left}..{down}l--m{down}..{right}f--cycle
+withcolor rrbordercolor);
+addto name also border;
+pair rrtitlestation;
+picture rrtitlelabel;
+if (rrtitlebar):
+if (rrtitleside = "top"):
+n := (xpart m,ypart k - (rrtitleht));
+o := (xpart i,ypart k - (rrtitleht));
+defaultscale := 4;
+if (ypart n > ypart l):
+n := (xpart n,ypart l);
+o := (xpart o,ypart l);
+fi
+rrtitlepath := o--i{up}..{left}j--k{left}..{down}l--n;
+if (rrtitlepos = "center"):
+rrtitlestation := 0.5[n,o] shifted (0,rrtitleht/2);
+elseif (rrtitlepos = "left"):
+rrtitlestation := n shifted (rrborderrad/4,rrtitleht/2);
+elseif (rrtitlepos = "right"):
+rrtitlestation := o shifted (-rrborderrad/4,rrtitleht/2);
+fi
+elseif (rrtitleside = "bot"):
+n := (xpart m,ypart f + (rrtitleht));
+o := (xpart i,ypart f + (rrtitleht));
+if (ypart n < ypart m):
+n := (xpart n,ypart m);
+o := (xpart o,ypart m);
+fi
+rrtitlepath := o--h{down}..{left}g--f{left}..{up}m--n;
+if (rrtitlepos = "center"):
+rrtitlestation := 0.5[n,o] shifted (0,-rrtitleht/2);
+elseif (rrtitlepos = "left"):
+rrtitlestation := n shifted (rrborderrad/4,-rrtitleht/2);
+elseif (rrtitlepos = "right"):
+rrtitlestation := o shifted (-rrborderrad/4,-rrtitleht/2);
+fi
+fi
+rrfinalline = n--o;
+picture rrtitlepic;
+picture rrtitlepicb;
+picture rrtitlebotborderpic;
+rrtitlebotborderpic := image (draw rrfinalline
+withcolor rrtitlebotbordercolor);
+rrtitlepicb := image(draw rrtitlepath withcolor rrtitlebordercolor);
+if (rrtitlebotborder = true):
+addto rrtitlepicb also rrtitlebotborderpic;
+fi
+rrtitlepath := buildcycle(rrtitlepath,rrfinalline);
+rrtitlepic := image(fill rrtitlepath withcolor rrtitlebgcolor);
+if (rrtitlepos = "center"):
+rrtitlelabel := image(label(TEX(rrtitlefont&" "&rrtitletext),
+rrtitlestation) withcolor rrtitlecolor);
+elseif (rrtitlepos = "left"):
+rrtitlelabel := image(label.rt(TEX(rrtitlefont&" "&rrtitletext),
+rrtitlestation) withcolor rrtitlecolor);
+elseif (rrtitlepos = "right"):
+rrtitlelabel := image(label.lft(TEX(rrtitlefont&" "&rrtitletext),
+rrtitlestation) withcolor rrtitlecolor);
+fi
+if (rrbodyalign = "center"):
+rrbodyaligncom := "\centering ";
+elseif (rrbodyalign = "left"):
+rrbodyaligncom := "\flushleft\vskip-\baselineskip ";
+elseif (rrbodyalign = "right"):
+rrbodyaligncom := "\flushright\vskip-\baselineskip ";
+fi
+picture rrbodytextpic;
+if (rrtitleside = "top"):
+rrbodytextpic :=
+image(label.lrt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
+elseif (rrtitleside = "bot"):
+rrbodytextpic :=
+image(label.urt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
+fi
+addto name also rrtitlepic;
+addto name also rrtitlepicb;
+addto name also rrtitlelabel;
+addto name also rrbodytextpic;
+fi
+enddef;
+\endinput
+%%
+%% End of file `roundrect.mp'.