[metapost] defaultcolormodel
Dan Luecking
luecking at uark.edu
Fri Jul 8 18:34:36 CEST 2011
Stephan Hennig wrote:
> I'm not a regular MetaFont user, but I do
> know that MetaFont doesn't have a 'withcolor' primitive. Do I figure
> correctly, that the weights indicate to what extend the area of a pixel
> has been covered by the pen?
There is also a withweight primitive.
draw ... withweight -2;
will add pixel weights -2 (or -3 if some pixels are covered
more than once) to currentpicture.
Weights, however do not translate very well to metapost colors.
Adding one picture to another means adding weights algebraically
(for which there is no MP analog). So basically one needs to cull
(a MF primitive) ones pictures so that weights are 0 or 1. Then
drawing something withweight 1 (the default) adds it, and drawing
withweight -1 subtracts it (but may leave negative pixels which
would probably require another cull).
In mfpic and its MF support file grafbase.mf I support grayscale
colors by translating a numeric into a patter of pixels to add
to a region (simulating a gray fill. Using weights was simply
not a useful option.
Dan
Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html
More information about the metapost
mailing list