Code

src/helper 2geomified
authorjohanengelen <johanengelen@users.sourceforge.net>
Wed, 6 Aug 2008 21:23:19 +0000 (21:23 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Wed, 6 Aug 2008 21:23:19 +0000 (21:23 +0000)
src/helper/geom.cpp
src/helper/geom.h
src/helper/pixbuf-ops.cpp
src/helper/png-write.cpp

index bf487f65222a5d80e3ab0ee20497d47e4bb10c74..caa169a272688776422ddb5c18b7d81f5ac22ae0 100644 (file)
@@ -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;
-}
 //#################################################################################
 
 /*
index 9b6dd0f35b8aaffaaa1a1d311effc42b14328f83..e4cb38fa71652cb4db3bc0cd537d8806b3c0ca16 100644 (file)
@@ -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);
index 5c1a5748a2ceea0eaab651da4aa6b738bad6ffd9..00ba4508bb61dec5749773c972abce5cc18b3852 100644 (file)
@@ -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();
index 69848e9a6995350c909a1989977df0709a07e13a..a08f9a9391a4d21e76888bea93d6307cd7c3a087 100644 (file)
@@ -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