[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    problem with my uses of the gradient.
From:       First Last <begre1929 () yahoo ! com>
Date:       2013-05-26 20:18:42
Message-ID: 1369599522.78809.YahooMailNeo () web164904 ! mail ! bf1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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


[Attachment #5 (text/html)]

<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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
s=cairo_xlib_surface_create(dpy, wndw.frame, DefaultVisual(dpy, 0), 640, \
480);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
c=cairo_create(s);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_pattern_add_color_stop_rgba(p,0,<span style="color: rgb(255, 0, \
0);">1,0</span>,0,1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_rectangle(c,0,0,640,480);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_set_source(c,p);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s=cairo_xlib_surface_create(dpy, \
wndw.frame, DefaultVisual(dpy, 0), 640, \
480);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
c=cairo_create(s);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
p=cairo_pattern_create_linear(10.10,0.10,0.0,450.0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_pattern_add_color_stop_rgba(p,0,<span style="color: rgb(255, 0, \
0);"><span>1,0</span></span>,0,1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_rectangle(c,0,0,640,480);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cairo_set_source(c,p);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span>pat = cairo_pattern_create_linear (0.0, 0.0,&nbsp; 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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</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>



_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: freedesktop-xorg@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic