You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
4.5 RENDERING FIGURES. 38<br />
The macros of this section can all be used to fill (or unfill) the interior of closed paths, even if<br />
the paths cross themselves. Filling an open curve is technically an error, but the METAFONT code<br />
responds by drawing the path and not doing any filling. Note that these macros override the default<br />
rendering, so if you want some sort of fill pattern and an outline drawn, you need an explicit prefix<br />
for both.<br />
\gfill[〈color〉]...<br />
This rendering macro fills in the subsequent closed path. Under METAPOST it fills with 〈color〉,<br />
which defaults to fillcolor. Under METAFONT it approximates the color with a shade of gray,<br />
clears the interior, and then fills with a pattern of black and white pixels simulating gray.<br />
\gclear...<br />
This rendering macro erases everything inside the subsequent closed path (except text labels<br />
under some circumstances, see section 2.2 and 2.3). Under METAPOST it actually fills with the<br />
predefined color named background. Since background is normally white, and so are most actual<br />
backgrounds, this is usually indistinguishable from clearing. However, if an <strong>mfpic</strong> environment<br />
utilzes background text (see subsection 4.7.1), part of the background text may appear to be ‘erased’.<br />
Unfortunately, there is little that can be done about this.<br />
\gclip...<br />
This rendering macro erases everything outside the subsequent closed path from the picture<br />
(except text labels under some circumstances, see section 2.2 and 2.3). Note that this is a true erasing,<br />
even in METAPOST.<br />
\shade[〈shadesp〉]...<br />
This rendering macro shades the interior of the subsequent closed path with dots. The diameter<br />
of the dots is the METAFONT variable shadewd, set by the macro \shadewd{〈size〉}. Normally<br />
this is 0.5bp. The optional argument specifies the spacing between (the centers of) the dots, which<br />
defaults to the TEX dimension \shadespace, initially 1pt. If shadewd is larger than \shadespace,<br />
the closed path is filled with black, as if with \gfill. Under METAPOST this macro actually fills<br />
the path’s interior with a shade of gray. The shade to use is computed based on \shadespace and<br />
shadewd. The default values of these parameters correspond to a gray level of about 78% of white. 14<br />
The METAFONT version attempts to optimize the dots to the pixel grid corresponding to the printers<br />
resolution (to avoid generating dither lines). Because this involves rounding, it will happen that<br />
values of \shadespace that are relatively close and at the same time close to shadewd produce<br />
exactly the same shade. Most of the time, however, values of \shadespace that differ by at least<br />
20% will produce different patterns. The actual behavior for particular values of the parameters and<br />
particular printer resolutions cannot be predicted, and we even make no guarantee it will not change<br />
from one version of MFPIC to another.<br />
\polkadot[〈space〉]...<br />
This rendering macro fills the interior of a closed path with large dots. This is almost what<br />
\shade does, but there are several differences. \shade is intended solely to simulate a gray fill in<br />
METAFONT where the only color is black. So it is optimized for small dots aligned to the pixel grid<br />
(in METAFONT). In METAPOST \shade only fills with gray and is intended merely for compatibility.<br />
The macro \polkadot is intended for large dots in any color, and so it optimizes spacing (a nice<br />
hexagonal array) and makes no attempt to align at the pixel level. The 〈space〉 defaults to the TEX<br />
14 If \shadewd is w and \shadespace is s, then the level of gray is 1 − (.88w/s) 2 , where 0 denotes black and 1 white.