summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe9eeff)
raw | patch | inline | side by side (parent: fe9eeff)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 8 Aug 2008 17:32:43 +0000 (17:32 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 8 Aug 2008 17:32:43 +0000 (17:32 +0000) |
75 files changed:
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 322334dbdd9e00dee1f4f0f0d61d650bb075409e..f3e46e02913e07cf65b1d7609a480fd3f532aa7b 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
NR::Point c = r.midpoint();
if (!ctrl_save) {
if (fabs(dir[NR::X]) > 1E-6 && fabs(dir[NR::Y]) > 1E-6) {
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (ac->item)));
+ NR::Matrix const i2d (sp_item_i2d_affine (ac->item));
NR::Point new_dir = pt * i2d - c;
new_dir[NR::X] *= dir[NR::Y] / dir[NR::X];
double lambda = NR::L2(new_dir) / dir[NR::Y];
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 3c972063dbefde6c0cfd1ce4d93abec94762f1b3..a517ea0a2cbb7c669eb6038c02909595764f5ca5 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
if (!box3d_get_perspective(box)) {
return NR::Point (NR_HUGE, NR_HUGE);
}
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (SP_ITEM(box))));
+ NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
if (item_coords) {
return box3d_get_perspective(box)->tmat.image(proj_corner).affine() * i2d.inverse();
} else {
if (!box3d_get_perspective(box)) {
return NR::Point (NR_HUGE, NR_HUGE);
}
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (SP_ITEM(box))));
+ NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
return box3d_get_perspective(box)->tmat.image(proj_center).affine() * i2d.inverse();
}
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 2eb1f441e015978b6f6f4de45c89e80c853a1b92..a64708332c5b7847a4b52a4ed51d4904262466a8 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(item->document);
- boost::optional<NR::Rect> rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> rHull = item->getBounds(sp_item_i2doc_affine(item));
if (!rHull) {
return Avoid::newPoly(0);
}
index 871110275301960662239afb9a41828e16fa84c4..d58c8a871e1dc26e698682ccf3432ec18347acfb 100644 (file)
@@ -613,7 +613,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
SPDesktop *const dt = cc->desktop;
/* Find desktop coordinates */
- Geom::Point p = to_2geom(dt->w2d(event_w));
+ Geom::Point p = dt->w2d(event_w);
switch (cc->state) {
case SP_CONNECTOR_CONTEXT_DRAGGING:
@@ -622,7 +622,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
if ( cc->npoints > 0 ) {
cc->selection->clear();
- spcc_connector_set_subsequent_point(cc, from_2geom(p));
+ spcc_connector_set_subsequent_point(cc, p);
ret = TRUE;
}
break;
@@ -637,11 +637,11 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
SPPath *path = SP_PATH(cc->clickeditem);
SPCurve *curve = (SP_SHAPE(path))->curve;
if (cc->clickedhandle == cc->endpt_handle[0]) {
- Geom::Point o = to_2geom(cc->endpt_handle[1]->pos);
+ Geom::Point o = cc->endpt_handle[1]->pos;
curve->stretch_endpoints(p * d2i, o * d2i);
}
else {
- Geom::Point o = to_2geom(cc->endpt_handle[0]->pos);
+ Geom::Point o = cc->endpt_handle[0]->pos;
curve->stretch_endpoints(o * d2i, p * d2i);
}
sp_conn_adjust_path(path);
@@ -857,7 +857,7 @@ spcc_connector_set_subsequent_point(SPConnectorContext *const cc, NR::Point cons
NR::Point p(route.ps[i].x, route.ps[i].y);
cc->red_curve->lineto(p);
}
- cc->red_curve->transform(to_2geom(dt->doc2dt()));
+ cc->red_curve->transform(dt->doc2dt());
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
}
}
/* Now we have to go back to item coordinates at last */
- c->transform(to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc))));
+ c->transform(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)));
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
SPDocument *doc = sp_desktop_document(desktop);
cc->newconn = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
cc->selection->set(repr);
Inkscape::GC::release(repr);
- cc->newconn->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer()));
+ cc->newconn->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
cc->newconn->updateRepr();
bool connection = false;
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 5eaa902fd380cd46945dc724bfe21aa729c7d9a7..b8af828ad4b58edc62deae647e0594cc008ce23e 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
// Scale the style by the inverse of the accumulated parent transform in the paste context.
{
- NR::Matrix const local(from_2geom(sp_item_i2doc_affine(SP_ITEM(o))));
+ NR::Matrix const local(sp_item_i2doc_affine(SP_ITEM(o)));
double const ex(NR::expansion(local));
if ( ( ex != 0. )
&& ( ex != 1. ) ) {
if (!SP_IS_ITEM (l->data))
continue;
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(l->data)));
+ NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(l->data));
SPObject *object = SP_OBJECT(l->data);
n_stroked ++;
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(obj)));
+ NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
double sw = style->stroke_width.computed * NR::expansion(i2d);
if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3)
if (!style) continue;
texts ++;
- size += style->font_size.computed * NR::expansion(from_2geom(sp_item_i2d_affine(SP_ITEM(obj)))); /// \todo FIXME: we assume non-% units here
+ size += style->font_size.computed * NR::expansion(sp_item_i2d_affine(SP_ITEM(obj))); /// \todo FIXME: we assume non-% units here
if (style->letter_spacing.normal) {
if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing))
if (!style) continue;
if (!SP_IS_ITEM(obj)) continue;
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(obj)));
+ NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
items ++;
index 07b146fca23e7c84c99faa3b7185ca1d81c0f511..048635bb97cca014489778b7cc5aa2e08f3ebacc 100644 (file)
int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- boost::optional<NR::Rect> r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))),
+ boost::optional<NR::Rect> r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)),
bbox_type);
if (r) {
w = r->dimensions()[NR::X];
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index bd4493eaeddb14445b0475ddbee16c2ecb79c7a3..ddf62f371f84c811ccc2055017b3cc4e7d0b71d8 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
}
NRRect area;
- sp_item_invoke_bbox(item, &area, from_2geom(sp_item_i2r_affine((SPItem *) item)), TRUE);
+ sp_item_invoke_bbox(item, &area, sp_item_i2r_affine((SPItem *) item), TRUE);
gint width = (gint) ((area.x1 - area.x0) * dpi / PX_PER_IN + 0.5);
gint height = (gint) ((area.y1 - area.y0) * dpi / PX_PER_IN + 0.5);
index ae387e5f84e6a2f004cf08813f3c7daca3a5e91c..373ee5832e43583ea01fd3c8b74df06092da6077 100644 (file)
// Find object's bbox in document
Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- boost::optional<NR::Rect> dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc));
+ boost::optional<NR::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
if (!dbox) {
return NULL;
index f9bde3c0b18bf5cabd4aa5f9fe6e26ee489f0a75..63732df0bcca4618105cca08b084663d9eb4dd30 100644 (file)
using NR::X;
using NR::Y;
- boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
- boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
+ boost::optional<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
+ boost::optional<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
if ( !a || !b ) {
// FIXME?
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
- boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
+ boost::optional<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
+ boost::optional<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
if ( !a || !b ) {
// FIXME?
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
if (!b) {
continue;
}
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
if (b) {
width = b->dimensions()[NR::X];
height = b->dimensions()[NR::Y];
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
NR::Point min;
if (b) {
width = b->dimensions()[NR::X];
// signs are inverted between x and y due to y inversion
NR::Point move = NR::Point(new_x - min[NR::X], min[NR::Y] - new_y);
- NR::Matrix const &affine = NR::Matrix(NR::translate(move));
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
+ Geom::Matrix const affine = Geom::Matrix(Geom::Translate(move));
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
sp_item_write_transform(item, repr, item->transform, NULL);
SP_OBJECT (current_row->data)->updateRepr();
cnt +=1;
index 923c44addcb49a5c82038ecfc4b7865f358bfc4a..77c18aa64c91cf751b5ac439c1f87bb50d8acfae 100644 (file)
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
return i->second;
}
- boost::optional<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
if (r) {
NR::Point const c = r->midpoint();
c_cache[SP_OBJECT_ID(item)] = c;
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- boost::optional<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
if (r) {
wh = r->dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
NR::Point p = unclump_center (from);
NR::Point by = dist * NR::unit_vector (- (p - it));
- NR::Matrix move = NR::Matrix (NR::translate (by));
+ Geom::Matrix move = Geom::Translate (by);
std::map<const gchar *, NR::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
if ( i != c_cache.end() ) {
//g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist);
- sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move));
+ sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
}
NR::Point p = unclump_center (to);
NR::Point by = dist * NR::unit_vector (p - it);
- NR::Matrix move = NR::Matrix (NR::translate (by));
+ Geom::Matrix move = Geom::Translate (by);
std::map<const gchar *, NR::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
if ( i != c_cache.end() ) {
//g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist);
- sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move));
+ sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
}
index 5f1262ced61a726eb6a30869da20e77d5c42ad8a..0daf6e69a2248216488022fe7388083ca7b94c6a 100644 (file)
@@ -144,7 +144,7 @@ sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
cbp->affine = affine;
- Geom::Rect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), to_2geom(affine));
+ Geom::Rect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), affine);
item->x1 = (int)bbox.min()[Geom::X] - 1;
item->y1 = (int)bbox.min()[Geom::Y] - 1;
cairo_new_path(buf->ct);
if (!dofill)
- feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), to_2geom(cbp->affine), area, true, 1);
+ feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, true, 1);
else
- feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), to_2geom(cbp->affine), area, false, 1);
+ feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, false, 1);
if (dofill) {
// RGB / BGR
@@ -218,7 +218,7 @@ sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_it
Geom::Rect viewbox = to_2geom(item->canvas->getViewbox());
viewbox.expandBy (width);
double dist = NR_HUGE;
- pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), to_2geom(cbp->affine), to_2geom(p), NULL, NULL, &dist, 0.5, &viewbox);
+ pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox);
if (dist <= 1.0) {
*actual_item = item;
index 33a84d5086edff59e678f11a0ce1cba51c90c2a6..4895418f0fe3d47053945ea13d3fbffe69879a19 100644 (file)
@@ -178,10 +178,10 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, boo
return;
// Transform all coordinates to coords within "area"
- Geom::Point shift = to_2geom(area->min());
+ Geom::Point shift = area->min();
NR::Rect view = *area;
view.growBy (stroke_width);
- view = view * from_2geom(Geom::Translate(-shift));
+ view = view * (NR::Matrix)Geom::Translate(-shift);
// Pass transformation to feed_curve, so that we don't need to create a whole new path.
Geom::Matrix transshift(trans * Geom::Translate(-shift));
index a1a14ef1a8583cc6decf783cbd44ff35e86a7594..0216fe4f96f53e8f8a354f716320b47ac1c6cb76 100644 (file)
@@ -465,7 +465,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
Geom::PathVector const * pathv = g->font->PathVector(g->glyph);
cairo_new_path(ct);
- Geom::Matrix transform = to_2geom(g->g_transform * group->ctm);
+ Geom::Matrix transform = g->g_transform * group->ctm;
feed_pathvector_to_cairo (ct, *pathv, transform, (pb->area).upgrade(), false, 0);
cairo_fill(ct);
pb->empty = FALSE;
index 60795becf7f2b42350161e65b23683eaa20c5b32..554ea2dc9d67477a0677775d88962b07cba1bef4 100644 (file)
@@ -255,7 +255,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
shape->ctm = gc->transform;
if (state & NR_ARENA_ITEM_STATE_BBOX) {
if (shape->curve) {
- boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform));
+ boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform);
item->bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F);
item->bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
item->bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F);
@@ -278,7 +278,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (shape->curve) {
- boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform));
+ boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform);
if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE || outline) {
float width, scale;
@@ -465,7 +465,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo
Path* thePath=new Path;
Shape* theShape=new Shape;
{
- Geom::Matrix tempMat(to_2geom(gc->transform));
+ Geom::Matrix tempMat(gc->transform);
thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true);
}
Path* thePath = new Path;
Shape* theShape = new Shape;
{
- Geom::Matrix tempMat( to_2geom(gc->transform) );
+ Geom::Matrix tempMat( gc->transform );
thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true);
}
@@ -732,7 +732,7 @@ cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, boost::optional
cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area, true, 0);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, area, true, 0);
cairo_stroke(ct);
@@ -813,7 +813,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb
cairo_set_tolerance(ct, 0.1);
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area->upgrade(), true, style_width);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, area->upgrade(), true, style_width);
cairo_stroke(ct);
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), (area)->upgrade(), false, 0);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, (area)->upgrade(), false, 0);
cairo_fill(ct);
@@ -1096,9 +1096,9 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
if (item->arena->canvasarena) {
Geom::Rect viewbox = to_2geom(item->arena->canvasarena->item.canvas->getViewbox());
viewbox.expandBy (width);
- pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
+ pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
} else {
- pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
+ pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
}
g_get_current_time (&tfinish);
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index b1e97e44bac9c39e7db29906e7eb67ce497e4431..b321f0f50676a0633cc22b3e9c1ecec3ea424d07 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
}
/* Now we have to go back to item coordinates at last */
- c->transform(( dc->white_item
+ c->transform( dc->white_item
? sp_item_dt2i_affine(dc->white_item)
- : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) ));
+ : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) );
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
SPDocument *doc = sp_desktop_document(desktop);
SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
dc->selection->set(repr);
Inkscape::GC::release(repr);
- item->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer()));
+ item->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
item->updateRepr();
}
index abe4d7dcec36cbf19ec5bf8cc959e394a62a7282..c56ba7a4c197092d932ae979f8108b648530d833 100644 (file)
}
// calculate pointer point in the guide item's coords
- motion_to_curve = from_2geom(sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected));
+ motion_to_curve = sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected);
pointer = motion_dt * motion_to_curve;
// calculate the nearest point on the guide path
item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
item->updateRepr();
}
- Geom::PathVector pathv = dc->accumulated->get_pathvector() * to_2geom(sp_desktop_dt2root_affine(desktop));
+ Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2root_affine(desktop);
gchar *str = sp_svg_write_path(pathv);
g_assert( str != NULL );
dc->repr->setAttribute("d", str);
double mag = NR::L2(vel);
NR::Point v = mag * NR::rot90( to - from ) / NR::L2( to - from );
- curve->curveto(to_2geom(from + v), to_2geom(to + v), to_2geom(to));
+ curve->curveto(from + v, to + v, to);
}
}
dc->cal1->reset();
dc->cal2->reset();
- dc->cal1->moveto(to_2geom(dc->point1[0]));
- dc->cal2->moveto(to_2geom(dc->point2[0]));
+ dc->cal1->moveto(dc->point1[0]);
+ dc->cal2->moveto(dc->point2[0]);
}
NR::Point b1[BEZIER_MAX_LENGTH];
/* CanvasShape */
if (! release) {
dc->currentcurve->reset();
- dc->currentcurve->moveto(to_2geom(b1[0]));
+ dc->currentcurve->moveto(b1[0]);
for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) {
- dc->currentcurve->curveto(to_2geom(bp1[1]), to_2geom(bp1[2]), to_2geom(bp1[3]));
+ dc->currentcurve->curveto(bp1[1], bp1[2], bp1[3]);
}
dc->currentcurve->lineto(b2[BEZIER_SIZE*(nb2-1) + 3]);
for (NR::Point *bp2 = b2 + BEZIER_SIZE * ( nb2 - 1 ); bp2 >= b2; bp2 -= BEZIER_SIZE) {
- dc->currentcurve->curveto(to_2geom(bp2[2]), to_2geom(bp2[1]), to_2geom(bp2[0]));
+ dc->currentcurve->curveto(bp2[2], bp2[1], bp2[0]);
}
// FIXME: dc->segments is always NULL at this point??
if (!dc->segments) { // first segment
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 7f662f5265791234bff9af0c21cde9d2ae572779..559ce28667e7ba224aaf630fd69d367caa3b74ae 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
item->updateRepr();
}
- Geom::PathVector pathv = dc->accumulated->get_pathvector() * to_2geom(sp_desktop_dt2root_affine(desktop));
+ Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2root_affine(desktop);
gchar *str = sp_svg_write_path(pathv);
g_assert( str != NULL );
dc->repr->setAttribute("d", str);
index 48fe3bec2afaa020dc95f81d2f7e56947a83fdab..3a4748b8aebd14fa3550a5f473c02cf50995c157 100644 (file)
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_start(path_it->front())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform(*curve_it1, *curve_it2)));
+ NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_end(path_it->back_default())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_end(path_it->back_default()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// Get the bounding box of the selection
- //boost::optional<NR::Rect> _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
- // NRRect bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
- NRRect bbox(item->getBounds(from_2geom(sp_item_i2d_affine(item))));
+ //boost::optional<NR::Rect> _bbox = item->getBounds(sp_item_i2d_affine(item));
+ // NRRect bbox = item->getBounds(sp_item_i2d_affine(item));
+ NRRect bbox(item->getBounds(sp_item_i2d_affine(item)));
// List of the items to show; all others will be hidden
}
*/
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
- NR::Matrix eek = from_2geom(sp_item_i2d_affine (SP_ITEM(parent_object)));
+ NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
NR::Matrix t;
double shift_x = bbox.x0;
d.y1 = ceil(ctx->_height);
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
if (ctx->_vector_based_target) {
// convert from px to pt
d.x0 *= PT_PER_PX;
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index 69277440fc5331580f71c85d87f57a35ab29a566..6e0a7bf0b6e13bd59de1e24c36813617ee62ad47 100644 (file)
d.y1 = _height;
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
}
d.x0 *= IN_PER_PX;
index c1dcec361b0ca28d249dbbf856d8a10cefe98556..eeda6f1879bf784d1f9f2c58558cfa1bdfae296d 100644 (file)
@@ -281,7 +281,7 @@ PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv
// NR::Matrix tf=*transform; // why was this here?
NR::Matrix tf_stack=m_tr_stack.top(); // and why is transform argument not used?
- Geom::PathVector pathv = pathv_in * to_2geom(tf_stack); // generates new path, which is a bit slow, but this doesn't have to be performance optimized
+ Geom::PathVector pathv = pathv_in * tf_stack; // generates new path, which is a bit slow, but this doesn't have to be performance optimized
os << "\\newpath\n";
index 959070b50948f58adb6fdfef9f7d6e200e5060ef..8ad9b5031e5067d6b04536f8b93ccd8e5677aa83 100644 (file)
static NR::Matrix getODFTransform(const SPItem *item)
{
//### Get SVG-to-ODF transform
- NR::Matrix tf = from_2geom(sp_item_i2d_affine(item));
+ NR::Matrix tf (sp_item_i2d_affine(item));
//Flip Y into document coordinates
double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0));
couts.printf(" svg:d=\"");
int nrPoints = writePath(couts, curve->get_pathvector(),
- to_2geom(tf), bbox_x, bbox_y);
+ tf, bbox_x, bbox_y);
couts.printf("\"");
couts.printf(">\n");
index 0ff57127529263254f220ed147f9a21b5bae4535..2b3c9382489c63413697fcba3a34acff2c5eb250 100644 (file)
d.y1 = _height;
} else {
// if not page, use our base, which is either root or the item we want to export
- sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2doc_affine (doc_item)), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, sp_item_i2doc_affine (doc_item), TRUE);
// convert from px to pt
d.x0 *= PT_PER_PX;
d.x1 *= PT_PER_PX;
// object itself, ignoring its ancestors
// complete transform, including doc_item's own transform
- t = from_2geom(sp_item_i2doc_affine (doc_item));
+ t = sp_item_i2doc_affine (doc_item);
// subreact doc_item's transform (comes first) from it
t = NR::Matrix(doc_item->transform).inverse() * t;
index 6f1405de206e97139820c67f9d6afb9afda6e73a..15b0bd8f40d95bc57e8a592c1fea40ec64df9d9f 100644 (file)
d.y1 = ceil(_height);
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
// convert from px to pt
d.x0 *= PT_PER_PX;
d.x1 *= PT_PER_PX;
index af8cfbfa1df0f6c674e06364bb8c1e06dc1a8adc..0c516aa27cf473b1cf582587c7a8ca6ca9e512f8 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
@@ -330,7 +330,7 @@ new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mod
width = height = 0;
}
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item) );
+ NR::Matrix i2d (sp_item_i2d_affine (item) );
return (new_filter_blend_gaussian_blur (document, mode, radius, NR::expansion(i2d), NR::expansionX(i2d), NR::expansionY(i2d), width, height));
}
}
// Determine the required standard deviation value
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item));
+ NR::Matrix i2d (sp_item_i2d_affine (item));
double expansion = NR::expansion(i2d);
double stdDeviation = radius;
if (expansion != 0)
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 0c284db68537b7428968a5303097e82efc72c1af..634ee4732d1a529ebddd3818dd8d3effe1212daf 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -510,7 +510,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
sp_item_write_transform(SP_ITEM(reprobj), pathRepr, transform, NULL);
// premultiply the item transform by the accumulated parent transform in the paste layer
- NR::Matrix local = from_2geom(sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer())));
+ NR::Matrix local (sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer())));
if (!local.test_identity()) {
gchar const *t_str = pathRepr->attribute("transform");
NR::Matrix item_t (NR::identity());
index c6dd26712c10a17eb6e782dcf9358ac1852f76a9..afbf1600944cbaef69ff4e1ab7461e8a9d860cfd 100644 (file)
@@ -824,7 +824,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke");
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item));
+ NR::Matrix i2d (sp_item_i2d_affine (item));
NR::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
@@ -1101,7 +1101,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
bbox->min()[NR::X], bbox->min()[NR::Y]);
}
}
- p *= NR::Matrix(gradient->gradientTransform) * from_2geom(sp_item_i2d_affine(item));
+ p *= NR::Matrix(gradient->gradientTransform) * (NR::Matrix)sp_item_i2d_affine(item);
return p;
}
index 00ba4508bb61dec5749773c972abce5cc18b3852..94976da27fc13107ccff669f9129f4e93f5f7b83 100644 (file)
/* Create ArenaItems and set transform */
NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- nr_arena_item_set_transform(NR_ARENA_ITEM(root), from_2geom(affine));
+ nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
gc.transform.set_identity();
index a08f9a9391a4d21e76888bea93d6307cd7c3a087..84816ad9c7b52454a8176bb37d675e286026b72b 100644 (file)
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
/* Create ArenaItems and set transform */
ebp.root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), from_2geom(affine));
+ nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), affine);
// We show all and then hide all items we don't want, instead of showing only requested items,
// because that would not work if the shown item references something in defs
diff --git a/src/interface.cpp b/src/interface.cpp
index 0ec73d81bbcb735a39ae502bd5acfa22ee6d03ed..0259ecb6602dd52d7f62c0f53e5a7cded9f1d31e 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed *
- NR::expansion(from_2geom(sp_item_i2d_affine(item))) * 0.5
+ NR::expansion(sp_item_i2d_affine(item)) * 0.5
: 0.0)
+ prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
index 82ec9cf90ae9aea7a31f3ecc0a6c7669226a5e74..99aa67052a4448f37bf2aa8cf24936e611dccae6 100644 (file)
static gdouble sp_pattern_extract_theta(SPPattern *pat)
{
- Geom::Matrix transf = to_2geom(pat->patternTransform);
+ Geom::Matrix transf = pat->patternTransform;
return Geom::atan2(transf.xAxis());
}
static Geom::Point sp_pattern_extract_scale(SPPattern *pat)
{
- Geom::Matrix transf = to_2geom(pat->patternTransform);
+ Geom::Matrix transf = pat->patternTransform;
return Geom::Point( transf.expansionX(), transf.expansionY() );
}
@@ -215,7 +215,7 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
scl = Geom::Scale(d[NR::X] / pat_x, d[NR::Y] / pat_y);
}
- NR::Matrix rot = from_2geom(scl) * NR::Matrix(NR::rotate(theta));
+ Geom::Matrix rot = (Geom::Matrix)scl * Geom::Rotate(theta);
Geom::Point const t = sp_pattern_extract_trans(pat);
rot[4] = t[NR::X];
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index f4892b008c5a4892b1c2d4f9c91cc1ce33b5b1d6..f7935c7c33c9280230cbbec706f622317be60ea9 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
void
KnotHolder::update_knots()
{
- NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item)));
+ NR::Matrix const i2d(sp_item_i2d_affine(item));
for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
KnotHolderEntity *e = *i;
index 36c882d446d3a0b1b530b1d25dbb49c19fcf5c43..b2de090a0a1507b1672976e3623686534c06be7e 100644 (file)
Geom::PathVector const * pv = span.font->PathVector(_glyphs[glyph_index].glyph);
if (pv) {
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
- Geom::PathVector temp_pv = (*pv) * to_2geom(glyph_matrix);
+ Geom::PathVector temp_pv = (*pv) * glyph_matrix;
if (!text_source->style->fill.isNone())
sp_print_fill(ctx, temp_pv, &ctm, text_source->style, pbox, dbox, bbox);
if (!text_source->style->stroke.isNone())
if (clip_mode) {
Geom::PathVector const *pathv = span.font->PathVector(_glyphs[glyph_index].glyph);
if (pathv) {
- Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix);
+ Geom::PathVector pathv_trans = (*pathv) * glyph_matrix;
SPStyle const *style = text_source->style;
ctx->renderPathVector(pathv_trans, style, NULL);
}
@@ -547,7 +547,7 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
Geom::PathVector const * pathv = span.font->PathVector(_glyphs[glyph_index].glyph);
if (pathv) {
- Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix);
+ Geom::PathVector pathv_trans = (*pathv) * glyph_matrix;
SPCurve *c = new SPCurve(pathv_trans);
if (c) cc = g_slist_prepend(cc, c);
}
index 47956031f55fcbaa6670f2de86b78da9f9f63b4a..b5905778b097e5a33681af5e3e1f8b149c1a5468 100644 (file)
{
/* TODO: add testcase for this descr_arcto case */
PathDescrArcTo *nData = dynamic_cast<PathDescrArcTo *>(descr_cmd[i]);
- currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, to_2geom(nData->p) );
+ currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, nData->p );
lastP = nData->p;
}
break;
{
if( is_straight_curve(c) )
{
- LineTo( from_2geom(c.finalPoint()) );
+ LineTo( c.finalPoint() );
}
/*
else if(Geom::QuadraticBezier const *quadratic_bezier = dynamic_cast<Geom::QuadraticBezier const *>(c)) {
Geom::Point tmp = (*cubic_bezier)[3];
Geom::Point tms = 3 * ((*cubic_bezier)[1] - (*cubic_bezier)[0]);
Geom::Point tme = 3 * ((*cubic_bezier)[3] - (*cubic_bezier)[2]);
- CubicTo (from_2geom(tmp), from_2geom(tms), from_2geom(tme));
+ CubicTo (tmp, tms, tme);
}
else if(Geom::SVGEllipticalArc const *svg_elliptical_arc = dynamic_cast<Geom::SVGEllipticalArc const *>(&c)) {
- ArcTo( from_2geom(svg_elliptical_arc->finalPoint()),
+ ArcTo( svg_elliptical_arc->finalPoint(),
svg_elliptical_arc->ray(0), svg_elliptical_arc->ray(1),
svg_elliptical_arc->rotation_angle(),
svg_elliptical_arc->large_arc_flag(), !svg_elliptical_arc->sweep_flag() );
// directly on the curve parameters
Geom::Path const pathtr = doTransformation ? path * tr : path;
- MoveTo( from_2geom(pathtr.initialPoint()) );
+ MoveTo( pathtr.initialPoint() );
for(Geom::Path::const_iterator cit = pathtr.begin(); cit != pathtr.end_open(); ++cit) {
AddCurve(*cit);
index 834877f369a803a172d865931bed5f067c14fb6a..bb2b908deeb4fab3a9ef74b5e346b651a079c242 100644 (file)
SPItem *item = SP_ITEM(lpeitem);
Geom::Matrix t = sp_item_i2d_affine(item);
- Geom::Rect bbox = item->getBounds(t);
+ Geom::Rect bbox = to_2geom(*item->getBounds(t)); // fixme: what happens if getBounds does not return a valid rect?
Point A(bbox.left(), bbox.bottom());
Point B(bbox.left(), bbox.top());
index bd4b5d093d84dd88b65ea0b1215303b29372ab99..c11e99ecdcc6cf8cc8f16d7f2fd26bfe889b1f9e 100644 (file)
transform = Geom::identity();
}
- Geom::Rect itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX);
+ Geom::Rect itemBBox = to_2geom(*item->getBounds(transform, SPItem::GEOMETRIC_BBOX)); // fixme: fix for when getBounds returns invalid Rect
boundingbox_X = itemBBox[Geom::X];
boundingbox_Y = itemBBox[Geom::Y];
}
index 0c7a701f17dab033901ed3cdad89cd073c84aca2..107f5b24947e1c83df7cb0c23c321a10b68a5058 100644 (file)
param_effect->getSPDoc() ) );
// TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP)
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Geom::Matrix transf = to_2geom(desktop->doc2dt());
+ Geom::Matrix transf = desktop->doc2dt();
pointwdg->setTransform(transf);
pointwdg->setValue( *this );
pointwdg->clearProgrammatically();
diff --git a/src/main.cpp b/src/main.cpp
index d6f0ae9e827a49c93d7257673ed8db6da96061dd..f19dac81cd33682a205934e043118bf3a432efb4 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -920,7 +920,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
- boost::optional<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> area = item->getBounds(sp_item_i2doc_affine(item));
if (area) {
Inkscape::SVGOStringStream os;
if (extent) {
{
SPItem *item = ((SPItem *) o);
if (o->id && SP_IS_ITEM(item)) {
- boost::optional<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> area = item->getBounds(sp_item_i2doc_affine(item));
if (area) {
Inkscape::SVGOStringStream os;
os << o->id;
// write object bbox to area
sp_document_ensure_up_to_date (doc);
- sp_item_invoke_bbox((SPItem *) o_area, &area, from_2geom(sp_item_i2r_affine((SPItem *) o_area)), TRUE);
+ sp_item_invoke_bbox((SPItem *) o_area, &area, sp_item_i2r_affine((SPItem *) o_area), TRUE);
} else {
g_warning("Object with id=\"%s\" was not found in the document. Nothing exported.", sp_export_id);
return;
diff --git a/src/marker.cpp b/src/marker.cpp
index 98d485c332b88e11a7d9d7ba3b7e1c1a3428244a..d77aa87d6430d58d01e21c052932fbbba23814ab 100644 (file)
--- a/src/marker.cpp
+++ b/src/marker.cpp
if (v->items[pos]) {
NR::Matrix m;
if (marker->orient_auto) {
- m = from_2geom(base);
+ m = base;
} else {
/* fixme: Orient units (Lauris) */
m = NR::Matrix(rotate_degrees(marker->orient));
- m *= get_translation(from_2geom(base));
+ m *= NR::get_translation(base);
}
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
m = NR::scale(linewidth) * m;
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 017544901a7717f6e51cc4d213aaa352afb0a28a..82a5e841cae62eadbb67f5ed7641de0f2cbcaedc 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
static SPCanvasItem *
sp_nodepath_make_helper_item(Inkscape::NodePath::Path *np, /*SPDesktop *desktop, */const SPCurve *curve, bool show = false) {
SPCurve *helper_curve = curve->copy();
- helper_curve->transform(to_2geom(np->i2d));
+ helper_curve->transform(np->i2d);
SPCanvasItem *helper_path = sp_canvas_bpath_new(sp_desktop_controls(np->desktop), helper_curve);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helper_path), 0, SP_WIND_RULE_NONZERO);
std::vector<Geom::PathVector> hpaths = lpe->getHelperPaths(lpeitem);
for (unsigned int j = 0; j < hpaths.size(); ++j) {
SPCurve *curve = new SPCurve(hpaths[j]);
- curve->transform(to_2geom(np->i2d));
+ curve->transform(np->i2d);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(((*np->helper_path_vec)[lpe])[j]), curve);
curve = curve->unref();
}
// to a change in repr by regenerating nodepath --bb
sp_object_read_attr(SP_OBJECT(np->item), "transform");
- np->i2d = from_2geom(sp_item_i2d_affine(np->item));
+ np->i2d = sp_item_i2d_affine(np->item);
np->d2i = np->i2d.inverse();
np->repr = repr;
@@ -523,7 +523,7 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec
Inkscape::NodePath::SubPath *sp = sp_nodepath_subpath_new(np);
- NR::Point ppos = from_2geom(pit->initialPoint()) * np->i2d;
+ NR::Point ppos = pit->initialPoint() * (Geom::Matrix)np->i2d;
NRPathcode pcode = NR_MOVETO;
/* Johan: Note that this is pretty arcane code. I am pretty sure it is working correctly, be very certain to change it! (better to just rewrite this whole method)*/
@@ -532,19 +532,19 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec
dynamic_cast<Geom::HLineSegment const*>(&*cit) ||
dynamic_cast<Geom::VLineSegment const*>(&*cit) )
{
- NR::Point pos = from_2geom(cit->initialPoint()) * np->i2d;
+ NR::Point pos = cit->initialPoint() * (Geom::Matrix)np->i2d;
sp_nodepath_node_new(sp, NULL, t[i++], pcode, &ppos, &pos, &pos);
- ppos = from_2geom(cit->finalPoint()) * np->i2d;
+ ppos = cit->finalPoint() * (Geom::Matrix)np->i2d;
pcode = NR_LINETO;
}
else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const*>(&*cit)) {
std::vector<Geom::Point> points = cubic_bezier->points();
- NR::Point pos = from_2geom(points[0]) * np->i2d;
- NR::Point npos = from_2geom(points[1]) * np->i2d;
+ NR::Point pos = points[0] * (Geom::Matrix)np->i2d;
+ NR::Point npos = points[1] * (Geom::Matrix)np->i2d;
sp_nodepath_node_new(sp, NULL, t[i++], pcode, &ppos, &pos, &npos);
- ppos = from_2geom(points[2]) * np->i2d;
+ ppos = points[2] * (Geom::Matrix)np->i2d;
pcode = NR_CURVETO;
}
}
@@ -555,7 +555,7 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec
* If the length is zero, don't add it to the nodepath. */
Geom::Curve const &closing_seg = pit->back_closed();
if ( ! closing_seg.isDegenerate() ) {
- NR::Point pos = from_2geom(closing_seg.finalPoint()) * np->i2d;
+ NR::Point pos = closing_seg.finalPoint() * (Geom::Matrix)np->i2d;
sp_nodepath_node_new(sp, NULL, t[i++], NR_LINETO, &pos, &pos, &pos);
}
if (np->show_helperpath) {
SPCurve * helper_curve = np->curve->copy();
- helper_curve->transform(to_2geom(np->i2d));
+ helper_curve->transform(np->i2d);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve);
helper_curve->unref();
}
if (np->show_helperpath) {
SPCurve * helper_curve = np->curve->copy();
- helper_curve->transform(to_2geom(np->i2d));
+ helper_curve->transform(np->i2d);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve);
helper_curve->unref();
}
@@ -4287,7 +4287,7 @@ void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost:
Geom::Rect box = sp_node_selected_bbox (nodepath);
if (!center) {
- center = from_2geom(box.midpoint());
+ center = box.midpoint();
}
NR::Matrix t =
NR::Matrix (NR::translate(- *center)) *
if (show) {
SPCurve *helper_curve = np->curve->copy();
- helper_curve->transform(to_2geom(np->i2d));
+ helper_curve->transform(np->i2d);
if (!np->helper_path) {
//np->helper_path = sp_nodepath_make_helper_item(np, desktop, helper_curve, true); // Caution: this applies the transform np->i2d twice!!
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index ad5874a7e7d7c82f14218766cb39baf705d8f70c..3bebc7b22586a789cdc45c60caa44cc1bd47d5b7 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
// insert an additional transformation in document coordinates (code copied from sp_item_i2d_affine)
sp_item_invoke_bbox(item,
&bbox_of_item,
- from_2geom(sp_item_i2doc_affine(item) * matrix_to_desktop(to_2geom(additional_affine), item)),
+ sp_item_i2doc_affine(item) * matrix_to_desktop(additional_affine, item),
true);
} else {
- sp_item_invoke_bbox(item, &bbox_of_item, from_2geom(sp_item_i2d_affine(item)), true);
+ sp_item_invoke_bbox(item, &bbox_of_item, sp_item_i2d_affine(item), true);
}
// See if the item is within range
if (bbox_of_item) {
@@ -345,7 +345,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
root_item = sp_use_root(SP_USE((*i).item));
g_return_if_fail(root_item);
} else {
- i2doc = from_2geom(sp_item_i2doc_affine((*i).item));
+ i2doc = sp_item_i2doc_affine((*i).item);
root_item = (*i).item;
}
@@ -377,7 +377,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
SPCurve *curve = curve_for_item(root_item);
if (curve) {
// We will get our own copy of the path, which must be freed at some point
- Geom::PathVector *borderpathv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), to_2geom((*i).additional_affine));
+ Geom::PathVector *borderpathv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), (*i).additional_affine);
_paths_to_snap_to->push_back(borderpathv); // Perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it.
curve->unref();
}
** in SPDesktop rather than SPNamedView?
*/
SPDesktop const *desktop = SP_ACTIVE_DESKTOP;
- Geom::Point const p_doc = to_2geom(desktop->dt2doc(p));
+ Geom::Point const p_doc = desktop->dt2doc(p);
bool const node_tool_active = _snap_to_itempath && selected_path != NULL;
* piece are unselected; if they are then this piece must be stationary
*/
g_assert(unselected_nodes != NULL);
- c1 = isUnselectedNode(from_2geom(start_pt), unselected_nodes);
- c2 = isUnselectedNode(from_2geom(end_pt), unselected_nodes);
+ c1 = isUnselectedNode(start_pt, unselected_nodes);
+ c2 = isUnselectedNode(end_pt, unselected_nodes);
}
Geom::Point const sp_doc = (*it_pv).pointAt(*np);
//Geom::Curve const & curve = (*it_pv).at_index(int(t));
if(is_straight_curve((*it_pv).at_index(int(t)))) {
// if we snap to a line segment, then return this line segment (leaves 1 DOF for snapping)
- sc.lines.push_back(Inkscape::SnappedLineSegment(from_2geom(sp_dt), dist, getSnapperTolerance(), getSnapperAlwaysSnap(), from_2geom(start_pt), from_2geom(end_pt)));
+ sc.lines.push_back(Inkscape::SnappedLineSegment(sp_dt, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), start_pt, end_pt));
} else {
// for curves other than line segments, we'll return just the closest snapped point
// (this is a fully constrained snap, no degrees of freedom left)
if (dist < s.getDistance()) {
// If this curve has multiple segments, then we will return only
// a single snapped point
- s = SnappedPoint(from_2geom(sp_dt), SNAPTARGET_PATH, dist, getSnapperTolerance(), getSnapperAlwaysSnap());
+ s = SnappedPoint(sp_dt, SNAPTARGET_PATH, dist, getSnapperTolerance(), getSnapperAlwaysSnap());
success = true;
}
}
@@ -752,10 +752,10 @@ void Inkscape::ObjectSnapper::_getBorderNodes(std::vector<NR::Point> *points) co
{
Geom::Coord w = sp_document_width(_named_view->document);
Geom::Coord h = sp_document_height(_named_view->document);
- points->push_back(from_2geom(Geom::Point(0,0)));
- points->push_back(from_2geom(Geom::Point(0,h)));
- points->push_back(from_2geom(Geom::Point(w,h)));
- points->push_back(from_2geom(Geom::Point(w,0)));
+ points->push_back(Geom::Point(0,0));
+ points->push_back(Geom::Point(0,h));
+ points->push_back(Geom::Point(w,h));
+ points->push_back(Geom::Point(w,0));
}
/*
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 9dfa760ea2c0280138bcf3e89aeea1f9f402fc15..c4855e7d38980239adafd20c7d0568c84116c20b 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
//c->transform(item->transform);
curve = c;
} else {
- c->transform(to_2geom(item->getRelativeTransform(SP_OBJECT(first))));
+ c->transform(item->getRelativeTransform(SP_OBJECT(first)));
curve->append(c, false);
c->unref();
}
gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style"));
gchar *path_effect = g_strdup(SP_OBJECT(item)->repr->attribute("inkscape:path-effect"));
- Geom::PathVector apv = curve->get_pathvector() * to_2geom(SP_ITEM(path)->transform);
+ Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform;
curve->unref();
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index ef59aeb319f0faa3731bb7412680a1a7d0dfedea..30b09013b09f770a37fa83d8d72d61dcd8c8895d 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
if ( cubic &&
(*cubic)[2] != to_2geom(pc->p[0]) )
{
- NR::Point p2 = from_2geom((*cubic)[2]);
+ NR::Point p2 = (*cubic)[2];
SP_CTRL(pc->c0)->moveto(p2);
sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), p2, pc->p[0]);
sp_canvas_item_show (pc->c0);
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>( pc->green_curve->last_segment() );
if ( cubic ) {
- pc->p[1] = pc->p[0] + from_2geom( (*cubic)[3] - (*cubic)[2] );
+ pc->p[1] = pc->p[0] + (NR::Point)( (*cubic)[3] - (*cubic)[2] );
} else {
pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]);
}
Geom::Curve const * crv = &path.back_default();
pc->p[0] = crv->initialPoint();
if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) {
- pc->p[1] = from_2geom( (*cubic)[1] );
+ pc->p[1] = (*cubic)[1];
} else {
pc->p[1] = pc->p[0];
}
NR::Point const pt(( pc->npoints < 4
- ? from_2geom(crv->finalPoint())
+ ? (NR::Point)(crv->finalPoint())
: pc->p[3] ));
pc->npoints = 2;
pc->green_curve->backspace();
index 435deea5ca8d4e61d91655c335fd7dec44b4c8d2..c6e2e615332d5f9a8afb6918180c32143878d552 100644 (file)
@@ -132,7 +132,7 @@ void sp_selection_copy_impl (GSList const *items, GSList **clip, Inkscape::XML::
// Copy item reprs:
for (GSList *i = (GSList *) sorted_items; i != NULL; i = i->next) {
- sp_selection_copy_one (SP_OBJECT_REPR (i->data), from_2geom(sp_item_i2doc_affine(SP_ITEM (i->data))), clip, xml_doc);
+ sp_selection_copy_one (SP_OBJECT_REPR (i->data), sp_item_i2doc_affine(SP_ITEM (i->data)), clip, xml_doc);
}
*clip = g_slist_reverse(*clip);
@@ -150,7 +150,7 @@ GSList *sp_selection_paste_impl (SPDocument *doc, SPObject *parent, GSList **cli
Inkscape::XML::Node *copy = repr->duplicate(xml_doc);
// premultiply the item transform by the accumulated parent transform in the paste layer
- NR::Matrix local = from_2geom(sp_item_i2doc_affine(SP_ITEM(parent)));
+ NR::Matrix local (sp_item_i2doc_affine(SP_ITEM(parent)));
if (!local.test_identity()) {
gchar const *t_str = copy->attribute("transform");
NR::Matrix item_t (NR::identity());
NR::Matrix item_t (NR::identity());
if (t_str)
sp_svg_transform_read(t_str, &item_t);
- item_t *= from_2geom(sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent()))));
+ item_t *= sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent())));
//FIXME: when moving both clone and original from a transformed group (either by
//grouping into another parent, or by cut/paste) the transform from the original's
//parent becomes embedded into original itself, and this affects its clones. Fix
}
// FIXME: also transform gradient/pattern fills, by forking? NO, this must be nondestructive
- double ex = NR::expansion(from_2geom(sp_item_i2doc_affine(item)));
+ double ex = NR::expansion(sp_item_i2doc_affine(item));
if (ex != 1.0) {
css = sp_css_attr_scale (css, ex);
}
@@ -1232,9 +1232,9 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
sp_object_read_attr (SP_OBJECT (item), "transform");
// calculate the matrix we need to apply to the clone to cancel its induced transform from its original
- NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(SP_OBJECT_PARENT (item))));
- NR::Matrix t = parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(affine), item), item)) * parent_transform.inverse();
- NR::Matrix t_inv =parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(affine.inverse()), item), item)) * parent_transform.inverse();
+ NR::Matrix parent_transform = sp_item_i2root_affine(SP_ITEM(SP_OBJECT_PARENT (item)));
+ NR::Matrix t = parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (affine, item), item)) * parent_transform.inverse();
+ NR::Matrix t_inv =parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item)) * parent_transform.inverse();
NR::Matrix result = t_inv * item->transform * t;
if ((prefs_parallel || prefs_unmoved) && affine.is_translation()) {
@@ -1262,7 +1262,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
} else {
if (set_i2d) {
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
}
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL);
}
bool highlight = prefs_get_int_attribute ("options.highlightoriginal", "value", 0);
if (highlight) {
- boost::optional<NR::Rect> a = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
- boost::optional<NR::Rect> b = original->getBounds(from_2geom(sp_item_i2d_affine(original)));
+ boost::optional<NR::Rect> a = item->getBounds(sp_item_i2d_affine(item));
+ boost::optional<NR::Rect> b = original->getBounds(sp_item_i2d_affine(original));
if ( a && b ) {
// draw a flashing line between the objects
SPCurve *curve = new SPCurve();
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT (items->data);
- NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(parent)));
+ NR::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent)));
// remember the position of the first item
gint pos = SP_OBJECT_REPR (items->data)->position();
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT (items->data);
- NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(parent)));
+ NR::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent)));
// remember the position of the first item
gint pos = SP_OBJECT_REPR (items->data)->position();
}
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
- NR::Matrix eek = from_2geom(sp_item_i2d_affine (SP_ITEM(parent_object)));
+ NR::Matrix eek (sp_item_i2d_affine (SP_ITEM(parent_object)));
NR::Matrix t;
double shift_x = bbox.x0;
sp_document_ensure_up_to_date(doc);
SPItem const *const root = SP_ITEM(doc->root);
- boost::optional<NR::Rect> const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root))));
+ boost::optional<NR::Rect> const bbox(root->getBounds(sp_item_i2r_affine(root)));
if (bbox && !bbox->isEmpty()) {
doc->fitToRect(*bbox);
return true;
diff --git a/src/selection.cpp b/src/selection.cpp
index b71f27815214e527d8059792c352bdf5d21b5e4c..9e134ff08022c5fa31aefcb8b0f109df6b1c00a0 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -407,7 +407,7 @@ NRRect *Selection::boundsInDocument(NRRect *bbox, SPItem::BBoxType type) const {
for ( GSList const *iter=items ; iter != NULL ; iter = iter->next ) {
SPItem *item=SP_ITEM(iter->data);
- NR::Matrix i2doc(from_2geom(sp_item_i2doc_affine(item)));
+ Geom::Matrix i2doc(sp_item_i2doc_affine(item));
sp_item_invoke_bbox(item, bbox, i2doc, FALSE, type);
}
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 0b297318d613d3805cfd5382be5cd787bc5f3505..562fc760ecc20399b82280be5b0a80057ab68239 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -268,7 +268,7 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho
SPItem *it = (SPItem *)sp_object_ref(SP_OBJECT(l->data), NULL);
_items.push_back(it);
_items_const.push_back(it);
- _items_affines.push_back(from_2geom(sp_item_i2d_affine(it)));
+ _items_affines.push_back(sp_item_i2d_affine(it));
_items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers
}
@@ -372,7 +372,7 @@ void Inkscape::SelTrans::transform(NR::Matrix const &rel_affine, NR::Point const
for (unsigned i = 0; i < _items.size(); i++) {
SPItem &item = *_items[i];
NR::Matrix const &prev_transform = _items_affines[i];
- sp_item_set_i2d_affine(&item, to_2geom(prev_transform * affine));
+ sp_item_set_i2d_affine(&item, prev_transform * affine);
}
} else {
if (_bbox) {
NR::Matrix const *new_affine;
if (_show == SHOW_OUTLINE) {
- NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(original_item)));
+ NR::Matrix const i2d(sp_item_i2d_affine(original_item));
NR::Matrix const i2dnew( i2d * _current_relative_affine );
- sp_item_set_i2d_affine(copy_item, to_2geom(i2dnew));
+ sp_item_set_i2d_affine(copy_item, i2dnew);
new_affine = ©_item->transform;
} else {
new_affine = &original_item->transform;
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 2b7ec4c3d64e1a24e57df6801643533092e7bdfd..8e5ea77b57facda9fb60a1bb36b47bb029d89c9e 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
//Translate click point into proper coord system
this->curvepoint_doc = desktop->w2d(event_p);
- this->curvepoint_doc *= from_2geom(sp_item_dt2i_affine(item));
+ this->curvepoint_doc *= sp_item_dt2i_affine(item);
SPCurve *curve = this->nodepath->curve; // not sure if np->curve is always up to date...
Geom::PathVector const &pathv = curve->get_pathvector();
(( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed * 0.5 *
- NR::expansion(from_2geom(sp_item_i2d_affine(item)))
+ NR::expansion(sp_item_i2d_affine(item))
: 0.0)
- + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(from_2geom(sp_item_i2d_affine(item)));
+ + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(sp_item_i2d_affine(item));
bool close = (NR::L2 (delta) < stroke_tolerance);
if (remember && close) {
diff --git a/src/snap.cpp b/src/snap.cpp
index 46b9ecad297e4c3154ff6dca23cb6a4256b22e2a..9c9a69a989ea08058978475c449f5dfeb7279689 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
}
if (success)
- return to_2geom(nearest_multiple);
+ return nearest_multiple;
}
return t;
index 6ef3746845d650d96ee1a9da9103f6e4a06a1c6b..328f5a6962bf4b15d1f1f0d6bd883eee8e060b6f 100644 (file)
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
- boost::optional<NR::Rect> bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h])));
+ boost::optional<NR::Rect> bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
if (bbox) {
endPts[h] = bbox->midpoint();
} else {
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index 127262540185d6abb8b2110234a333d3992cca76..40017912fc969afe0ef82d7c1c18ff7b6d39a7e6 100644 (file)
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
SPItem const *const path_item = SP_ITEM(path);
SPObject const *const ancestor = get_nearest_common_ancestor(path_item, h2attItem);
- NR::Matrix const path2anc(from_2geom(i2anc_affine(path_item, ancestor)));
+ NR::Matrix const path2anc(i2anc_affine(path_item, ancestor));
if (h2attItem[0] != NULL && h2attItem[1] != NULL) {
/* Initial end-points: centre of attached object. */
return;
}
h2bbox_icoordsys[h] = *bbox;
- h2i2anc[h] = from_2geom(i2anc_affine(h2attItem[h], ancestor));
+ h2i2anc[h] = i2anc_affine(h2attItem[h], ancestor);
h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint();
}
}
h2bbox_icoordsys[ind] = *bbox;
- h2i2anc = from_2geom(i2anc_affine(h2attItem[ind], ancestor));
+ h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
h2endPt_icoordsys[!ind] = other_endpt;
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 1970a80341bffe456986ffc760137e89e07c2b70..889e8b8ffc5d23885feaefbc7730f8305f32e508 100644 (file)
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item);
sp_genericellipse_normalize(ellipse);
- NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item));
+ NR::Matrix const i2d = sp_item_i2d_affine(item);
// figure out if we have a slice, whilst guarding against rounding errors
bool slice = false;
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index cbfb5119504b583990a57c68af863b4a94f28512..490407f81150ef9dc7e1dffa09d9ad8483865623 100644 (file)
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
{
SPObject* object=SP_OBJECT(this);
- NR::Matrix itr_mat = from_2geom(sp_item_i2root_affine (SP_ITEM(object)));
+ NR::Matrix itr_mat (sp_item_i2root_affine (SP_ITEM(object)));
itr_mat = itr_mat.inverse();
for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; it++)
delete computed;
computed = NULL;
}
- NR::Matrix itr_mat = from_2geom(sp_item_i2root_affine (SP_ITEM(object)));
+ NR::Matrix itr_mat (sp_item_i2root_affine (SP_ITEM(object)));
itr_mat = itr_mat.inverse();
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
if ( curve ) {
Path* temp=new Path;
Geom::Matrix tr_mat = sp_item_i2root_affine (SP_ITEM(u_child));
- tr_mat = to_2geom(itr_mat) * tr_mat;
+ tr_mat = (Geom::Matrix)itr_mat * tr_mat;
temp->LoadPathVector(curve->get_pathvector(), tr_mat, true);
Shape* n_shp=new Shape;
temp->Convert(0.25);
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index f6ba68911c636ee27e5dc96905dd3e1d8a2a6877..5c3ff8a958725ac7248f346e8f9cd026d19cfb79 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
dbox.y0 = 0.0;
dbox.x1 = sp_document_width(SP_OBJECT_DOCUMENT(item));
dbox.y1 = sp_document_height(SP_OBJECT_DOCUMENT(item));
- NR::Matrix const ctm = from_2geom(sp_item_i2d_affine(item));
+ NR::Matrix const ctm (sp_item_i2d_affine(item));
group->layout.print(ctx, &pbox, &dbox, &bbox, ctm);
}
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index f1e645d6f6db37d2f07db0d2c30683f6d1077573..5a02517e260267d27800ca44e2de314c7fbde740 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
double const y0 = image.y.computed;
double const x1 = x0 + image.width.computed;
double const y1 = y0 + image.height.computed;
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
+ NR::Matrix const i2d (sp_item_i2d_affine (item));
*p = NR::Point(x0, y0) * i2d;
*p = NR::Point(x0, y1) * i2d;
*p = NR::Point(x1, y1) * i2d;
index bf739301336c4cc59dbaa8fbd4367c383a153764..391766fb6ff679c2db1829e71f949234a7fcd7db 100644 (file)
s = (position - pos0) / dot(dir, dir). */
NR::translate const tr( ( position - pos0 )
* ( dir / dir_lensq ) );
- sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * to_2geom(tr));
+ sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * tr);
/// \todo Reget snappoints, check satisfied.
if (commit) {
index 6a6ab4fc40a77034b1d674e7232c5b56d3684e8d..fd9e9314beefb71ed54cdea6fb7dd2462873d5bd 100644 (file)
NR::Matrix affine = NR::Matrix(inverse(s)) * NR::Matrix(rotation) * NR::Matrix(s);
// Rotate item.
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
// Use each item's own transform writer, consistent with sp_selection_apply_affine()
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
{
boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(item);
if (bbox) {
- NR::translate const s(bbox->midpoint()); // use getCenter?
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(NR::Matrix(inverse(s)) * scale * s));
+ Geom::Translate const s(bbox->midpoint()); // use getCenter?
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * s.inverse() * (Geom::Matrix)(NR::Matrix)scale * s);
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
}
}
NR::Matrix const skew(1, skewY, skewX, 1, 0, 0);
NR::Matrix affine = NR::Matrix(inverse(s)) * skew * NR::Matrix(s);
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
// Restore the center position (it's changed because the bbox center changed)
void sp_item_move_rel(SPItem *item, NR::translate const &tr)
{
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(tr));
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * tr);
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
}
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index b0b6d8137f4cb9ba9109b7168886c6c09bc7f4ad..f88d7b9e04b728f2047e9f031c752c98078f7275 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
*/
void
SPItem::setCenter(NR::Point object_centre) {
- boost::optional<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
+ boost::optional<NR::Rect> bbox = getBounds(sp_item_i2d_affine(this));
if (bbox) {
transform_center_x = object_centre[NR::X] - bbox->midpoint()[NR::X];
if (fabs(transform_center_x) < 1e-5) // rounding error
}
NR::Point SPItem::getCenter() const {
- boost::optional<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
+ boost::optional<NR::Rect> bbox = getBounds(sp_item_i2d_affine(this));
if (bbox) {
return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
} else {
return r;
}
-/*
- * If the item is empty, or has an empty boundingbox for another reason, this method will
- * return an empty rectangle. I.e. "getBounds(...).isEmpty() == true".
- */
-Geom::Rect
-SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/)
-const
-{
- boost::optional<NR::Rect> r;
- sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE);
- if (r)
- return to_2geom(*r);
- else
- return Geom::Rect(); // return empty rectangle
-}
-
void
sp_item_invoke_bbox(SPItem const *item, boost::optional<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
@@ -800,7 +784,7 @@ sp_item_invoke_bbox_full(SPItem const *item, boost::optional<NR::Rect> *bbox, NR
}
// transform the expansions by the item's transform:
- NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item));
+ NR::Matrix i2d(sp_item_i2d_affine (item));
dx0 *= NR::expansionX(i2d);
dx1 *= NR::expansionX(i2d);
dy0 *= NR::expansionY(i2d);
g_assert(SP_IS_ITEM(item));
g_assert(bbox != NULL);
- sp_item_invoke_bbox(item, bbox, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
+ sp_item_invoke_bbox(item, bbox, sp_item_i2d_affine(item), TRUE, type);
}
boost::optional<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
{
boost::optional<NR::Rect> rect = boost::optional<NR::Rect>();
- sp_item_invoke_bbox(item, &rect, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
+ sp_item_invoke_bbox(item, &rect, sp_item_i2d_affine(item), TRUE, type);
return rect;
}
static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
{
- boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> bbox = item->getBounds(sp_item_i2d_affine(item));
/* Just the corners of the bounding box suffices given that we don't yet
support angled guide lines. */
@@ -971,7 +955,7 @@ void sp_item_snappoints(SPItem const *item, bool includeItemCenter, SnapPointsIt
for (std::vector<NR::Point>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) {
// All snappoints are in desktop coordinates, but the item's transformation is
// in document coordinates. Hence the awkward construction below
- *p = (*p_orig) * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(item->transform), item), item));
+ *p = (*p_orig) * from_2geom(matrix_to_desktop (matrix_from_desktop (item->transform, item), item));
}
}
}
@@ -1351,7 +1335,7 @@ sp_item_adjust_livepatheffect (SPItem *item, NR::Matrix const &postmul, bool set
if (lpeobj->lpe) {
Inkscape::LivePathEffect::Effect * effect = lpeobj->lpe;
- effect->transform_multiply(to_2geom(postmul), set);
+ effect->transform_multiply(postmul, set);
}
}
}
/* stop at first non-renderable ancestor */
while ( object != ancestor && SP_IS_ITEM(object) ) {
if (SP_IS_ROOT(object)) {
- ret *= to_2geom(SP_ROOT(object)->c2p);
+ ret *= SP_ROOT(object)->c2p;
}
- ret *= to_2geom(SP_ITEM(object)->transform);
+ ret *= SP_ITEM(object)->transform;
object = SP_OBJECT_PARENT(object);
}
return ret;
}
NR::Matrix SPItem::getRelativeTransform(SPObject const *dest) const {
- return from_2geom(i2i_affine(this, dest));
+ return i2i_affine(this, dest);
}
/**
Geom::Matrix ret(Geom::identity());
g_assert(ret.isIdentity());
while ( NULL != SP_OBJECT_PARENT(item) ) {
- ret *= to_2geom(item->transform);
+ ret *= item->transform;
item = SP_ITEM(SP_OBJECT_PARENT(item));
}
g_assert(SP_IS_ROOT(item));
- ret *= to_2geom(item->transform);
+ ret *= item->transform;
return ret;
}
}
Geom::Matrix const i2p( i2dt * dt2p );
- sp_item_set_item_transform(item, from_2geom(i2p));
+ sp_item_set_item_transform(item, i2p);
}
diff --git a/src/sp-item.h b/src/sp-item.h
index 581b6acdd255ac04684488e79961bdfccbd508b3..358f3d75c7566e3f227766e65f1a3f0fe4b50ba5 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
void lowerToBottom();
boost::optional<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
- Geom::Rect getBounds(Geom::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
sigc::connection _clip_ref_connection;
sigc::connection _mask_ref_connection;
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index e0e10b6deba7c740fab38769eb3d859766576bb6..427a7d6cf14c89a45d1aeb54503417895cfcdd50 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
// Transform the original-d path or the (ordinary) path
if (path->original_curve) {
- path->original_curve->transform(to_2geom(xform));
- sp_lpe_item_update_patheffect(path, true, true);
+ path->original_curve->transform(xform);
} else {
- shape->curve->transform(to_2geom(xform));
+ shape->curve->transform(xform);
}
// Adjust stroke
@@ -511,7 +510,7 @@ void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char co
/* put the circle where the mouse click occurred and set the diameter to the
current stroke width, multiplied by the amount specified in the preferences */
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
+ NR::Matrix const i2d (sp_item_i2d_affine (item));
NR::Point pp = pt * i2d;
double rad = 0.5 * prefs_get_double_attribute(tool, "dot-size", 3.0);
if (event_state & GDK_MOD1_MASK) {
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index 08d30b4f4be5a8db104f2c1c4ae2f6abe9ba8bee..b573300e09468104ee7a680cbfe24a7e9a9dfe8c 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
SPRect *rect = SP_RECT(item);
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
+ NR::Matrix const i2d (sp_item_i2d_affine (item));
*p = NR::Point(rect->x.computed, rect->y.computed) * i2d;
*p = NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d;
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- NR::Matrix const i2d (from_2geom(sp_item_i2d_affine(SP_ITEM(rect))));
+ NR::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect)));
NR::Point A1(NR::Point(rect->x.computed, rect->y.computed) * i2d);
NR::Point A2(NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d);
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 054310472e5820ae5393ea40006aeadafa54eed1..96b52fd46aff2f19573562578fb59a24412d4dfc 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -471,7 +471,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
NRRect cbbox;
- Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(transform));
+ Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform);
cbbox.x0 = geombbox[0][0];
cbbox.y0 = geombbox[1][0];
cbbox.x1 = geombbox[0][1];
@@ -502,7 +502,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_start(path_it->front())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
@@ -530,7 +530,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform(*curve_it1, *curve_it2)));
+ NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
@@ -554,7 +554,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_end(path_it->back_default())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_end(path_it->back_default()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
sp_item_bbox_desktop (item, &bbox);
- NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item));
+ NR::Matrix const i2d(sp_item_i2d_affine(item));
SPStyle* style = SP_OBJECT_STYLE (item);
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_start(path_it->front())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform(*curve_it1, *curve_it2)));
+ NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
- NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_end(path_it->back_default())));
+ NR::Matrix tr(sp_shape_marker_get_transform_at_end(path_it->back_default()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = NR::scale(style->stroke_width.computed) * tr;
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 0390df6bfa7901646c55470a47dda7a8c1f6b18c..09b926e63de723f77e8bbcd55c00edde7898f960 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
dbox.y0 = 0.0;
dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
- NR::Matrix const ctm = from_2geom(sp_item_i2d_affine(item));
+ NR::Matrix const ctm (sp_item_i2d_affine(item));
group->layout.print(ctx,&pbox,&dbox,&bbox,ctm);
}
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 0b3be70723fdb5ea22f8071247a63d2917dcb1ba..c86c852d7eb14d3316e1b72774dc4595e6f87192 100644 (file)
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
SPObject *text = SP_OBJECT_PARENT(tp);
NRRect bbox;
- sp_item_invoke_bbox(SP_ITEM(text), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(text))), TRUE);
+ sp_item_invoke_bbox(SP_ITEM(text), &bbox, sp_item_i2doc_affine(SP_ITEM(text)), TRUE);
NR::Point xy(bbox.x0, bbox.y0);
// make a list of textpath children
index 5b5011381a41fd18758d3bd9a6e3bdd30a41589c..e493e6afa09f1a1808364fee4d7ee48811a5d2dc 100644 (file)
--- a/src/sp-use-reference.cpp
+++ b/src/sp-use-reference.cpp
}
}
originalPath = new Path;
- originalPath->LoadPathVector(curve->get_pathvector(), to_2geom(item->transform), true);
+ originalPath->LoadPathVector(curve->get_pathvector(), item->transform, true);
curve->unref();
}
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 06ae89ba035ef7cee7bfe182e0d101033f90b16b..47051be2be132a954340c3d8ee223dccc8e1b068 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -461,7 +461,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// adjust style properties that depend on a possible transform in the source object in order
// to get a correct style attribute for the new path
SPItem* item_source = SP_ITEM(source);
- NR::Matrix i2root = from_2geom(sp_item_i2root_affine(item_source));
+ NR::Matrix i2root(sp_item_i2root_affine(item_source));
sp_item_adjust_stroke(item_source, NR::expansion(i2root));
sp_item_adjust_pattern(item_source, i2root);
sp_item_adjust_gradient(item_source, i2root);
@@ -493,7 +493,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// premultiply by the inverse of parent's repr
SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
- NR::Matrix local = from_2geom(sp_item_i2doc_affine(parent_item));
+ NR::Matrix local (sp_item_i2doc_affine(parent_item));
gchar *transform = sp_svg_transform_write(local.inverse());
// now that we have the result, add it on the canvas
SPMarker* marker = SP_MARKER (marker_object);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker_object));
- NR::Matrix tr(from_2geom(marker_transform));
+ NR::Matrix tr(marker_transform);
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
tr = stroke_scale * tr;
continue;
if (simplifyIndividualPaths) {
- boost::optional<NR::Rect> itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> itemBbox = item->getBounds(sp_item_i2d_affine(item));
if (itemBbox) {
simplifySize = L2(itemBbox->dimensions());
} else {
@@ -1779,7 +1779,7 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t
if (transformFull) {
*dest *= extraPreAffine * sp_item_i2doc_affine(item) * extraPostAffine;
} else {
- *dest *= extraPreAffine * to_2geom(item->transform) * extraPostAffine;
+ *dest *= extraPreAffine * (Geom::Matrix)item->transform * extraPostAffine;
}
} else {
*dest *= extraPreAffine * extraPostAffine;
diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp
index d6715a580be72c5d26ae90895331672d818ffce8..a34736176185b98fe8b8b0259d319e8eac2519d1 100644 (file)
--- a/src/svg/svg-affine.cpp
+++ b/src/svg/svg-affine.cpp
{
NR::Matrix mat;
if (sp_svg_transform_read(str, &mat)) {
- *transform = to_2geom(mat);
+ *transform = mat;
return true;
} else {
return false;
gchar *
sp_svg_transform_write(Geom::Matrix const *transform)
{
- NR::Matrix const t(from_2geom(*transform));
+ NR::Matrix const t(*transform);
return sp_svg_transform_write(&t);
}
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 9cce92ef8ca4400f7a016282baf8148e61f9800c..0eeac8c4f7c3008a9471f2a3e1cd0651703d1d42 100644 (file)
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants
NRRect bbox;
- sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(flowtext))), TRUE);
+ sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE);
NR::Point xy(bbox.x0, bbox.y0);
if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) {
sp_repr_set_svg_double(rtext, "x", xy[NR::X]);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 5e0e1ee8ea9880393eebf8e7bd8fb15799d9451b..6d26bee2b98422b0bbc92dc5330c91da7f0b893c 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
std::vector<NR::Point> quads;
if (tc->text != NULL)
- quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, from_2geom(sp_item_i2d_affine(tc->text)));
+ quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, sp_item_i2d_affine(tc->text));
for (unsigned i = 0 ; i < quads.size() ; i += 4) {
SPCanvasItem *quad_canvasitem;
quad_canvasitem = sp_canvas_item_new(sp_desktop_controls(tc->desktop), SP_TYPE_CTRLQUADR, NULL);
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index ffac0e2279d2277a839a48e83bb81d26d161fe56..be098b7e9ede655f0999ee55b5c2a2842cec9922 100644 (file)
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
Inkscape::Text::Layout::iterator
sp_te_get_position_by_coords (SPItem const *item, NR::Point &i_p)
{
- NR::Matrix im = from_2geom(sp_item_i2d_affine (item));
+ NR::Matrix im (sp_item_i2d_affine (item));
im = im.inverse();
NR::Point p = i_p * im;
@@ -948,7 +948,7 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- NR::Matrix t = from_2geom(sp_item_i2doc_affine(item));
+ NR::Matrix t (sp_item_i2doc_affine(item));
factor = factor / NR::expansion(t);
by = factor * by;
@@ -970,7 +970,7 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- NR::Matrix t = from_2geom(sp_item_i2doc_affine(text));
+ NR::Matrix t (sp_item_i2doc_affine(text));
factor = factor / NR::expansion(t);
Inkscape::Text::Layout const *layout = te_get_layout(text);
if (layout == NULL) return;
@@ -1055,7 +1055,7 @@ sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::it
gdouble const zoom = desktop->current_zoom();
gdouble const zby = (by
/ (zoom * (nb_let > 1 ? nb_let - 1 : 1))
- / NR::expansion(from_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj)))));
+ / NR::expansion(sp_item_i2doc_affine(SP_ITEM(source_obj))));
val += zby;
if (start == end) {
@@ -1127,7 +1127,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator
gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count));
// divide increment by matrix expansion
- NR::Matrix t = from_2geom(sp_item_i2doc_affine (SP_ITEM(text)));
+ NR::Matrix t (sp_item_i2doc_affine (SP_ITEM(text)));
zby = zby / NR::expansion(t);
switch (style->line_height.unit) {
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index e670a2db4fe3d62a47331a7dd3bf68f6ec5fc35d..86d7e6da2c467158ae51a2d22a3169e4cb627d4c 100644 (file)
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -366,7 +366,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
// skip those paths whose bboxes are entirely out of reach with our radius
- boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> bbox = item->getBounds(sp_item_i2doc_affine(item));
if (bbox) {
bbox->growBy(radius);
if (!bbox->contains(p)) {
@@ -384,7 +384,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
Shape *theShape = new Shape;
Shape *theRes = new Shape;
- NR::Matrix i2doc(from_2geom(sp_item_i2doc_affine(item)));
+ NR::Matrix i2doc(sp_item_i2doc_affine(item));
orig->ConvertWithBackData((0.08 - (0.07 * fidelity)) / NR::expansion(i2doc)); // default 0.059
orig->Fill(theShape, 0);
if (!gradient || !SP_IS_GRADIENT(gradient))
return;
- NR::Matrix i2d = from_2geom(sp_item_i2doc_affine (item));
+ NR::Matrix i2d (sp_item_i2doc_affine (item));
NR::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
if (!style) {
return false;
}
- boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)),
+ boost::optional<NR::Rect> bbox = item->getBounds(sp_item_i2doc_affine(item),
SPItem::GEOMETRIC_BBOX);
if (!bbox) {
return false;
index aa9d045e4f841a077f9fcd7ae6ac2434f410ebd7..20d0ea0a4f131aae5d8ba4c505e119cd17cb2a8f 100644 (file)
NRGC gc(NULL);
Geom::Matrix t(Geom::Scale(scale_factor, scale_factor));
- nr_arena_item_set_transform(root, from_2geom(t));
+ nr_arena_item_set_transform(root, t);
gc.transform.set_identity();
nr_arena_item_invoke_update( root, NULL, &gc,
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index ce506523a2b6ce9ed60f3a510c91befbb37463d6..36ceac0d10012def47ff9c3cf62c2e1de4a17974 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
// write the complete accumulated transform passed to us
// (we're dealing with unattached representations, so we write to their attributes
// instead of using sp_item_set_transform)
- gchar *transform_str = sp_svg_transform_write(from_2geom(sp_item_i2doc_affine(SP_ITEM(i->data))));
+ gchar *transform_str = sp_svg_transform_write(sp_item_i2doc_affine(SP_ITEM(i->data)));
obj_copy->setAttribute("transform", transform_str);
g_free(transform_str);
}
// we know that after pasting the upper left corner of the selection will be aligend to the corresponding
// page corner. Using the boundingbox of the selection is more foolproof though
if (sel_bbox) {
- Geom::Point pos_mouse = to_2geom(desktop->point()); //Location of mouse pointer in desktop coordinates
+ Geom::Point pos_mouse = desktop->point(); //Location of mouse pointer in desktop coordinates
// Now calculate how far we would have to move the pasted objects to get their
// midpoint at the location of the mouse pointer
rel_pos_mouse = pos_mouse - to_2geom(sel_bbox->midpoint());
index a512f984979109d25eb02c1323cfc03282b6e24b..4f9c33ff5946c642a33517184a65eaca0c26c36d 100644 (file)
boost::optional<NR::Rect> maybeArea(from_2geom(area));
sp_document_ensure_up_to_date (svgDoc);
sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea,
- from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE);
+ sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE);
NRArena *const arena = NRArena::create();
arena, key, SP_ITEM_SHOW_DISPLAY);
NRGC gc(NULL);
- gc.transform = from_2geom(Geom::Matrix(Geom::Scale(scaleFactor, scaleFactor)));
+ gc.transform = Geom::Matrix(Geom::Scale(scaleFactor, scaleFactor));
nr_arena_item_invoke_update (root, NULL, &gc,
NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
index ed89bf6aaf0945bb7acd2085b7ff5af4d9d27098..29b6c37dd42872bbd3b608422b92d928508fe841 100644 (file)
{
if (selection && !selection->isEmpty()) {
if (_check_replace_matrix.get_active()) {
- Geom::Matrix current (to_2geom(SP_ITEM(selection->itemList()->data)->transform)); // take from the first item in selection
+ Geom::Matrix current (SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection
Geom::Matrix new_displayed = current;
double f = _scalar_transform_f.getValue();
Geom::Matrix displayed (a, b, c, d, e, f);
- Geom::Matrix current = to_2geom(SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection
+ Geom::Matrix current = SP_ITEM(selection->itemList()->data)->transform; // take from the first item in selection
Geom::Matrix new_displayed;
if (_check_replace_matrix.get_active()) {
index 20b1056143a2604fcfd42528aa0b1c50859e2d80..5c6aa35e736c982bab00ca4dac62950d17d81cc8 100644 (file)
@@ -806,7 +806,7 @@ void sp_font_preview_set_font(SPFontPreview *fprev, font_instance *font, SPFontS
if (fprev->font)
{
Geom::Matrix flip(Geom::Scale(fsel->fontsize, -fsel->fontsize));
- fprev->rfont = fprev->font->RasterFont(from_2geom(flip), 0);
+ fprev->rfont = fprev->font->RasterFont(flip, 0);
}
if (GTK_WIDGET_DRAWABLE (fprev)) gtk_widget_queue_draw (GTK_WIDGET (fprev));
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index b460258edb78d5ee0f9e5912d3691aaf3cf7a78d..cdd356871c80d5d840c695a3d05b199ac28c297a 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- boost::optional<Geom::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
+ boost::optional<NR::Rect> nrdbox = SP_ITEM(object)->getBounds(i2doc);
+ boost::optional<Geom::Rect> dbox;
+ if (nrdbox) {
+ dbox = to_2geom(*nrdbox);
+ }
if ( SP_OBJECT_PARENT(object) == NULL )
{
NRGC gc(NULL);
/* Update to renderable state */
double sf = 1.0;
- nr_arena_item_set_transform(root, from_2geom(Geom::Scale(sf, sf)));
+ nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf));
gc.transform.set_identity();
nr_arena_item_invoke_update( root, NULL, &gc,
NR_ARENA_ITEM_STATE_ALL,
}
sf = (double)psize / (double)block;
- nr_arena_item_set_transform(root, from_2geom(Geom::Scale(sf, sf)));
+ nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf));
gc.transform.set_identity();
nr_arena_item_invoke_update( root, NULL, &gc,
NR_ARENA_ITEM_STATE_ALL,