[metapost] rfc: consistent color values

Taco Hoekwater taco at elvenkind.com
Fri Apr 8 14:39:56 CEST 2005


Hi,

Hans Hagen wrote:
> Jens-Uwe Morawski wrote:
> 
>> Hello
>>
>> Since Taco told about a MP 1.0 release later this year, IMO
>> the following problem should be discussed before.
>>
>> In the example below you can see that MP replaces
>> silently all negative color values with 0.

First, to make sure Hans is not misinterpreting the report:
this replacement happens at the 'addto' stage, not earlier,
so Hans' example:

   color diminish ; diminish := (-.5,-.2,.-3) ;
    ... withcolor (red+diminish);

works ok, it would report:

   >> (0.5,0,0)

This also works:

   color diminished; diminished = (red+diminish);
   show diminished;

gives

   >> (0.5,-0.2,-3)


There is only a problem when one tries to access the
colors within an already drawn picture, not when there
is still a 'color type'.


>> IMO MP should either disallow negative color values
>> (err message) or should not change the values
>> to 0 as long as the values are accessible on macro level
>> (before shipout).

It looks like this can be classified as an oversight (bug),
because the documented behaviour is:

"... all components are snapped back to the [0, 1] range
      when a color is given in a PostScript output file."

so clearly the picture iteration should have reported the
values with their negative components still intact.

>> Is this possible to change? Makes it sense?

I believe this is a bug (because the actual documentation makes
no mention of picture variables), so I think a fix is needed.

I will add this to the bug database, to be fixed for v1.0.

Thanks for the report,

Taco



More information about the metapost mailing list