<div dir="ltr">I would also refer to any html5 canvas tutorial in this case, I think there is no real difference between cairo gradients and <canvas> gradients.<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 10, 2015 at 6:54 PM, Andrea Canciani <span dir="ltr"><<a href="mailto:ranma42@gmail.com" target="_blank">ranma42@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">On Fri, Jul 10, 2015 at 4:21 PM, Roman Goldov <span dir="ltr"><<a href="mailto:goldov1@yandex.ru" target="_blank">goldov1@yandex.ru</a>></span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am a new user of GTK+ and of Cairo. That is why I would appreciate detailed answers for my questions.<br>
<br>
>From the manual:<br>
"cairo_pattern_create_linear(x0,y0,x1,y1) -  Before using the gradient pattern, a number of color stops should be defined using cairo_pattern_add_color_stop_rgb() or cairo_pattern_add_color_stop_rgba()."<br>
<br>
do i understand corerectly that this function is a general function - that is it says only to create a linear gradient<br>
between (x0,y0) and (x1,y1) points, and the colors are defined by, for example, cairo_pattern_add_color_stop_rgb()<br>
function ?<br></blockquote><div><br></div></span><div>Yes, the cairo_pattern_create_linear() function creates a pattern whose colors are chosen calling cairo_pattern_add_color_stop_rgb[a]().<br></div><div>The linear gradient is obtained by projecting all of the points of the plane (or, equivalently, by looking for the nearest point) to the (infinite) line passing through (x0,y0) and (x1,y1). Each of these point is associated with a parameter which varies from 0 to 1 along the segment that defines the line.<br></div><div>The color stops define the color in the [0,1] range.<br></div><div>For values outside of the [0,1] range, a extend mode is applied <a href="http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-extend-t" target="_blank">http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-extend-t</a>.<br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, double offset, double red, double green, double blue) -<br>
whst does "offset" mean in terms of the colors? is it a number ? in which range it is varied ?<br></blockquote><div><br></div></span><div>The extremes (x0,y0) and (x1,y1) are respectively at offset 0 and 1.<br><br></div><div>I hope this helps you (we should definitely improve the documentation, suggestions and patches are welcome ;) ).<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Andrea<br></div></font></span><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thank you.<br>
<span><font color="#888888">--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a></font></span></blockquote></span></div><br></div></div>
<br>--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br></blockquote></div><br></div></div>