[cairo] Use generated image as pattern inside cairo graphics

Anmol Mishra amish153 at hotmail.com
Mon Jan 27 12:22:40 UTC 2020


<https://stackoverflow.com/posts/59928580/timeline>

I've gone through the cairo graphics examples using patterns.

pattern = cairo_pattern_create_for_surface (image);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);


Now instead of "image" I have a surface with a sequence of :-

cairo_move_to(cr, xc[0], yc[0]);
    for (int i = 0; i < xc.size(); i++)
        cairo_line_to(cr, xc[i], yc[i]);


How do I use this generated cairo surface and use it as input for the pattern ? It does not work if I simply use

pattern = cairo_pattern_create_for_surface (surface); where surface has the cairo_t cr that I used for the generated pattern..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20200127/2292b3e0/attachment.htm>


More information about the cairo mailing list