diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2007-07-25 12:12:23 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2007-07-25 12:12:23 +0000 |
| commit | 2471f6815e6d8e939d0781e925a6f67ae898e1ae (patch) | |
| tree | 043dee40b481fc7deb3829c25a43da493aac5725 /src/sp-image.cpp | |
| parent | Snapping the transformation origin should also work for paths, not only for s... (diff) | |
| download | inkscape-2471f6815e6d8e939d0781e925a6f67ae898e1ae.tar.gz inkscape-2471f6815e6d8e939d0781e925a6f67ae898e1ae.zip | |
Add a method to create a rectangular curve
(bzr r3297)
Diffstat (limited to 'src/sp-image.cpp')
| -rw-r--r-- | src/sp-image.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 9f6767050..d535874e9 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -36,6 +36,8 @@ #include "xml/quote.h" #include <xml/repr.h> +#include "libnr/nr-matrix-fns.h" + #include "io/sys.h" #include <png.h> #if ENABLE_LCMS @@ -1397,21 +1399,11 @@ sp_image_set_curve(SPImage *image) return; } - SPCurve *c = sp_curve_new(); - - double const x = image->x.computed; - double const y = image->y.computed; - double const w = image->width.computed; - double const h = image->height.computed; - - sp_curve_moveto(c, x, y); - sp_curve_lineto(c, x + w, y); - sp_curve_lineto(c, x + w, y + h); - sp_curve_lineto(c, x, y + h); - sp_curve_lineto(c, x, y); - - sp_curve_closepath_current(c); - + NRRect rect; + sp_image_bbox(image, &rect, NR::identity(), 0); + NR::Maybe<NR::Rect> rect2 = rect.upgrade(); + SPCurve *c = sp_curve_new_from_rect(rect2); + if (image->curve) { image->curve = sp_curve_unref(image->curve); } @@ -1420,8 +1412,7 @@ sp_image_set_curve(SPImage *image) image->curve = sp_curve_ref(c); } - sp_curve_unref(c); - + sp_curve_unref(c); } /** |
