<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span style="font-weight: bold;">Hi </span><span>cairo</span><span style="font-weight: bold;"> mailing list,</span></div><div><span style="font-weight: bold;">I got a problem, when I use this code :</span></div><div> s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, 480);<br> c=cairo_create(s);<br> p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);<br> cairo_pattern_add_color_stop_rgba(p,0,<span style="color: rgb(255, 0, 0);">1,0</span>,0,1);<br> cairo_pattern_add_color_stop_rgba(<span><span style="background-color: rgb(192, 0, 0);"><span style="background-color: rgb(255, 255, 255);">p,<span
style="background-color: rgb(255, 255, 255);"><span><span>1,<span style="color: rgb(255, 0, 0);">0</span></span></span></span><span style="color: rgb(255, 0, 0);">,1</span>,0,</span><span style="background-color: rgb(255, 255, 255);">1</span></span></span>);<br> cairo_rectangle(c,0,0,640,480);<br> cairo_set_source(c,p);<br> cairo_fill(c);</div><div style="color: rgb(255, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-weight: bold;"><span style="color: rgb(0, 0, 0);">no rectangle is drawn. If I use this one :</span></span><br><span style="color: rgb(0, 0, 0);"> s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, 480);<br>
c=cairo_create(s);<br> p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);<br> cairo_pattern_add_color_stop_rgba(p,0,<span style="color: rgb(255, 0, 0);"><span>1,0</span></span>,0,1);<br> cairo_pattern_add_color_stop_rgba(<span><span style="background-color: rgb(192, 0, 0);"><span style="background-color: rgb(255, 255, 255);">p,<span style="background-color: rgb(255, 255, 255);"><span><span>1,<span style="color: rgb(255, 0, 0);"><span>1</span></span></span></span></span><span style="color: rgb(255, 0, 0);"><span>,0</span></span>,0,</span><span style="background-color: rgb(255, 255, 255);">1</span></span></span>);<br> cairo_rectangle(c,0,0,640,480);<br> cairo_set_source(c,p);<br>
cairo_fill(c);</span></div><span style="color: rgb(255, 0, 0);"><span style="font-weight: bold;"><span style="color: rgb(0, 0, 0);"><span>I got a red rectangle</span></span><span style="color: rgb(0, 0, 0);">.</span></span><span style="color: rgb(0, 0, 0);"><span style="font-weight: bold;"> My code is almost the same that one here :</span> </span></span><a href="http://cairographics.org/samples/gradient/">http://cairographics.org/samples/gradient/</a> <span style="font-weight: bold;">, I tried this :</span><br><span style="color: rgb(0, 0, 0);"> </span>// added by me<br><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"></span> <span style="color: rgb(0, 0, 0);"></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>s=cairo_xlib_surface_create(dpy, wndw.frame,
DefaultVisual(dpy, 0), 640, 480);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>c=cairo_create(s);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>// from the link<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0,
0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_rectangle (c, 0, 0, 256, 256);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_set_source (c, pat);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_fill (c);<br></span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"> </span>cairo_pattern_destroy (pat);<br><span
style="font-weight: bold;">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.<br>So can somebody explains to me what's going on ?<br><br>-Nicoo<br></span></span><br></span><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="color: rgb(0, 0, 0);"></span></div></div></body></html>