Re: Forcing black and white or grayscale

Lawrence D'Oliveiro <[email protected]>
Newsgroups gmane.comp.lib.cairo
Organization Geek Central
Message-ID <[email protected]>
On Fri, 22 Apr 2016 18:26:21 +0000 (UTC), Michele Cleary wrote:

> Does anyoneknow how to use cairo to force a job to be black and white
> or grayscale?

It’s quite simple:

1) Draw the full-colour image into the destination image surface
2) Set a source colour RGB = (255, 255, 255) and transfer mode
CAIRO_OPERATOR_HSL_COLOR <http://cairographics.org/operators/#hsl_color>
3) Paint this source all over the destination image surface. That will
replace the hue and saturation (in particular, set the saturation to
zero), leaving the greyscale intensities unchanged.
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.