[metapost] MP docs

Hans Hagen pragma at wxs.nl
Fri May 18 10:41:06 CEST 2007


Stephan Hennig wrote:
> Dan Luecking schrieb:
>
>   
>> When first discussing cmykcolor (section 5.1) mpman says black would
>> be expressed as (1,1,1,1). Perhaps (0,0,0,1) would be better?
>>     
>
> Obviously, the best way to refer to black in cmyk colour space were to
> say 'black'.  Currently, pre-defined constants are missing for all basic
> cmyk colours.  Since 'black' and 'white' are already defined as
> rgbcolors I propose adding the following cmykcolor constants
>
> cyan       = (1,0,0,0)
> magenta    = (0,1,0,0)
> yellow     = (0,0,1,0)
> cmykblack  = <Whatever experts think about this.>
> cmykwhite  = (0,0,0,0)
>
> The user-friendly solution were to have 'black' and 'white' behave as an
> rgbcolor /or/ cmykcolor depending on the context, but I don't know if
> that is possible in MetaPost.
>
>   
no need to specify cmykblack and cmykwhite, more natural is to map black and white on gray scales; postscript rips are supposed to handle this ok 

btw, defining gray/gray is kind of tricky; example code for taco: 

\setupcolors[state=start]

\startMPpage

let graycolor    = numeric ;
let greycolor    = numeric ;
let withanycolor = withcolor ;

rgbcolor  red     ; red        := (1,0,0) ;
rgbcolor  green   ; green      := (0,1,0) ;
rgbcolor  blue    ; blue       := (0,0,1) ;
cmykcolor cyan    ; cyan       := (1,0,0,0) ;
cmykcolor magenta ; magenta    := (0,1,0,0) ;
cmykcolor yellow  ; yellow     := (0,0,1,0) ;
graycolor black   ; black      := 0 ; % (0) ;
graycolor white   ; white      := 1 ; % (1) ;

primarydef p withcolor c =
    p withanycolor (c)
enddef ;

fill fullcircle scaled 10cm withcolor  cyan ;
fill fullcircle scaled  7cm withcolor   red ;
fill fullcircle scaled  4cm withcolor white ;

\stopMPpage

somehow withcolor expects (numeric) but i may do something wrong, if colors always need to be given between parenthesis, then we need a 
graycolor definition primitive 

since it's all a matter of parsing, maybe 

color red   ; red   := (1,0,0) ;
color cyan  ; cyan  := (1,0,0,0) ;
color black ; black := (0) ;

makes sense 


Hans 



-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the metapost mailing list