[cairo] shader program in cairo graphics?

Simon Sapin simon.sapin at exyr.org
Mon May 27 23:39:47 PDT 2013


Le 28/05/2013 14:16, Jeong-Joon Yoo a écrit :
> Hi all,
> I have a question whether there is, in cairo graphics, a function like a
> shader program shown in 3D graphics.
> I hope to fill a polygon with some colors, and I hope to define the
> color as a function depending on the (x, y) position.
> Is there any cairo API or data structure related with this
> functionality? or any examples? Any comment will be appreciated.

Hi,

In cairo, filling uses a *pattern* as a source. Look at the different 
pattern types, in particular gradient and mesh patterns:

http://cairographics.org/manual/cairo-cairo-pattern-t.html

Of course, these can not encode any arbitrary function of (x, y) to 
color. Are you looking for something more specific?

Cheers,
-- 
Simon Sapin


More information about the cairo mailing list