summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3b1ee3b)
raw | patch | inline | side by side (parent: 3b1ee3b)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 12 Jun 2008 20:20:51 +0000 (20:20 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 12 Jun 2008 20:20:51 +0000 (20:20 +0000) |
61 files changed:
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index e1cbaf1ccb1aabd9419c62a554250c41ade09379..b8f7e30e686557d2f0f3e004ec889169eb64628e 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 (sp_item_i2d_affine (ac->item));
+ NR::Matrix const i2d (from_2geom(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 f4921bc1a31dcf6b930abc9e3521f4cef1595de4..2a8d24167c4fdf9ff4f0cb99cd71ed693004b123 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 (sp_item_i2d_affine (SP_ITEM(box)));
+ NR::Matrix const i2d (from_2geom(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 (sp_item_i2d_affine (SP_ITEM(box)));
+ NR::Matrix const i2d (from_2geom(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 e12351f75a292f6905cf6f5fb72491db0f5c2e03..7e764788d231ede5b16d6794dc6149a79e060751 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);
- NR::Maybe<NR::Rect> rHull = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (!rHull) {
return Avoid::newPoly(0);
}
index 99eb664c0f6ceeb01940b1bf20830a75c918d371..99fcb6659d7fb112b166404e4e3e38b536b6b269 100644 (file)
@@ -632,7 +632,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
g_assert( SP_IS_PATH(cc->clickeditem));
// Update the hidden path
- NR::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
+ NR::Matrix i2d = from_2geom(sp_item_i2d_affine(cc->clickeditem));
NR::Matrix d2i = i2d.inverse();
SPPath *path = SP_PATH(cc->clickeditem);
SPCurve *curve = (SP_SHAPE(path))->curve;
cc->newconn = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
cc->selection->set(repr);
Inkscape::GC::release(repr);
- cc->newconn->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
+ cc->newconn->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer()));
cc->newconn->updateRepr();
bool connection = false;
// Show the red path for dragging.
cc->red_curve = SP_PATH(cc->clickeditem)->curve->copy();
- NR::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
+ NR::Matrix i2d = from_2geom(sp_item_i2d_affine(cc->clickeditem));
cc->red_curve->transform(i2d);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
g_assert( SP_IS_PATH(item) );
SPCurve *curve = SP_SHAPE(SP_PATH(item))->curve;
- NR::Matrix i2d = sp_item_i2d_affine(item);
+ NR::Matrix i2d = from_2geom(sp_item_i2d_affine(item));
if (cc->active_conn == item)
{
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 3504dcf4070ffc0284816547751a8dda5e1c8a2c..4f4344f9b6f5244941e75915a3a205bea72a251a 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(sp_item_i2doc_affine(SP_ITEM(o)));
+ NR::Matrix const local(from_2geom(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 = sp_item_i2d_affine (SP_ITEM(l->data));
+ NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(l->data)));
SPObject *object = SP_OBJECT(l->data);
n_stroked ++;
- NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
+ NR::Matrix i2d = from_2geom(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(sp_item_i2d_affine(SP_ITEM(obj))); /// \todo FIXME: we assume non-% units here
+ size += style->font_size.computed * NR::expansion(from_2geom(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 = sp_item_i2d_affine (SP_ITEM(obj));
+ NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(obj)));
items ++;
index 1ce08bfdf40fe13720961c85420b8a736bc08a25..0b433fe3b2d7c3e3f8f3a17655688945973854b7 100644 (file)
x0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-x0", 0);
y0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-y0", 0);
} else {
- NR::Maybe<NR::Rect> r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)),
+ NR::Maybe<NR::Rect> r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))),
SPItem::GEOMETRIC_BBOX);
/* impl: Use of GEOMETRIC_BBOX is so that the stroke of rectangles will be shared
* (overlapped) rather than effectively doubled in width.
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index b79a4150f7b3b9b9c9efe30e2c90f7fb0de50c80..0e2a08eb4c4442f3ae08ab55c1fedc54489d1e0d 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
}
NRRect area;
- sp_item_invoke_bbox(item, &area, sp_item_i2r_affine((SPItem *) item), TRUE);
+ sp_item_invoke_bbox(item, &area, from_2geom(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 70cb84a7e9be63d16140ded25b79bf4a1c3e7760..f0eccb1464be2266414494a6c69f9776c1c73147 100644 (file)
return NULL; // sandbox broken?
// Find object's bbox in document
- NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Maybe<NR::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
+ Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
+ NR::Maybe<NR::Rect> dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc));
if (!dbox) {
return NULL;
index 289d42c8093de8fc8d78ef01771e71347e494d34..0c37e5ac0dc6587d2f61c64c8750e6703fb91d46 100644 (file)
using NR::X;
using NR::Y;
- NR::Maybe<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- NR::Maybe<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ NR::Maybe<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ NR::Maybe<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- NR::Maybe<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- NR::Maybe<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ NR::Maybe<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ NR::Maybe<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (!b) {
continue;
}
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(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);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(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) * affine);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
sp_item_write_transform(item, repr, item->transform, NULL);
SP_OBJECT (current_row->data)->updateRepr();
cnt +=1;
index eb5870d2eb77f51dea44c9dcc4e2c7451862f784..73131384fa4608ac0254ba459b256ff0bf521899 100644 (file)
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
return i->second;
}
- NR::Maybe<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
+ NR::Maybe<NR::Rect> r = item->getBounds(from_2geom(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 {
- NR::Maybe<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
+ NR::Maybe<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (r) {
wh = r->dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
//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) * move);
+ sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move));
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
}
//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) * move);
+ sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move));
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
}
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 7b42e219666d6ecced9e59c931e7a1bb7fb38cf6..ce6ccc0e48effd5798b81b2a0662208b31a75bce 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
/* Curve list */
/* We keep it in desktop coordinates to eliminate calculation errors */
SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item));
- norm->transform(sp_item_i2d_affine(dc->white_item));
+ norm->transform(from_2geom(sp_item_i2d_affine(dc->white_item)));
g_return_if_fail( norm != NULL );
dc->white_curves = g_slist_reverse(norm->split());
norm->unref();
/* Now we have to go back to item coordinates at last */
c->transform(( dc->white_item
- ? sp_item_dt2i_affine(dc->white_item)
+ ? from_2geom(sp_item_dt2i_affine(dc->white_item))
: sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc)) ));
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
dc->selection->set(repr);
Inkscape::GC::release(repr);
- item->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
+ item->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer()));
item->updateRepr();
}
index c6140d17d08e30ce0ae78699df481b84b05b9788..cd3a9158a06e387d4d222d6b8ebc28a80f60636b 100644 (file)
}
// calculate pointer point in the guide item's coords
- motion_to_curve = sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected);
+ motion_to_curve = from_2geom(sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected));
pointer = motion_dt * motion_to_curve;
// calculate the nearest point on the guide path
index 7ac9b9a2a87ca243f61a87c411004555b3049315..02bbfc8a392d2b30afd85754c1c1eb7b43025baf 100644 (file)
/* fixme: Think (Lauris) */
sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
- NR::Matrix const i2d = sp_item_i2d_affine(item);
+ NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item));
SPStyle* style = SP_OBJECT_STYLE (item);
CairoRenderer *renderer = ctx->getRenderer();
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// Get the bounding box of the selection
- //NR::Maybe<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)));
+ //NR::Maybe<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))));
// 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 = sp_item_i2d_affine (SP_ITEM(parent_object));
+ NR::Matrix eek = from_2geom(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, sp_item_i2r_affine(doc_item), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, from_2geom(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 5ee4b2f58b144abca5a0208f9666272e3c6c4ab2..0e231a60884e10008b1675510b358ea8f4a12331 100644 (file)
d.y1 = _height;
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE);
}
d.x0 *= IN_PER_PX;
index 9a570c2901a8d688877447f4f0f46b03f10dfbfc..33242b09e0c405cffba7d1655c9adac9d5d77377 100644 (file)
static NR::Matrix getODFTransform(const SPItem *item)
{
//### Get SVG-to-ODF transform
- NR::Matrix tf;
- tf = sp_item_i2d_affine(item);
+ NR::Matrix tf = from_2geom(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));
index ed6eee5467e8df9a357b7c91717fd5c34be87b34..dd6956a1e35b718e9f34beb41f5c539898bb2b91 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, sp_item_i2doc_affine (doc_item), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, from_2geom(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 = sp_item_i2doc_affine (doc_item);
+ t = from_2geom(sp_item_i2doc_affine (doc_item));
// subreact doc_item's transform (comes first) from it
t = NR::Matrix(doc_item->transform).inverse() * t;
index 6dd62206c20402ce101af71d7315ff91637ced89..55448a91ecbad7a1a14d1082ebb56601b5d6b1ff 100644 (file)
continue;
SPItem *item = SP_ITEM(reprobj);
- NR::Matrix tf = sp_item_i2d_affine(item);
+ NR::Matrix tf = from_2geom(sp_item_i2d_affine(item));
//### Get the Shape
if (!SP_IS_SHAPE(reprobj))//Bulia's suggestion. Allow all shapes
index 13024344d98c4bab7df8e8a917f8eca74a8253f7..299157555f763213592e7fc38fd675f5c33a48a5 100644 (file)
d.y1 = ceil(_height);
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
+ sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE);
// convert from px to pt
d.x0 *= PT_PER_PX;
d.x1 *= PT_PER_PX;
index 0be3252a9f3b874e25f6541d6c6e680b637aee09..90151d6d20135dc84eb2f8e85bab6e0abdcdb9ee 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 = sp_item_i2d_affine (item);
+ NR::Matrix i2d = from_2geom(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 = sp_item_i2d_affine (item);
+ NR::Matrix i2d = from_2geom(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 083b87fa20ba7dc7c5880e70e62276551b70d272..fa1f5ae23fe415d74046c386bf9f91adf9298a74 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 = sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer()));
+ NR::Matrix local = from_2geom(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 3e6a70174b8702dd78de5f2397c19b386fec86ad..9fade37ecdcb042f5b430aad95b9989a6ccfc84d 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 = sp_item_i2d_affine (item);
+ NR::Matrix i2d = from_2geom(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) * sp_item_i2d_affine(item);
+ p *= NR::Matrix(gradient->gradientTransform) * from_2geom(sp_item_i2d_affine(item));
return p;
}
diff --git a/src/interface.cpp b/src/interface.cpp
index 2c73592f1c3f1b48505691d3990dcaa3bd71a194..1ad90c58c5746f1dfde172fc477b812407357fd3 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(sp_item_i2d_affine(item)) * 0.5
+ NR::expansion(from_2geom(sp_item_i2d_affine(item))) * 0.5
: 0.0)
+ prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
index 1fa7217464c76458dfc40199df42976c306d490e..a587a3af0cef1c4fe19bcc73102a0e1842a57da6 100644 (file)
void
KnotHolderEntity::update_knot()
{
- NR::Matrix const i2d(sp_item_i2d_affine(item));
+ NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item)));
NR::Point dp(knot_get() * i2d);
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 781d5a3bca0f0ea5396378a3a64d1e883a785a52..eeddf2eb083d8d57fc87eccd53f4fd4d866d5c44 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
void
KnotHolder::update_knots()
{
- NR::Matrix const i2d(sp_item_i2d_affine(item));
+ NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item)));
for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
KnotHolderEntity *e = *i;
for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
KnotHolderEntity *e = *i;
if (e->knot == knot) {
- NR::Point const q = *p / sp_item_i2d_affine(item);
- e->knot_set(q, e->knot->drag_origin / sp_item_i2d_affine(item), state);
+ NR::Point const q = *p / from_2geom(sp_item_i2d_affine(item));
+ e->knot_set(q, e->knot->drag_origin / from_2geom(sp_item_i2d_affine(item)), state);
break;
}
}
index ada321ef3441c98c4a0b6654fc9dc004f23786a0..7c08bdb08ff07488675e944b58cc277c22f65fbb 100644 (file)
void
path_set_start_end(SPItem *item, NR::Point const &p, bool start) {
SPCurve* curve = sp_path_get_curve_for_edit (SP_PATH(item)); // TODO: Should we use sp_shape_get_curve()?
- NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(item)));
+ Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(item)));
Geom::Point A, B;
if (start) {
index f797d03582ef379acead9573222f6bc9a6443954..1ec443a5f282f1a6094d8097f722e8a462baf939 100644 (file)
NR::Matrix transform;
if (absolute) {
- transform = sp_item_i2doc_affine(item);
+ transform = from_2geom(sp_item_i2doc_affine(item));
}
else {
transform = NR::identity();
diff --git a/src/live_effects/parameter/pointparam-knotholder.cpp b/src/live_effects/parameter/pointparam-knotholder.cpp
index f59b2f7eb75154e431b91fe870aab1d82f0e8c82..65105412085f3d0bea2cf7057c87d00e674a80ec 100644 (file)
entity.push_back(e);
// Move to current point.
- NR::Point dp = p * sp_item_i2d_affine(item);
+ NR::Point dp = p * from_2geom(sp_item_i2d_affine(item));
sp_knot_set_position(e->knot, &dp, SP_KNOT_STATE_NORMAL);
e->handler_id = g_signal_connect(e->knot, "moved", G_CALLBACK(pointparam_knot_moved_handler), this);
@@ -112,7 +112,7 @@ static void pointparam_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, P
*/
static void pointparam_knot_moved_handler(SPKnot */*knot*/, NR::Point const *p, guint /*state*/, PointParamKnotHolder *kh)
{
- NR::Matrix const i2d(sp_item_i2d_affine(kh->item));
+ NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(kh->item)));
NR::Point pos = (*p) / i2d;
Inkscape::SVGOStringStream os;
static void pointparam_knot_ungrabbed_handler(SPKnot *knot, unsigned int /*state*/, PointParamKnotHolder *kh)
{
- NR::Matrix const i2d(sp_item_i2d_affine(kh->item));
+ NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(kh->item)));
NR::Point pos = sp_knot_position(knot) / i2d;
Inkscape::SVGOStringStream os;
diff --git a/src/main.cpp b/src/main.cpp
index 6eae51c0c2855fa465e5ba3434aced2e41710ef5..6ec0ca6b405df1bea3eaccd8411d254bc1a658be 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
- NR::Maybe<NR::Rect> area = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (area) {
Inkscape::SVGOStringStream os;
if (extent) {
{
SPItem *item = ((SPItem *) o);
if (o->id && SP_IS_ITEM(item)) {
- NR::Maybe<NR::Rect> area = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> area = item->getBounds(from_2geom(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, sp_item_i2r_affine((SPItem *) o_area), TRUE);
+ sp_item_invoke_bbox((SPItem *) o_area, &area, from_2geom(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/node-context.cpp b/src/node-context.cpp
index 286f55c4b2bcbe81770c383b5976e2b1c681096b..40b98336095ff5e84f2d5bc6f52f99ac3420497e 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
// This should be put somewhere else under the name of "generate helperpath" or something. Because basically this is copied of code from nodepath...
SPCurve *curve_new = sp_path_get_curve_for_edit(path);
SPCurve *flash_curve = curve_new->copy();
- flash_curve->transform(sp_item_i2d_affine(SP_ITEM(path)));
+ flash_curve->transform(from_2geom(sp_item_i2d_affine(SP_ITEM(path))));
SPCanvasItem * canvasitem = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), flash_curve);
// would be nice if its color could be XORed or something, now it is invisible for red stroked objects...
// unless we also flash the nodes...
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 634604518a85b2fb6c44d2ed2d5775f0a5a967a6..7e7e19870a5587c132aa3a8bfa39406d2ac8ecaa 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
// to a change in repr by regenerating nodepath --bb
sp_object_read_attr(SP_OBJECT(np->item), "transform");
- np->i2d = sp_item_i2d_affine(np->item);
+ np->i2d = from_2geom(sp_item_i2d_affine(np->item));
np->d2i = np->i2d.inverse();
np->repr = repr;
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index de7fbccec296adbf4f77a4d20396234ac6b8a230..94c3c5daf4069487b1cfc9cda1345eef0651ffbe 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
static NR::Point snap_knot_position(SPItem *item, NR::Point const &p)
{
SPDesktop const *desktop = inkscape_active_desktop();
- NR::Matrix const i2d (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
NR::Point s = p * i2d;
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, item);
@@ -464,7 +464,7 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, NR::
g_assert(item != NULL);
SPBox3D *box = SP_BOX3D(item);
- NR::Matrix const i2d (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
Box3D::Axis movement;
if ((knot_id < 4) != (state & GDK_SHIFT_MASK)) {
NR::Point const s = snap_knot_position(item, new_pos);
SPBox3D *box = SP_BOX3D(item);
- NR::Matrix const i2d (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
box3d_set_center (SP_BOX3D(item), s * i2d, origin * i2d, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z,
state & GDK_CONTROL_MASK);
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 2584d5b49521be475aa5ba6846943d0e67f502b0..88e709b7fb4eb3591452544e3c3842ac3f2d5635 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -289,7 +289,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
root_item = sp_use_root(SP_USE(*i));
g_return_if_fail(root_item);
} else {
- i2doc = sp_item_i2doc_affine(*i);
+ i2doc = from_2geom(sp_item_i2doc_affine(*i));
root_item = *i;
}
diff --git a/src/selcue.cpp b/src/selcue.cpp
index 48df1cf8a814478f7bc07cf3e1b071a48919a33f..bac12fe802f6ec25391ba30070c1b589239043a0 100644 (file)
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline
Inkscape::Text::Layout const *layout = te_get_layout(item);
if (layout != NULL) {
- NR::Point a = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
+ NR::Point a = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(item));
baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL,
"mode", SP_CTRL_MODE_XOR,
"size", 4.0,
index 91c518766f4fa339dd12f827b3227897795c288b..f35e28f9a7bce8acf7212cae82a8b777bc793186 100644 (file)
@@ -130,7 +130,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), sp_item_i2doc_affine(SP_ITEM (i->data)), clip, xml_doc);
+ sp_selection_copy_one (SP_OBJECT_REPR (i->data), from_2geom(sp_item_i2doc_affine(SP_ITEM (i->data))), clip, xml_doc);
}
*clip = g_slist_reverse(*clip);
@@ -148,7 +148,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 = sp_item_i2doc_affine(SP_ITEM(parent));
+ NR::Matrix local = from_2geom(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 *= sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent())));
+ item_t *= from_2geom(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(sp_item_i2doc_affine(item));
+ double ex = NR::expansion(from_2geom(sp_item_i2doc_affine(item)));
if (ex != 1.0) {
css = sp_css_attr_scale (css, ex);
}
@@ -1172,9 +1172,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 = sp_item_i2root_affine(SP_ITEM(SP_OBJECT_PARENT (item)));
- NR::Matrix t = parent_transform * matrix_to_desktop (matrix_from_desktop (affine, item), item) * parent_transform.inverse();
- NR::Matrix t_inv =parent_transform * matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item) * parent_transform.inverse();
+ 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 result = t_inv * item->transform * t;
if ((prefs_parallel || prefs_unmoved) && affine.is_translation()) {
@@ -1202,7 +1202,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) * affine);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
}
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL);
}
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT (items->data);
- NR::Matrix parent_transform = sp_item_i2root_affine(SP_ITEM(parent));
+ NR::Matrix parent_transform = from_2geom(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 = sp_item_i2root_affine(SP_ITEM(parent));
+ NR::Matrix parent_transform = from_2geom(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 = sp_item_i2d_affine (SP_ITEM(parent_object));
+ NR::Matrix eek = from_2geom(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);
- NR::Maybe<NR::Rect> const bbox(root->getBounds(sp_item_i2r_affine(root)));
+ NR::Maybe<NR::Rect> const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root))));
if (bbox && !bbox->isEmpty()) {
doc->fitToRect(*bbox);
}
diff --git a/src/selection.cpp b/src/selection.cpp
index 41540c95c99b982333230c8fbafd614b8da70113..acab9396c86bb29b758a951e8b06d9dfb888373f 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(sp_item_i2doc_affine(item));
+ NR::Matrix i2doc(from_2geom(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 2c021a724f98b147a25863ef38a96cbde2ec35b7..3d5c19b8ca1970a77cc7333b41e6d683958c9b0e 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -269,7 +269,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(sp_item_i2d_affine(it));
+ _items_affines.push_back(from_2geom(sp_item_i2d_affine(it)));
_items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers
}
@@ -373,7 +373,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, prev_transform * affine);
+ sp_item_set_i2d_affine(&item, to_2geom(prev_transform * affine));
}
} else {
if (_bbox) {
NR::Matrix const *new_affine;
if (_show == SHOW_OUTLINE) {
- NR::Matrix const i2d(sp_item_i2d_affine(original_item));
+ NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(original_item)));
NR::Matrix const i2dnew( i2d * _current_relative_affine );
- sp_item_set_i2d_affine(copy_item, i2dnew);
+ sp_item_set_i2d_affine(copy_item, to_2geom(i2dnew));
new_affine = ©_item->transform;
} else {
new_affine = &original_item->transform;
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 9cfa83af1f864da5d53cfad5ad45d5f180838e68..b975d3f79ac98fb4777db384cfa36bfa6fd31b28 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 *= sp_item_dt2i_affine(item);
+ this->curvepoint_doc *= from_2geom(sp_item_dt2i_affine(item));
sp_nodepath_ensure_livarot_path(this->nodepath);
(( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed * 0.5 *
- NR::expansion(sp_item_i2d_affine(item))
+ NR::expansion(from_2geom(sp_item_i2d_affine(item)))
: 0.0)
- + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(sp_item_i2d_affine(item));
+ + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(from_2geom(sp_item_i2d_affine(item)));
bool close = (NR::L2 (delta) < stroke_tolerance);
if (remember && close) {
index 04591aaba3cbcbd565b62a7e01c1e17d1bc144a1..786209fdae0a4a859286a85aed84c59f45e55529 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] ) {
- NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
+ NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(from_2geom(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 f610a87907aedb0ad5ea5c92508abe59dcca61f7..80ecb060f23704ff292382c080b45a00bc35d72e 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(i2anc_affine(path_item, ancestor));
+ NR::Matrix const path2anc(from_2geom(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] = i2anc_affine(h2attItem[h], ancestor);
+ h2i2anc[h] = from_2geom(i2anc_affine(h2attItem[h], ancestor));
h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint();
}
}
h2bbox_icoordsys[ind] = *bbox;
- h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
+ h2i2anc = from_2geom(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 d2750b76580bb7807e6ed499b3181c385af46a33..087c323f12d4af3bedf0eda18890121570420a65 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 = sp_item_i2d_affine(item);
+ NR::Matrix const i2d = from_2geom(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 3a6cdeee3bd880a673f987880d786b1a7cbc04c7..61fcdd08c0bd2b5fda91a6d9a6d5f75482c31388 100644 (file)
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
{
SPObject* object=SP_OBJECT(this);
- NR::Matrix itr_mat=sp_item_i2root_affine (SP_ITEM(object));
- itr_mat=itr_mat.inverse();
+ NR::Matrix itr_mat = from_2geom(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 *it;
{
SPObject* object=SP_OBJECT(this);
- if (computed) {
+ if (computed) {
delete computed;
computed = NULL;
}
- NR::Matrix itr_mat=sp_item_i2root_affine (SP_ITEM(object));
- itr_mat=itr_mat.inverse();
+ NR::Matrix itr_mat = from_2geom(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) ) {
GetDest(child,&computed,itr_mat);
if ( curve ) {
Path* temp=new Path;
- NR::Matrix tr_mat=sp_item_i2root_affine (SP_ITEM(u_child));
+ NR::Matrix tr_mat = from_2geom(sp_item_i2root_affine (SP_ITEM(u_child)));
tr_mat=itr_mat*tr_mat;
temp->LoadArtBPath(SP_CURVE_BPATH(curve),tr_mat,true);
Shape* n_shp=new Shape;
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index d47d52dbefa2864a923f9a0483f05aa1edac6a20..596d47ba4dacda946f3f469924bd678afa6975fa 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 = sp_item_i2d_affine(item);
+ NR::Matrix const ctm = from_2geom(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 44479de128c394b38d1f56370eeae05f09302494..f2f2265ea5b54d754b241e284321f8e5639aa8f1 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 (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
*p = NR::Point(x0, y0) * i2d;
*p = NR::Point(x0, y1) * i2d;
*p = NR::Point(x1, y1) * i2d;
index 391766fb6ff679c2db1829e71f949234a7fcd7db..bf739301336c4cc59dbaa8fbd4367c383a153764 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) * tr);
+ sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * to_2geom(tr));
/// \todo Reget snappoints, check satisfied.
if (commit) {
index 08c4d167b2c1672be331110a0df3e0a736618ace..4caf155bfdad7ec4cb771e4e418dfbfb39264306 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) * affine);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(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);
NR::Maybe<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) * inverse(s) * scale * s);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(NR::Matrix(inverse(s)) * 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) * affine);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(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) * tr);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(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 8fa93427822a3c55b9175aa36c951c900158f1b6..10f2683b83687be2055718ae2bbed7a3c7fb5a55 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
#include "libnr/nr-convert2geom.h"
#include "algorithms/find-last-if.h"
#include "util/reverse-list.h"
+#include <2geom/rect.h>
+#include <2geom/transforms.h>
#include "xml/repr.h"
#include "extract-uri.h"
*/
void
SPItem::setCenter(NR::Point object_centre) {
- NR::Maybe<NR::Rect> bbox = getBounds(sp_item_i2d_affine(this));
+ NR::Maybe<NR::Rect> bbox = getBounds(from_2geom(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 {
- NR::Maybe<NR::Rect> bbox = getBounds(sp_item_i2d_affine(this));
+ NR::Maybe<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
if (bbox) {
return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
} else {
return r;
}
+NR::Maybe<Geom::Rect>
+SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/)
+const
+{
+ NR::Maybe<NR::Rect> r = NR::Nothing();
+ sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE);
+ return NR::Maybe<Geom::Rect>(to_2geom(*r));
+}
+
void
sp_item_invoke_bbox(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
@@ -783,7 +794,7 @@ sp_item_invoke_bbox_full(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matr
}
// transform the expansions by the item's transform:
- NR::Matrix i2d = sp_item_i2d_affine (item);
+ NR::Matrix i2d = from_2geom(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, sp_item_i2d_affine(item), TRUE, type);
+ sp_item_invoke_bbox(item, bbox, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
}
NR::Maybe<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
{
NR::Maybe<NR::Rect> rect = NR::Nothing();
- sp_item_invoke_bbox(item, &rect, sp_item_i2d_affine(item), TRUE, type);
+ sp_item_invoke_bbox(item, &rect, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
return rect;
}
static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
{
- NR::Maybe<NR::Rect> bbox = item->getBounds(sp_item_i2d_affine(item));
+ NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
/* Just the corners of the bounding box suffices given that we don't yet
support angled guide lines. */
* \pre \a ancestor really is an ancestor (\>=) of \a object, or NULL.
* ("Ancestor (\>=)" here includes as far as \a object itself.)
*/
-NR::Matrix
+Geom::Matrix
i2anc_affine(SPObject const *object, SPObject const *const ancestor) {
- NR::Matrix ret(NR::identity());
+ Geom::Matrix ret(Geom::identity());
g_return_val_if_fail(object != NULL, ret);
/* stop at first non-renderable ancestor */
while ( object != ancestor && SP_IS_ITEM(object) ) {
if (SP_IS_ROOT(object)) {
- ret *= SP_ROOT(object)->c2p;
+ ret *= to_2geom(SP_ROOT(object)->c2p);
}
- ret *= SP_ITEM(object)->transform;
+ ret *= to_2geom(SP_ITEM(object)->transform);
object = SP_OBJECT_PARENT(object);
}
return ret;
}
-NR::Matrix
+Geom::Matrix
i2i_affine(SPObject const *src, SPObject const *dest) {
- g_return_val_if_fail(src != NULL && dest != NULL, NR::identity());
+ g_return_val_if_fail(src != NULL && dest != NULL, Geom::identity());
SPObject const *ancestor = src->nearestCommonAncestor(dest);
- return i2anc_affine(src, ancestor) / i2anc_affine(dest, ancestor);
+ return to_2geom( from_2geom(i2anc_affine(src, ancestor)) / from_2geom(i2anc_affine(dest, ancestor)) );
}
NR::Matrix SPItem::getRelativeTransform(SPObject const *dest) const {
- return i2i_affine(this, dest);
+ return from_2geom(i2i_affine(this, dest));
}
/**
* Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
* \pre (item != NULL) and SP_IS_ITEM(item).
*/
-NR::Matrix sp_item_i2doc_affine(SPItem const *item)
+Geom::Matrix sp_item_i2doc_affine(SPItem const *item)
{
return i2anc_affine(item, NULL);
}
* Used in path operations mostly.
* \pre (item != NULL) and SP_IS_ITEM(item).
*/
-NR::Matrix sp_item_i2root_affine(SPItem const *item)
+Geom::Matrix sp_item_i2root_affine(SPItem const *item)
{
g_assert(item != NULL);
g_assert(SP_IS_ITEM(item));
- NR::Matrix ret(NR::identity());
- g_assert(ret.test_identity());
+ Geom::Matrix ret(Geom::identity());
+ g_assert(ret.isIdentity());
while ( NULL != SP_OBJECT_PARENT(item) ) {
- ret *= item->transform;
+ ret *= to_2geom(item->transform);
item = SP_ITEM(SP_OBJECT_PARENT(item));
}
g_assert(SP_IS_ROOT(item));
- ret *= item->transform;
+ ret *= to_2geom(item->transform);
return ret;
}
/* fixme: This is EVIL!!! */
-
-NR::Matrix sp_item_i2d_affine(SPItem const *item)
+// fix this note: why/what evil? :)
+Geom::Matrix sp_item_i2d_affine(SPItem const *item)
{
g_assert(item != NULL);
g_assert(SP_IS_ITEM(item));
- NR::Matrix const ret( sp_item_i2doc_affine(item)
- * NR::scale(1, -1)
- * NR::translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
+ Geom::Matrix const ret( sp_item_i2doc_affine(item)
+ * Geom::Scale(1, -1)
+ * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
return ret;
}
// same as i2d but with i2root instead of i2doc
-NR::Matrix sp_item_i2r_affine(SPItem const *item)
+Geom::Matrix sp_item_i2r_affine(SPItem const *item)
{
g_assert(item != NULL);
g_assert(SP_IS_ITEM(item));
- NR::Matrix const ret( sp_item_i2root_affine(item)
- * NR::scale(1, -1)
- * NR::translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
+ Geom::Matrix const ret( sp_item_i2root_affine(item)
+ * Geom::Scale(1, -1)
+ * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
return ret;
}
* Converts a matrix \a m into the desktop coords of the \a item.
* Will become a noop when we eliminate the coordinate flipping.
*/
-NR::Matrix matrix_to_desktop(NR::Matrix const m, SPItem const *item)
+Geom::Matrix matrix_to_desktop(Geom::Matrix const m, SPItem const *item)
{
- NR::Matrix const ret(m
- * NR::translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
- * NR::scale(1, -1));
+ Geom::Matrix const ret(m
+ * Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
+ * Geom::Scale(1, -1));
return ret;
}
* Converts a matrix \a m from the desktop coords of the \a item.
* Will become a noop when we eliminate the coordinate flipping.
*/
-NR::Matrix matrix_from_desktop(NR::Matrix const m, SPItem const *item)
+Geom::Matrix matrix_from_desktop(Geom::Matrix const m, SPItem const *item)
{
- NR::Matrix const ret(NR::scale(1, -1)
- * NR::translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item)))
+ Geom::Matrix const ret(Geom::Scale(1, -1)
+ * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item)))
* m);
return ret;
}
-void sp_item_set_i2d_affine(SPItem *item, NR::Matrix const &i2dt)
+void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt)
{
g_return_if_fail( item != NULL );
g_return_if_fail( SP_IS_ITEM(item) );
- NR::Matrix dt2p; /* desktop to item parent transform */
+ Geom::Matrix dt2p; /* desktop to item parent transform */
if (SP_OBJECT_PARENT(item)) {
dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse();
} else {
- dt2p = ( NR::translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
- * NR::scale(1, -1) );
+ dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
+ * Geom::Scale(1, -1) );
}
- NR::Matrix const i2p( i2dt * dt2p );
- sp_item_set_item_transform(item, i2p);
+ Geom::Matrix const i2p( i2dt * dt2p );
+ sp_item_set_item_transform(item, from_2geom(i2p));
}
-NR::Matrix
+Geom::Matrix
sp_item_dt2i_affine(SPItem const *item)
{
/* fixme: Implement the right way (Lauris) */
diff --git a/src/sp-item.h b/src/sp-item.h
index 96981aa1d7b1bd5cedc1655902488ddd53971265..814581a5d839a3b1c485df875f157b0dac9cb5c4 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
#include "sp-object.h"
#include <libnr/nr-matrix.h>
#include <libnr/nr-rect.h>
+#include <2geom/forward.h>
+#include <libnr/nr-convert2geom.h>
class SPGuideConstraint;
struct SPClipPathReference;
void lowerToBottom();
NR::Maybe<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
+ NR::Maybe<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;
void sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
NR::Maybe<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
-NR::Matrix i2anc_affine(SPObject const *item, SPObject const *ancestor);
-NR::Matrix i2i_affine(SPObject const *src, SPObject const *dest);
+Geom::Matrix i2anc_affine(SPObject const *item, SPObject const *ancestor);
+Geom::Matrix i2i_affine(SPObject const *src, SPObject const *dest);
-NR::Matrix sp_item_i2doc_affine(SPItem const *item);
-NR::Matrix sp_item_i2root_affine(SPItem const *item);
+Geom::Matrix sp_item_i2doc_affine(SPItem const *item);
+Geom::Matrix sp_item_i2root_affine(SPItem const *item);
-NR::Matrix matrix_to_desktop (NR::Matrix m, SPItem const *item);
-NR::Matrix matrix_from_desktop (NR::Matrix m, SPItem const *item);
+Geom::Matrix matrix_to_desktop (Geom::Matrix m, SPItem const *item);
+Geom::Matrix matrix_from_desktop (Geom::Matrix m, SPItem const *item);
/* fixme: - these are evil, but OK */
*
* \return TRANSFORM.
*/
-NR::Matrix sp_item_i2d_affine(SPItem const *item);
-NR::Matrix sp_item_i2r_affine(SPItem const *item);
-void sp_item_set_i2d_affine(SPItem *item, NR::Matrix const &transform);
-NR::Matrix sp_item_dt2i_affine(SPItem const *item);
+Geom::Matrix sp_item_i2d_affine(SPItem const *item);
+Geom::Matrix sp_item_i2r_affine(SPItem const *item);
+void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &transform);
+Geom::Matrix sp_item_dt2i_affine(SPItem const *item);
int sp_item_repr_compare_position(SPItem *first, SPItem *second);
SPItem *sp_item_first_item_child (SPObject *obj);
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 173e44440288135c1e1efd2409a83fe913cf8c7d..16c8b85f40801d678d97f96e9cc2c6b7c38e231e 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
SPDocument *doc = SP_OBJECT_DOCUMENT(path);
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- NR::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(path)));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine(SP_ITEM(path))));
SPCurve *curve = SP_SHAPE(path)->curve;
if (!curve) return;
@@ -514,7 +514,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 (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(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 072c52199701d8b8e41c9a61a92015501cf0e170..7d3cd1c0c5639f53de382da822380d3293b2e03b 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
SPRect *rect = SP_RECT(item);
- NR::Matrix const i2d (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(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;
SPDocument *doc = SP_OBJECT_DOCUMENT(rect);
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- NR::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect)));
+ NR::Matrix const i2d (from_2geom(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 2ed92c5f51d36f44dad23f3edebae150609868e7..4ae2a98f878e5cd3027fc6a985f18e9a0bcce9f6 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
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 = sp_item_i2d_affine(item);
+ NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item));
SPStyle* style = SP_OBJECT_STYLE (item);
return;
}
- NR::Matrix const i2d (sp_item_i2d_affine (item));
+ NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item)));
NArtBpath const *b = SP_CURVE_BPATH(shape->curve);
// Cycle through the nodes in the concatenated subpaths
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index ceb8dc5a5639dec86a57cd233217b7daabb7e817..8e4b732bc7e4ff35d88987b9eff3344d105d1046 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
// the baseline anchor of the first char
Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
if(layout != NULL) {
- *p = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
+ *p = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(item));
}
}
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 = sp_item_i2d_affine(item);
+ NR::Matrix const ctm = from_2geom(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 c86c852d7eb14d3316e1b72774dc4595e6f87192..0b3be70723fdb5ea22f8071247a63d2917dcb1ba 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, sp_item_i2doc_affine(SP_ITEM(text)), TRUE);
+ sp_item_invoke_bbox(SP_ITEM(text), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(text))), TRUE);
NR::Point xy(bbox.x0, bbox.y0);
// make a list of textpath children
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 382f857cf1b54a456fd23184010f8c8af9703fc7..5868140a6d25b101fe677b514e1c2cd51b84da8b 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -459,7 +459,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 = sp_item_i2root_affine(item_source);
+ NR::Matrix i2root = from_2geom(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);
@@ -491,7 +491,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 = sp_item_i2doc_affine(parent_item);
+ NR::Matrix local = from_2geom(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
continue;
if (simplifyIndividualPaths) {
- NR::Maybe<NR::Rect> itemBbox = item->getBounds(sp_item_i2d_affine(item));
+ NR::Maybe<NR::Rect> itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (itemBbox) {
simplifySize = L2(itemBbox->dimensions());
} else {
@@ -1753,7 +1753,7 @@ bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transf
NArtBpath *new_bpath; // we will get a duplicate which has to be freed at some point!
if (doTransformation) {
if (transformFull) {
- new_bpath = nr_artpath_affine(bpath, sp_item_i2doc_affine(item));
+ new_bpath = nr_artpath_affine(bpath, from_2geom(sp_item_i2doc_affine(item)));
} else {
new_bpath = nr_artpath_affine(bpath, item->transform);
}
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 0eeac8c4f7c3008a9471f2a3e1cd0651703d1d42..9cce92ef8ca4400f7a016282baf8148e61f9800c 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, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE);
+ sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, from_2geom(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 dc4de38e7dcd76a6c3801d50bef1a5528f1875ca..4e1fa87e160c7ac808ce3c84db0d1905e0dee985 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
if (tc->text) {
NR::Point p0, p1;
sp_te_get_cursor_coords(tc->text, tc->text_sel_end, p0, p1);
- NR::Point const d0 = p0 * sp_item_i2d_affine(SP_ITEM(tc->text));
- NR::Point const d1 = p1 * sp_item_i2d_affine(SP_ITEM(tc->text));
+ NR::Point const d0 = p0 * from_2geom(sp_item_i2d_affine(SP_ITEM(tc->text)));
+ NR::Point const d1 = p1 * from_2geom(sp_item_i2d_affine(SP_ITEM(tc->text)));
// scroll to show cursor
if (scroll_to_see) {
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, sp_item_i2d_affine(tc->text));
+ quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, from_2geom(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 a225c1a00e205b3ce8bb07667e685dd77fa3fbf9..b103a01087560a4d44ae90a3815986342142da63 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=sp_item_i2d_affine (item);
+ NR::Matrix im = from_2geom(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 = sp_item_i2doc_affine(item);
+ NR::Matrix t = from_2geom(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 = sp_item_i2doc_affine(text);
+ NR::Matrix t = from_2geom(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(sp_item_i2doc_affine(SP_ITEM(source_obj))));
+ / NR::expansion(from_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj)))));
val += zby;
if (start == end) {
@@ -1114,7 +1114,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 = sp_item_i2doc_affine (SP_ITEM(text));
+ NR::Matrix t = from_2geom(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 e4b88ffea65ad7bb0634eabe31b9dea99c7f07fe..509194612c16c40c214fabf0a1987a9b8fa4c1e5 100644 (file)
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -373,7 +373,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
- NR::Maybe<NR::Rect> bbox = item->getBounds(sp_item_i2doc_affine(item));
+ NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (bbox) {
bbox->growBy(radius);
if (!bbox->contains(p)) {
@@ -391,7 +391,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
Shape *theShape = new Shape;
Shape *theRes = new Shape;
- NR::Matrix i2doc(sp_item_i2doc_affine(item));
+ NR::Matrix i2doc(from_2geom(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 = sp_item_i2doc_affine (item);
+ NR::Matrix i2d = from_2geom(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;
}
- NR::Maybe<NR::Rect> bbox = item->getBounds(sp_item_i2doc_affine(item),
+ NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)),
SPItem::GEOMETRIC_BBOX);
if (!bbox) {
return false;
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 227d57a964f240a2b141ce9e7dab20d4e4fbec70..991a699114e30e78ff94c7df0ca77884a6578a97 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(sp_item_i2doc_affine(SP_ITEM(i->data)));
+ gchar *transform_str = sp_svg_transform_write(from_2geom(sp_item_i2doc_affine(SP_ITEM(i->data))));
obj_copy->setAttribute("transform", transform_str);
g_free(transform_str);
}
index 68c083c6f5341da6627ef7f2aeb7b41231ea4881..8c154d87a53d48e66ec589cabc39ad636d84638a 100644 (file)
{
if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
Inkscape::Text::Layout const *layout = te_get_layout(*it);
- NR::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it);
+ NR::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
if (base[NR::X] < b_min[NR::X]) b_min[NR::X] = base[NR::X];
if (base[NR::Y] < b_min[NR::Y]) b_min[NR::Y] = base[NR::Y];
if (base[NR::X] > b_max[NR::X]) b_max[NR::X] = base[NR::X];
{
if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
Inkscape::Text::Layout const *layout = te_get_layout(*it);
- NR::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it);
+ NR::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
NR::Point t(0.0, 0.0);
t[_orientation] = b_min[_orientation] - base[_orientation];
sp_item_move_rel(*it, NR::translate(t));
index ed257a49a68f23ee7143ee23d4712afcbc5376a4..d26762bd3c27547249f7332a067367cecfecdd2f 100644 (file)
NR::Maybe<NR::Rect> maybeArea(area);
sp_document_ensure_up_to_date (svgDoc);
sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea,
- sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE);
+ from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE);
NRArena *const arena = NRArena::create();
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 498a2499807a3f65628f1266a26f08062fe049df..3f398b9e67dbebfe3ff22c9f4684b96cc7e5ae65 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
- NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
+ NR::Matrix const i2doc(from_2geom(sp_item_i2doc_affine(SP_ITEM(object))));
NR::Maybe<NR::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
if ( SP_OBJECT_PARENT(object) == NULL )