[metapost] rfc: consistent color values

Jens-Uwe Morawski s5d5 at gmx.net
Mon Apr 11 12:01:49 CEST 2005


Am Freitag, den 08.04.2005, 12:24 -0500 schrieb Dan Luecking:
> When
> I examine the color of picture components, I want to see the color it
> would get at shipout.

When a future MP will not truncate the colors at addto stage
you can always check the output color with a simple macro.

vardef pscolorpart text $ =
save _r, _g, _b ;
if (redpart $)>=0:
  if (redpart $)>1: _r := 1 ; else: _r := redpart $ ; fi;
else: _r := 0 ; 
fi;
if (greenpart $)>=0:
  if (greenpart $)>1: _g := 1 ; else: _g := greenpart $ ; fi;
else: _g := 0 ; 
fi;
if (bluepart $)>=0:
  if (bluepart $)>1: _b := 1 ; else: _b := bluepart $ ; fi;
else: _b := 0 ; 
fi;
(_r,_g,_b)
enddef ;

This is IMO better than having two inconsistent color values;
one specified with withcolor and the one truncated in the
picture.

j.



More information about the metapost mailing list