summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/metapost/roundrect/CHANGES4
-rw-r--r--Master/texmf-dist/doc/metapost/roundrect/roundrect.pdfbin184897 -> 192264 bytes
-rw-r--r--Master/texmf-dist/metapost/roundrect/roundrect.mp22
-rw-r--r--Master/texmf-dist/source/metapost/roundrect/roundrect.dtx116
4 files changed, 132 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/metapost/roundrect/CHANGES b/Master/texmf-dist/doc/metapost/roundrect/CHANGES
index 60cb9ee6856..cb943088a29 100644
--- a/Master/texmf-dist/doc/metapost/roundrect/CHANGES
+++ b/Master/texmf-dist/doc/metapost/roundrect/CHANGES
@@ -1,3 +1,7 @@
+v2.1, released on 7 August 2015: incremental improvements.
+Added in dropshadows and parameters for controlling them.
+Updated and rearranged the documentation.
+
v2.0, released on 1 August 2015: complete rewrite. The
code is much cleaner and works better and more consistently.
Removed all the "titlebar" options; it's better to form such
diff --git a/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf b/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
index 82e897485d2..f1e666b92d0 100644
--- a/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
+++ b/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
Binary files differ
diff --git a/Master/texmf-dist/metapost/roundrect/roundrect.mp b/Master/texmf-dist/metapost/roundrect/roundrect.mp
index 6dbde535544..66c385e4943 100644
--- a/Master/texmf-dist/metapost/roundrect/roundrect.mp
+++ b/Master/texmf-dist/metapost/roundrect/roundrect.mp
@@ -33,6 +33,8 @@ numeric rrbotrtborderrad; rrbotrtborderrad := 40pt;
numeric rrbotlftborderrad; rrbotlftborderrad := 40pt;
numeric rrtoplftborderrad; rrtoplftborderrad := 40pt;
numeric rrtextwd; rrtextwd := 0;
+numeric rrshadowx; rrshadowx := rrbotrtborderrad/4;
+numeric rrshadowy; rrshadowy := -rrbotrtborderrad/4;
string rrtextfont; rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
color rrtextcolor; rrtextcolor := black;
string rrbodytext; rrbodytext := "";
@@ -41,10 +43,12 @@ boolean rrnotop; rrnotop := false;
boolean rrnobot; rrnobot := false;
boolean rrnolft; rrnolft := false;
boolean rrnort; rrnort := false;
+boolean rrdropshadow; rrdropshadow := false;
color rrtopbordercolor; rrtopbordercolor := black;
color rrbotbordercolor; rrbotbordercolor := black;
color rrlftbordercolor; rrlftbordercolor := black;
color rrrtbordercolor; rrrtbordercolor := black;
+color rrshadowcolor; rrshadowcolor := black;
def rrbordercolor(expr x) =
rrtopbordercolor := x;
rrbotbordercolor := x;
@@ -81,6 +85,10 @@ rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
rrtextcolor := black;
rrbodytext := "";
rrtextalign; rrtextalign := "\centering";
+rrdropshadow := false;
+rrshadowcolor := black;
+rrshadowx := rrbotrtborderrad/4;
+rrshadowy := -rrbotrtborderrad/4;
enddef;
def roundrect(expr rrht, rrwd)(suffix name) =
TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}");
@@ -126,9 +134,21 @@ rrtopborder := rrtoplftcorner--rrtoprtcorner;
rrbotborder := rrbotrtcorner--rrbotlftcorner;
rrlftborder := rrbotlftcorner--rrtoplftcorner;
rrrtborder := rrtoprtcorner--rrbotrtcorner;
-name := image(fill rrtoplftcorner--rrtoprtcorner--
+picture rrdropshadowpic;
+if (rrdropshadow = true):
+rrdropshadowpic := image(fill rrtoplftcorner--rrtoprtcorner--
+rrbotrtcorner--rrbotlftcorner--cycle
+shifted (rrshadowx,rrshadowy) withcolor
+rrshadowcolor);
+else:
+rrdropshadowpic := currentpicture;
+fi
+name := currentpicture;
+addto name also rrdropshadowpic;
+rrdropshadowpic := image(fill rrtoplftcorner--rrtoprtcorner--
rrbotrtcorner--rrbotlftcorner--cycle withcolor
rrinnercolor);
+addto name also rrdropshadowpic;
picture rrtmpborder;
border := currentpicture;
if (rrnotop = false):
diff --git a/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx b/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
index 3ffe2344a13..b63914371c8 100644
--- a/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
+++ b/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
@@ -56,7 +56,7 @@
\end{document}
%</driver>
% \fi
-% \title{The \texttt{roundrect} Macros, v2.0}
+% \title{The \texttt{roundrect} Macros, v2.1}
% \author{Donald P.\ Goodman III}
% \date{\today}
%
@@ -116,7 +116,7 @@
% Here, we simply post the plain vanilla \MP\ code, and let
% you work out those details however you prefer.
%
-% \section{Basic Usage}
+% \section{Shapes and Styles}
%
% The core of all the action is the
% \DescribeMacro{roundrect}|roundrect| macro; this
@@ -214,11 +214,15 @@
% makes it much easier to combine multiple rectangles into
% interesting forms, which we'll see a bit more about later.
%
-% Of course, the color of both the background and the border
-% can be controlled with
-% \DescribeMacro{rrinnercolor}|rrinnercolor| and
-% \DescribeMacro{rrbordercolor}|rrbordercolor()|,
-% respectively.
+% \section{Coloring the Parts}
+% \label{sect:colorpart}
+%
+% The colors of the |roundrect| are extremely configurable,
+% both on the whole and for individual parts. The
+% background color of the |roundrect| is controlled by
+% \DescribeMacro{rrinnercolor}|rrinnercolor|, while the
+% border is colored by
+% \DescribeMacro{rrbordercolor}|rrbordercolor()|.
%
% \demonstrate{%
% \hbox{|rrbordercolor(blue);|}
@@ -368,6 +372,76 @@
% and drawn it with a square pen scaled on the y-axis only
% by 6. Clearly, there are huge possibilities here.
%
+% \section{Drop Shadows}
+% \label{sect:dropshadows}
+%
+% We can also put a \emph{shadow} on the boxes using
+% \DescribeMacro{rrdropshadow}|rrdropshadow|, a boolean
+% value which defaults to |false|:
+%
+% \demonstrate{%
+% \hbox{|rrdropshadow := true;|}
+% \hbox{|roundrect(1in,2in)(rectangle);|}
+% \hbox{|draw rectangle;|}
+% }{%
+% \begin{mpost}
+% rrdropshadow := true;
+% roundrect(1in,2in)(rectangle);
+% draw rectangle;
+% \end{mpost}
+% }%
+%
+% The drop shadow always mimics the shape of the box itself;
+% there is presently no way to avoid that. If for some
+% reason you want to, you'll have to create a separate
+% |roundrect| and place it manually.
+%
+% We can control the size and direction of the drop shadow
+% fairly easily, however, along with its color. Its color
+% is controlled by
+% \DescribeMacro{rrshadowcolor}|rrshadowcolor|, which
+% can be set to any arbitrary \MP\ color:
+%
+% \demonstrate{%
+% \hbox{|rrdropshadow := true;|}
+% \hbox{|rrshadowcolor := blue;|}
+% \hbox{|roundrect(1in,2in)(rectangle);|}
+% \hbox{|draw rectangle;|}
+% }{%
+% \begin{mpost}
+% rrdropshadow := true;
+% rrshadowcolor := blue;
+% roundrect(1in,2in)(rectangle);
+% draw rectangle;
+% \end{mpost}
+% }%
+%
+% The position of the drop shadow is governed by
+% \DescribeMacro{rrshadowx}|rrshadowx| and
+% \DescribeMacro{rrshadowy}|rrshadowy|, which will shift the
+% |roundrect| on the |x| or |y| axis, respectively. By
+% default, these are set to one quarter of the border radius
+% in effect for the bottom left corner:
+%
+% \demonstrate{%
+% \hbox{|rrdropshadow := true;|}
+% \hbox{|rrshadowcolor := blue;|}
+% \hbox{|roundrect(1in,2in)(rectangle);|}
+% \hbox{|draw rectangle;|}
+% }{%
+% \begin{mpost}
+% rrdropshadow := true;
+% rrshadowcolor := blue;
+% rrshadowx := -rrbotlftborderrad/4;
+% rrshadowy := rrbotlftborderrad/4;
+% roundrect(1in,2in)(rectangle);
+% draw rectangle shifted (1in,0.5in);
+% \end{mpost}
+% }%
+%
+% \section{Including Text}
+% \label{sect:text}
+%
% Finally, we can put text in the rectangles; this is as
% configurable as everything else:
%
@@ -433,7 +507,8 @@
% \end{mpost}
% }
%
-% Finally, the restore all these values to the default, use
+%
+% Finally, to restore all these values to the default, use
% the |rrrestorevals;| directive. This will clear
% everything to default so you can have a completely
% different |roundrect| in the same figure.
@@ -448,6 +523,8 @@ numeric rrbotrtborderrad; rrbotrtborderrad := 40pt;
numeric rrbotlftborderrad; rrbotlftborderrad := 40pt;
numeric rrtoplftborderrad; rrtoplftborderrad := 40pt;
numeric rrtextwd; rrtextwd := 0;
+numeric rrshadowx; rrshadowx := rrbotrtborderrad/4;
+numeric rrshadowy; rrshadowy := -rrbotrtborderrad/4;
string rrtextfont; rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
color rrtextcolor; rrtextcolor := black;
string rrbodytext; rrbodytext := "";
@@ -456,10 +533,12 @@ boolean rrnotop; rrnotop := false;
boolean rrnobot; rrnobot := false;
boolean rrnolft; rrnolft := false;
boolean rrnort; rrnort := false;
+boolean rrdropshadow; rrdropshadow := false;
color rrtopbordercolor; rrtopbordercolor := black;
color rrbotbordercolor; rrbotbordercolor := black;
color rrlftbordercolor; rrlftbordercolor := black;
color rrrtbordercolor; rrrtbordercolor := black;
+color rrshadowcolor; rrshadowcolor := black;
def rrbordercolor(expr x) =
rrtopbordercolor := x;
rrbotbordercolor := x;
@@ -496,6 +575,10 @@ def rrrestorevals =
rrtextcolor := black;
rrbodytext := "";
rrtextalign; rrtextalign := "\centering";
+ rrdropshadow := false;
+ rrshadowcolor := black;
+ rrshadowx := rrbotrtborderrad/4;
+ rrshadowy := -rrbotrtborderrad/4;
enddef;
def roundrect(expr rrht, rrwd)(suffix name) =
TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}");
@@ -541,9 +624,24 @@ def roundrect(expr rrht, rrwd)(suffix name) =
rrbotborder := rrbotrtcorner--rrbotlftcorner;
rrlftborder := rrbotlftcorner--rrtoplftcorner;
rrrtborder := rrtoprtcorner--rrbotrtcorner;
- name := image(fill rrtoplftcorner--rrtoprtcorner--
+ picture rrdropshadowpic;
+ if (rrdropshadow = true):
+ rrdropshadowpic := image(fill rrtoplftcorner--rrtoprtcorner--
+ rrbotrtcorner--rrbotlftcorner--cycle
+ shifted (rrshadowx,rrshadowy) withcolor
+ rrshadowcolor);
+ else:
+ rrdropshadowpic := currentpicture;
+ fi
+ name := currentpicture;
+ addto name also rrdropshadowpic;
+ rrdropshadowpic := image(fill rrtoplftcorner--rrtoprtcorner--
rrbotrtcorner--rrbotlftcorner--cycle withcolor
rrinnercolor);
+ addto name also rrdropshadowpic;
+% name := image(fill rrtoplftcorner--rrtoprtcorner--
+% rrbotrtcorner--rrbotlftcorner--cycle withcolor
+% rrinnercolor);
picture rrtmpborder;
border := currentpicture;
if (rrnotop = false):