summaryrefslogtreecommitdiffstats
path: root/src/filter-chemistry.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-01-16 17:05:03 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-01-16 17:05:03 +0000
commite72d59594309e9e7ef85a65af10c740a9d413f51 (patch)
tree085ff5223edc4a57d05aed2e2819964df5859837 /src/filter-chemistry.cpp
parentunblur per author's request (diff)
downloadinkscape-e72d59594309e9e7ef85a65af10c740a9d413f51.tar.gz
inkscape-e72d59594309e9e7ef85a65af10c740a9d413f51.zip
fix filter area clipping when blurring a squeezed object
(bzr r2221)
Diffstat (limited to 'src/filter-chemistry.cpp')
-rw-r--r--src/filter-chemistry.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp
index 3c27b6edc..100caefbe 100644
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
@@ -27,7 +27,7 @@
* Creates a filter with blur primitive of specified radius for an item with the given matrix expansion, width and height
*/
SPFilter *
-new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion, double width, double height)
+new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height)
{
g_return_val_if_fail(document != NULL, NULL);
@@ -38,11 +38,14 @@ new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion
repr = sp_repr_new("svg:filter");
repr->setAttribute("inkscape:collect", "always");
- if (width != 0 && height != 0 && (2 * radius > width * 0.1 || 2 * radius > height * 0.1)) {
+ double rx = radius * (expansion / expansionY);
+ double ry = radius * (expansion / expansionX);
+
+ if (width != 0 && height != 0 && (2 * rx > width * 0.1 || 2 * ry > height * 0.1)) {
// If not within the default 10% margin (see
// http://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion), specify margins
- double xmargin = 2 * radius / width;
- double ymargin = 2 * radius / height;
+ double xmargin = 2 * (rx) / width;
+ double ymargin = 2 * (ry) / height;
// TODO: set it in UserSpaceOnUse instead?
sp_repr_set_svg_double(repr, "x", -xmargin);
@@ -95,7 +98,7 @@ new_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, gdouble
NR::Matrix i2d = sp_item_i2d_affine (item);
- return (new_filter_gaussian_blur (document, radius, i2d.expansion(), width, height));
+ return (new_filter_gaussian_blur (document, radius, i2d.expansion(), i2d.expansionX(), i2d.expansionY(), width, height));
}
void remove_filter (SPObject *item, bool recursive)