[metapost] defaultcolormodel

Karel akk64 at quick.cz
Fri Jul 8 13:18:14 CEST 2011


luigi scarso napsal(a):
> 2011/7/8 Karel <akk64 at quick.cz>:
>> Taco Hoekwater napsal(a):
>>> On 07/08/2011 12:01 AM, Stephan Hennig wrote:
>>>> Hi,
>>>>
>>>> I'm wondering what the meaning of variable defaultcolormodel is.  The
>>>> manual is rather terse (p.28):
>>>>
>>>>   The ‘current default’ color model can be set up using the internal
>>>>   variable defaultcolormodel.  Table 2 lists the valid values.
>>>>
>>>> Well, variable defaultcolormodel determines the colour space of the
>>>> black ink that is used for drawing and filling strokes, i.e., whether 0,
>>>> (0,0,0) or (0,0,0,1) is written into the output.
>>> Yes.
>>>
>> I think it is not the case. I tried
>>
>> defaultcolormodel:=3;
>>
>> beginfig(0);
>> defaultcolormodel:=3;
>> draw fullcircle scaled 10mm withcolor .5white;
>> endfig;
>>
>> and the resulting color in the output is in rgb!
>> One has firstly redefine white and background as numeric... or write only
>>
>> withcolor.5;
>>
>> Karel Horak
>>
>> --
>> http://tug.org/metapost/
> 
> How is white defined ?
> if
> white = (1,1,1);
> then 0.5white is rgb
> 
Of course, this is the way the white is predefined in plain.mp.
And one also has to keep in mind that white is there declared as 
color (=rgbcolor) as it was written down before wonderful times 
with cmykcolors:-)

Some time ago I have spent some time to overcome the default 
settings and found it to be not so easy. Finally I came to the 
following solution (I wanted to compile also the older files 
without rgb colours and without editing them to much):

def white= (1) enddef;
def background= (1) enddef;
def black= (0) enddef;

Karel Horak



More information about the metapost mailing list