Geom::Point sp_desktop_dt2root_xy_point(SPDesktop const *dt, Geom::Point const p) { return p * sp_desktop_dt2root_affine(dt); }
static void spdc_flush_white (SPDrawContext *dc, SPCurve *gc) { SPCurve *c; if (dc->white_curves) { g_assert (dc->white_item); c = sp_curve_concat (dc->white_curves); g_slist_free (dc->white_curves); dc->white_curves = NULL; if (gc) { sp_curve_append (c, gc, FALSE); } } else if (gc) { c = gc; sp_curve_ref (c); } else { return; } /* Now we have to go back to item coordinates at last */ if (dc->white_item) { NRMatrixD d2itemd; sp_item_dt2i_affine_d (dc->white_item, SP_EVENT_CONTEXT_DESKTOP (dc), &d2itemd); c = sp_curve_transform (c, NR_MATRIX_D_TO_DOUBLE (&d2itemd)); } else { gdouble d2item[6]; sp_desktop_dt2root_affine (SP_EVENT_CONTEXT_DESKTOP (dc), (NRMatrixD *) d2item); c = sp_curve_transform (c, d2item); } if (c && !sp_curve_empty (c)) { SPDesktop *dt; SPDocument *doc; SPRepr *repr; gchar *str; /* We actually have something to write */ dt = SP_EVENT_CONTEXT_DESKTOP (dc); doc = SP_DT_DOCUMENT (dt); if (dc->white_item) { repr = SP_OBJECT_REPR (dc->white_item); } else { SPRepr *style; repr = sp_repr_new ("path"); /* fixme: Pen and pencil need separate style (Lauris) */ style = inkscape_get_repr (INKSCAPE, "tools.freehand"); if (style) { SPCSSAttr *css; css = sp_repr_css_attr_inherited (style, "style"); sp_repr_css_set (repr, css, "style"); sp_repr_css_attr_unref (css); } } str = sp_svg_write_path (SP_CURVE_BPATH (c)); g_assert (str != NULL); sp_repr_set_attr (repr, "d", str); g_free (str); if (!dc->white_item) { /* Attach repr */ sp_document_add_repr (SP_DT_DOCUMENT (dt), repr); sp_selection_set_repr (dc->selection, repr); sp_repr_unref (repr); } sp_document_done (doc); } sp_curve_unref (c); /* Flush pending updates */ sp_document_ensure_up_to_date (SP_DT_DOCUMENT (SP_EVENT_CONTEXT_DESKTOP (dc))); }