Re: [NTG-context] cmyk in metapost

2011-06-26 Thread Hans Hagen

On 26-6-2011 1:51, Hans van der Meer wrote:

I must be doing something wrong. But what?

Relevant part of Metapost code:

I got the code from the Metafun manual. Beta from ConTeXt  ver: 2011.03.28 
01:03 MKIV download.
Something obvious I am overlooking?


cmykcolor is another datatype in mp than color


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] cmyk in metapost

2011-06-26 Thread Hans van der Meer
I must be doing something wrong. But what?

Relevant part of Metapost code:

numeric Cb, Cr, Y, T, temp, graycolors;
Cb := 0; Cr := 1; Y = 2; T := 3; graycolors := 15;
numeric colors[][];for i = 0 upto graycolors:
temp := (graycolors - i) / graycolors;
colors[i][Cb] := temp; colors[i][Cr] := temp; colors[i][Y]  := temp; 
colors[i][T]  := 0;
endfor
def colorvalue(expr v) =
cmyk(colors[v][Cb], colors[v][Cr], colors[v][Y], colors[v][T])
enddef;
for i = 0 upto 15:
mycmyk[i] := colorvalue(i);
endfor
Used with drawdot... withcolor mycymk[index];

The error from metapost is in the generation of the cmyk colors:
! terminal: >> (redpart mycmyk0,greenpart mycmyk0,bluepart mycmyk0)
>> (1,1,1,0)
! Equation cannot be performed (color=cmykcolor).
 
   ;
 mycmyk[(EXPR0)]:=colorvalue((EXPR0));
   ENDFOR
startsubtitle->...:mycmyk[i]:=colorvalue(i);endfor
 
Strangely the following does work without problems:
drawdot... withcolor colorvalue(index);

I got the code from the Metafun manual. Beta from ConTeXt  ver: 2011.03.28 
01:03 MKIV download.
Something obvious I am overlooking?

Hans van der Meer
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___