[cairo] Drawing a multicolor spline

Andrea Canciani ranma42 at gmail.com
Fri Apr 27 00:45:11 PDT 2012


On Wed, Apr 25, 2012 at 8:35 PM, Davide Calaminici <amiblit at gmail.com> wrote:
> Hello,
>
> i'm trying to learn cairo graphics doing some test here and there.
>
> I want to draw a spline or bezier, simulating a Windows screen saver like
> Mistify or Ribbons.
> Anyone have a simple sample code in c for this?

Some sample code on how to draw Bezier curves can be found here:
http://cairographics.org/samples/curve_to/

If you want the spline to be multicolor, you will need to draw it with
a source that is not solid black, but some kind of pattern.


A different approach might be that of painting a gradient mesh pattern
(possibly without even using a mask).
Sample code can be found here:
http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-pattern-create-mesh

Andrea

>
> Thank you very much
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list