[cairo] render in grayscale
behdad at behdad.org
Tue Sep 22 00:02:12 PDT 2009
On 09/22/2009 03:01 AM, Per Hermansson wrote:
> I'm using cairo to render a GTK+ widget (using gdk_cairo_create). The
> rendering is partially done using an external library routine (which I
> can't change).
> Sometimes I want the widget to be rendered in grayscale.
> Is it possible to modifiy cairo before or after the library has done the
> rendering so that the output appears in gray scale?
You can create an alpha-only temporary surface (cairo_surface_create_similar
with content=CAIRO_CONTENT_ALPHA), render to it, and cairo_mask() that with a
white rgb pattern on a black background.
More information about the cairo