From e3b47cad258d5e207249409ab5105a2cd11efa01 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Wed, 6 Aug 2008 21:23:19 +0000 Subject: [PATCH] src/helper 2geomified --- src/helper/geom.cpp | 28 ---------------------------- src/helper/geom.h | 3 --- src/helper/pixbuf-ops.cpp | 20 ++++++++++---------- src/helper/png-write.cpp | 6 +++--- 4 files changed, 13 insertions(+), 44 deletions(-) diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index bf487f652..caa169a27 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -461,34 +461,6 @@ pathv_matrix_point_bbox_wind_distance (Geom::PathVector const & pathv, Geom::Mat } } -// temporary wrapper -void -pathv_matrix_point_bbox_wind_distance (Geom::PathVector const & pathv, NR::Matrix const &m, NR::Point const &pt, - NR::Rect *bbox, int *wind, NR::Coord *dist, - NR::Coord tolerance, NR::Rect const *viewbox) -{ - Geom::Rect _bbox; - if (bbox) - _bbox = to_2geom(*bbox); - Geom::Coord _dist; - if (dist) - _dist = *dist; - Geom::Rect _viewbox; - if (viewbox) - _viewbox = to_2geom(*viewbox); - - pathv_matrix_point_bbox_wind_distance( pathv, to_2geom(m), to_2geom(pt), - bbox ? &_bbox : NULL, - wind, - dist ? &_dist : NULL, - tolerance, - viewbox ? &_viewbox : NULL ); - - if (bbox) - *bbox = from_2geom(_bbox); - if (dist) - *dist = _dist; -} //################################################################################# /* diff --git a/src/helper/geom.h b/src/helper/geom.h index 9b6dd0f35..e4cb38fa7 100644 --- a/src/helper/geom.h +++ b/src/helper/geom.h @@ -19,9 +19,6 @@ Geom::Rect bounds_fast_transformed(Geom::PathVector const & pv, Geom::Matrix const & t); Geom::Rect bounds_exact_transformed(Geom::PathVector const & pv, Geom::Matrix const & t); -void pathv_matrix_point_bbox_wind_distance ( Geom::PathVector const & pathv, NR::Matrix const &m, NR::Point const &pt, - NR::Rect *bbox, int *wind, NR::Coord *dist, - NR::Coord tolerance, NR::Rect const *viewbox) __attribute__ ((deprecated)); void pathv_matrix_point_bbox_wind_distance ( Geom::PathVector const & pathv, Geom::Matrix const &m, Geom::Point const &pt, Geom::Rect *bbox, int *wind, Geom::Coord *dist, Geom::Coord tolerance, Geom::Rect const *viewbox); diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 5c1a5748a..00ba4508b 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -103,26 +103,26 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, sp_document_ensure_up_to_date (doc); - NR::Rect screen=NR::Rect(NR::Point(x0,y0), NR::Point(x1, y1)); + Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1)); double zoom_scale = 1.0; double padding = 1.0; - width = (int)ceil(screen.extent(NR::X) * zoom_scale * padding); - height = (int)ceil(screen.extent(NR::Y) * zoom_scale * padding); + width = (int)ceil(screen[Geom::X].extent() * zoom_scale * padding); + height = (int)ceil(screen[Geom::Y].extent() * zoom_scale * padding); - NR::Point origin(screen.min()[NR::X], - sp_document_height(doc) - screen.extent(NR::Y) - screen.min()[NR::Y]); + Geom::Point origin(screen.min()[Geom::X], + sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]); - origin[NR::X] = origin[NR::X] + (screen.extent(NR::X) * ((1 - padding) / 2)); - origin[NR::Y] = origin[NR::Y] + (screen.extent(NR::Y) * ((1 - padding) / 2)); + origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2)); + origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2)); - NR::scale scale(zoom_scale, zoom_scale); - NR::Matrix affine = scale * NR::translate(-origin * scale); + Geom::Scale scale(zoom_scale, zoom_scale); + Geom::Matrix affine = scale * Geom::Translate(-origin * scale); /* 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), affine); + nr_arena_item_set_transform(NR_ARENA_ITEM(root), from_2geom(affine)); NRGC gc(NULL); gc.transform.set_identity(); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 69848e9a6..a08f9a939 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -342,8 +342,8 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, * (2) a[5] = -a[3] * y1 */ - NR::Matrix const affine(NR::translate(-x0, -y0) - * NR::scale(width / (x1 - x0), + Geom::Matrix const affine(Geom::Translate(-x0, -y0) + * Geom::Scale(width / (x1 - x0), height / (y1 - y0))); //SP_PRINT_MATRIX("SVG2PNG", &affine); @@ -362,7 +362,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, /* 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), affine); + nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), from_2geom(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 -- 2.30.2