[cairo] basic cairo masking

Donn donn.ingle at gmail.com
Tue Nov 6 04:11:00 PST 2007


Hi. 
I have been trying to get this snippet from the cairo tutorial to work, but 
having no luck so far. I wrap it in gtk voodoo to open a window. I know it's 
working generally because I drew a red box, just to test, but this on it's 
own displays nothing at all:
     
        self.linear = cairo.LinearGradient(0, 0, 1, 1)
        self.linear.add_color_stop_rgb(0, 0, 0.3, 0.8)
        self.linear.add_color_stop_rgb(1, 0, 0.8, 0.3)

        self.radial = cairo.RadialGradient(0.5, 0.5, 0.25, 0.5, 0.5, 0.5)
        self.radial.add_color_stop_rgba(0, 0, 0, 0, 1)
        self.radial.add_color_stop_rgba(0.5, 0, 0, 0, 0)

        cr.set_source(self.linear)
        cr.mask(self.radial)

What am I missing?

I did fetch the demo code but it's too convoluted for quick apprehension of 
the basics.

\d


More information about the cairo mailing list