problem with my uses of the gradient.

First Last begre1929 at yahoo.com
Sun May 26 13:18:42 PDT 2013


Hi cairomailing list,
I got a problem, when I use this code :
        s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, 480);
        c=cairo_create(s);
        p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);
        cairo_pattern_add_color_stop_rgba(p,0,1,0,0,1);
        cairo_pattern_add_color_stop_rgba(p,1,0,1,0,1);
        cairo_rectangle(c,0,0,640,480);
        cairo_set_source(c,p);
        cairo_fill(c);
no rectangle is drawn. If I use this one :
        s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, 480);
        c=cairo_create(s);
        p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);
        cairo_pattern_add_color_stop_rgba(p,0,1,0,0,1);
        cairo_pattern_add_color_stop_rgba(p,1,1,0,0,1);
        cairo_rectangle(c,0,0,640,480);
        cairo_set_source(c,p);
        cairo_fill(c);I got a red rectangle.My code is almost the same that one here : http://cairographics.org/samples/gradient/ , I tried this :
        // added by me
         s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, 480);
        c=cairo_create(s);
        // from the link
        pat = cairo_pattern_create_linear (0.0, 0.0,  0.0, 256.0);
        cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
        cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
        cairo_rectangle (c, 0, 0, 256, 256);
        cairo_set_source (c, pat);
        cairo_fill (c);
        cairo_pattern_destroy (pat);
no rectangle is drawn. And like before, if I use the code just above with two times the same RGBA as patern ,I got a rectangle.
So can somebody explains to me what's going on ?

-Nicoo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20130526/b60666f1/attachment.html>


More information about the xorg mailing list