[metapost] CMYK colours in SVG output
Taco Hoekwater
taco at elvenkind.com
Fri Jul 8 10:21:27 CEST 2011
On 07/07/2011 07:44 PM, Stephan Hennig wrote:
> Hi,
>
> the following code uses a CMYK colour while generating SVG output.
> MetaPost seems to be nice and silently convert that into an RGB colour.
>
> outputformat := "svg";
> beginfig(1);
> draw fullcircle withcmykcolor (.1,.2,.3,.4);
> endfig;
> end
>
> To be honest, I'd expect MetaPost to error out on colouring objects with
> colours from a colour model that isn't supported by the output format.
Metapost has a long tradition of implied built in color conversions
(like auto-mapping of rgb to greyscale if r=g=b), so in that sense this
behaviour is not extraordinary at all.
> Isn't such use-case better be dealt with at the macro level than on the
> engine level, i.e., by providing a macro that does the conversion?
An error may be the wisest solution. Allowing users to mess with this
bit is not the best of ideas, at least not until (when/if) there will
be a lua extension interface to metapost.
> Implicit conversion seems wrong to me. Are the conversion rules
> documented somewhere? Can they be configured by the user?
No and no. For now, there is a very simple solution, though: do not use
cmyk color with svg output (also, if you create svg, I think you should
know already that it does not support cmyk).
Best wishes,
Taco
More information about the metapost
mailing list