summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fea2d31)
raw | patch | inline | side by side (parent: fea2d31)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 16 Jan 2007 17:05:03 +0000 (17:05 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 16 Jan 2007 17:05:03 +0000 (17:05 +0000) |
src/dialogs/clonetiler.cpp | patch | blob | history | |
src/filter-chemistry.cpp | patch | blob | history | |
src/filter-chemistry.h | patch | blob | history |
index 172f4f6774f0a4db3f7ef477b9126eb857c59c0e..c0acea533a91be2e021f5b4f78e3833e95673cb4 100644 (file)
// it's hard to figure out exact width/height of the tile without having an object
// that we can take bbox of; however here we only need a lower bound so that blur
// margins are not too small, and the perimeter should work
- SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.expansion(), perimeter, perimeter);
+ SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.expansion(), t.expansionX(), t.expansionY(), perimeter, perimeter);
sp_style_set_property_url (clone_object, "filter", SP_OBJECT(constructed), false);
}
index 3c27b6edc5b3eafef9ffe9dee1aa2bc1bd5e47e8..100caefbe3db46dc8fd90e8512b64341fb4cb1dd 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
* 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);
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)
diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h
index d575b7f1ebe706b430571744ad86edbadaac3562..22ae9aecd2c52cc53ab943d8e53344e0c16ecf64 100644 (file)
--- a/src/filter-chemistry.h
+++ b/src/filter-chemistry.h
#include "forward.h"
#include "sp-filter.h"
-SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double width, double height);
+SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height);
SPFilter *new_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, gdouble stdDeviation);
void remove_filter (SPObject *item, bool recursive);