Re: (no subject)
Andrea Canciani <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAN_5=BA2MjgDypqT0KSY1s0Nxjkq5U+r_jz4C-+WbucgzEOV5Q@mail.gmail.com> |
On Fri, Jul 10, 2015 at 4:21 PM, Roman Goldov <[email protected]> wrote: > I am a new user of GTK+ and of Cairo. That is why I would appreciate > detailed answers for my questions. > > From the manual: > "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()." > > do i understand corerectly that this function is a general function - that > is it says only to create a linear gradient > between (x0,y0) and (x1,y1) points, and the colors are defined by, for > example, cairo_pattern_add_color_stop_rgb() > function ? > Yes, the cairo_pattern_create_linear() function creates a pattern whose colors are chosen calling cairo_pattern_add_color_stop_rgb[a](). 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. The color stops define the color in the [0,1] range. For values outside of the [0,1] range, a extend mode is applied http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-extend-t. > > cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, double offset, > double red, double green, double blue) - > whst does "offset" mean in terms of the colors? is it a number ? in which > range it is varied ? > The extremes (x0,y0) and (x1,y1) are respectively at offset 0 and 1. I hope this helps you (we should definitely improve the documentation, suggestions and patches are welcome ;) ). Andrea > > Thank you. > -- > cairo mailing list > [email protected] > http://lists.cairographics.org/mailman/listinfo/cairo -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo