ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans van der Meer <H.vanderMeer@uva.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: cmyk in metapost
Date: Sun, 26 Jun 2011 13:51:23 +0200	[thread overview]
Message-ID: <E745CBE2-661C-4F83-973B-44B864380C7C@uva.nl> (raw)

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).
<to be read again> 
                   ;
<for(0)> 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
___________________________________________________________________________________


             reply	other threads:[~2011-06-26 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-26 11:51 Hans van der Meer [this message]
2011-06-26 12:12 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E745CBE2-661C-4F83-973B-44B864380C7C@uva.nl \
    --to=h.vandermeer@uva.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).