[cairo] cairo + brush

rndfax rndfax at yandex.ru
Tue Apr 29 10:52:27 PDT 2014


Hello, everyone!

I want to make brush with custom RGBA template and cairo looks pretty tasty for this.
But I want some specific functions which I haven't figured out yet how to implement it using cairo.

Here is example code:
...
        brush = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, w, h, s);
        surface = cairo_image_surface_create_for_data(datas, CAIRO_FORMAT_ARGB32, ws, hs, ss);

        cr = cairo_create(surface);

        cairo_set_source_surface(cr, brush, 0.5, 77.3);
        cairo_paint(cr);

        cairo_destroy(cr);
...

Questions.

1) Can cairo composite two surfaces like glBlendEquation(GL_MAX) (e.g. result_alpha = max(source_alpha, dest_alpha), result_color = max(source_color, dest_color))?
Can this be somehow reached maybe with alternative ways?

2) Can cairo draw surface along the line so that it is looked like brush stroke?
Or I should process my own line and call cairo_set_source_surface(cr, p, x, y) + cairo_paint(cr) on every point I want?


More information about the cairo mailing list