cairo_surface_t *input = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int)buf->rect.width(), (int)buf->rect.height());
cairo_t *ct = cairo_create(input);
cairo_set_source_rgba (ct, 1, 1, 1, 0);
cairo_paint(ct);
Geom::Rect area = buf->rect;
//Gap translate to visual view is working
area *= Geom::Translate(Geom::Point(20,10));
//custom function that render Inkscape rect as cairo surface
//Is working because I see the down image translated by area gap
sp_canvas_arena_render_surface(SP_CANVAS_ARENA(SP_ACTIVE_DESKTOP->getDrawing()), input, area.roundOutwards());
cairo_set_source_surface(ct, input, 0, 0);
cairo_paint(ct);
cairo_set_operator(ct, CAIRO_OPERATOR_XOR);
cairo_rectangle (ct, 40, 30, 120, 90);
cairo_set_source_rgba (ct, 0, 0, 0.9, 0.4);
cairo_fill_preserve(ct);
cairo_set_source_rgba (buf->ct, 1, 1, 1, 0);
cairo_paint(buf->ct);
cairo_set_source_surface(buf->ct, cairo_get_target(ct), 0, 0);
cairo_paint(buf->ct);
-
Please log in to leave a comment!