[NTG-context] MetaPost circular_shade Command

Troy Henderson thenders at gmail.com
Thu May 3 00:41:35 CEST 2012


The command

circular_shade(fullcircle scaled 4in,0,white,red);

in MetaPost does not act as I think it should.  It performs a gradient fill
starting at the center of the circle by filling this center in white (which
is expected), and changing the color as the radius/diameter changes (which
is also expected), but the final radius appears to have a RGB color of
about (1,0.29,0.29) which is not red (thus is unexpected) since red =
(1,0,0).  However, the command

circular_shade(unitsquare shifted (-0.5,-0.5) scaled 4in,0,white,red);

creates a gradient filled square whose center is white and whose northeast,
northwest, southwest, and southeast corner are red (as somewhat expected)
and thus whose east, north, west, and south tip are about (1,0.29,0.29)
like the circle.

I would appreciate an explanation of why this acts like it does, and (more
importantly), let me know how I can get a gradient filled circle whose
center gets filled with a RGB color c and outer radius color d.  Clearly,

circular_shade(fullcircle scaled 4in,0,c,d);

does not do this.

Thanks in advance,

Troy Henderson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20120502/dab207bf/attachment.html>


More information about the ntg-context mailing list