Even-odd rule in Metafun
Revision as of 08:05, 17 December 2020 by JairoAdelRio (talk | contribs) (FInally created the page!)
Metapost doesn't support even-odd rule filling so it uses a fake unfilling via a background color. This is problematic in cases when one deals with e.g. transparency. To overcome this difficulty, Metafun implements some extensions, such as eofill
. To fill a shape using the even-odd rule we need a sequence of nofill
ending with a eofill
statement, as it can be seen in the following examples.
Some examples
%Adapted from Metafun's manual \startMPpage nofill fullsquare scaled 2cm ; nofill fullsquare scaled 2cm shifted (1cm,0) ; eofill fullsquare scaled 2cm shifted (0,1cm) withcolor darkred; \stopMPpage
\startMPpage path A; A := (unitcircle shifted (-center unitcircle)) scaled 4cm; path B; B := (unitcircle shifted (-center unitcircle)) scaled 1cm; path C; C := B shifted (left*1.4cm); nofill A; nofill B; eofill C withcolor darkblue; \stopMPpage