//camvas-bpath.cpp:181 static void sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) { SPCanvasBPath *cbp = SP_CANVAS_BPATH (item); Geom::Rect area = buf->rect; if ( !cbp->curve || ((cbp->stroke_rgba & 0xff) == 0 && (cbp->fill_rgba & 0xff) == 0 ) || cbp->curve->get_segment_count() < 1) return; if (!buf->ct) return; bool dofill = ((cbp->fill_rgba & 0xff) != 0); bool dostroke = ((cbp->stroke_rgba & 0xff) != 0); cairo_t *first_cr, *second_cr; cairo_surface_t *first, *second; first = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int)buf->rect.width(), (int)buf->rect.height()); sp_canvas_arena_render_surface(SP_CANVAS_ARENA(SP_ACTIVE_DESKTOP->getDrawing()), first, buf->rect); second = cairo_surface_create_similar(cairo_get_target(buf->ct), CAIRO_CONTENT_COLOR_ALPHA, (int)buf->rect.width(), (int)buf->rect.height()); first_cr = cairo_create(first); second_cr = cairo_create(second); cairo_set_tolerance(second_cr, 0.5); cairo_new_path(second_cr); feed_pathvector_to_cairo (second_cr, cbp->curve->get_pathvector(), cbp->affine, area, /* optimized_stroke = */ !dofill, 1); if (dofill) { // RGB / BGR ink_cairo_set_source_rgba32(second_cr, cbp->fill_rgba); cairo_set_fill_rule(second_cr, cbp->fill_rule == SP_WIND_RULE_EVENODD? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); cairo_fill_preserve(second_cr); } if(dostroke) { ink_cairo_set_source_rgba32(second_cr, cbp->stroke_rgba); cairo_set_line_width(second_cr, 1); if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) { cairo_set_dash (second_cr, cbp->dashes, 2, 0); } cairo_stroke(second_cr); } else { cairo_new_path(second_cr); } if (cbp->xor_composite){ cairo_set_operator (first_cr, CAIRO_OPERATOR_XOR); } else { cairo_set_operator (first_cr, CAIRO_OPERATOR_OVER); } cairo_set_source_surface(first_cr, second, 0, 0); cairo_paint(first_cr); cairo_set_source_surface(buf->ct, first, 0, 0); cairo_paint(buf->ct); cairo_surface_destroy(first); cairo_surface_destroy(second); cairo_destroy(first_cr); cairo_destroy(second_cr); }