23.10.2014 Views

mfpic-doc.pdf.

mfpic-doc.pdf.

mfpic-doc.pdf.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.3 COLORS IN MFPIC. 28<br />

The first two commands are never necessary in early METAPOST, but they are still defined: they<br />

simply return the given color if it is a known argument of type color, or apply the function gray()<br />

is it is numeric, and return black for an unknown name.<br />

The last one makegray converts any color to a numeric, and then returns either that number<br />

(recent METAPOST) or that multiple of white (early METAPOST). In METAFONT, all three pass the<br />

(presumably numeric) argument 〈clr〉 unchanged.<br />

All three functions return some version of black if 〈clr〉 is not a color of some type, or has an<br />

unknown value.<br />

4.3.2 ESTABLISHING MFPIC DEFAULT COLORS<br />

\drawcolor[〈model〉]{〈colorspec〉}<br />

\fillcolor[〈model〉]{〈colorspec〉}<br />

\hatchcolor[〈model〉]{〈colorspec〉}<br />

\pointcolor[〈model〉]{〈colorspec〉}<br />

\headcolor[〈model〉]{〈colorspec〉}<br />

\tlabelcolor[〈model〉]{〈colorspec〉}<br />

\backgroundcolor[〈model〉]{〈colorspec〉}<br />

These macros set the default color for various drawing elements. Any curve (with one exception,<br />

those drawn by \plotdata), whether solid, dashed, dotted, or plotted in symbols, will be in the color<br />

set by \drawcolor. Set the color used by \gfill with \fillcolor. For all the hatching commands<br />

use \hatchcolor. For the \point, and \plotsymbol commands, as well as \gridpoints and<br />

\plrgridpoints, use \pointcolor, and for arrowheads, \headcolor. One can set the color used<br />

by \gclear with \backgroundcolor (the same color will also be used in the interior of unfilled<br />

points that are drawn with \point) and, when mplabels is in effect, the color of labels can be set<br />

with \tlabelcolor.<br />

The optional 〈model〉 may be one of rgb, RGB, cmyk, gray, and named. The 〈colorspec〉 depends<br />

on the model, as outlined below. Each of these commands sets a corresponding METAPOST color<br />

variable with the same name (except \backgroundcolor sets the color named background). Thus,<br />

after drawcolor has been set, one can issue the command \fillcolor{drawcolor} to fill with<br />

the same color.<br />

As previously discussed, all these colors are initially set to black except background is set to<br />

white.<br />

If the optional 〈model〉 argument is omitted, the color specification may be any expression recognized<br />

as a color by METAPOST. It is highly recommended (for portability) that one use either a<br />

predefined name or one of the color functions of the previous section.<br />

When the optional 〈model〉 is specified in the color setting commands, it determines the format<br />

of the color specification as in figure 1.<br />

Model:<br />

rgb<br />

RGB<br />

cmyk<br />

gray<br />

named<br />

Specification:<br />

Three numbers in the range 0 to 1 separated by commas.<br />

Three numbers in the range 0 to 255 separated by commas.<br />

Four numbers in the range 0 to 1 separated by commas.<br />

One number in the range 0 to 1, with 0 indicating black, 1 white.<br />

A METAPOST color variable name either predefined by MFPIC or by the user.<br />

Figure 1: Color specifications

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!