summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 239d123)
raw | patch | inline | side by side (parent: 239d123)
author | kiirala <kiirala@users.sourceforge.net> | |
Sat, 21 Jul 2007 07:00:28 +0000 (07:00 +0000) | ||
committer | kiirala <kiirala@users.sourceforge.net> | |
Sat, 21 Jul 2007 07:00:28 +0000 (07:00 +0000) |
src/display/nr-filter.cpp | patch | blob | history | |
src/display/nr-filter.h | patch | blob | history | |
src/sp-filter.cpp | patch | blob | history |
index 73a3df415708214b241b5972e8f0ca24ffb06f20..47b05d0b89797f53392184b294c3242f64281c1c 100644 (file)
_primitive_count = 0;
}
-void Filter::set_x(SVGLength &length)
+void Filter::set_x(SVGLength const &length)
{
if (length._set)
_region_x = length;
}
-void Filter::set_y(SVGLength &length)
+void Filter::set_y(SVGLength const &length)
{
if (length._set)
_region_y = length;
}
-void Filter::set_width(SVGLength &length)
+void Filter::set_width(SVGLength const &length)
{
if (length._set)
_region_width = length;
}
-void Filter::set_height(SVGLength &length)
+void Filter::set_height(SVGLength const &length)
{
if (length._set)
_region_height = length;
}
+void Filter::set_resolution(double const pixels) {
+ if (pixels > 0) {
+ _x_pixels = pixels;
+ _y_pixels = pixels;
+ }
+}
+
+void Filter::set_resolution(double const x_pixels, double const y_pixels) {
+ if (x_pixels >= 0 && y_pixels >= 0) {
+ _x_pixels = x_pixels;
+ _y_pixels = y_pixels;
+ }
+}
+
+void Filter::reset_resolution() {
+ _x_pixels = -1;
+ _y_pixels = -1;
+}
+
} /* namespace NR */
/*
index baf23886ebc7bc327aac100a34f29aa96191a4a4..835266e738e4092006a20805b2ba888ffaa99c3f 100644 (file)
--- a/src/display/nr-filter.h
+++ b/src/display/nr-filter.h
*/
void set_output(int slot);
- void set_x(SVGLength &lenght);
- void set_y(SVGLength &length);
- void set_width(SVGLength &length);
- void set_height(SVGLength &length);
+ void set_x(SVGLength const &lenght);
+ void set_y(SVGLength const &length);
+ void set_width(SVGLength const &length);
+ void set_height(SVGLength const &length);
/**
* Sets the filter effects region.
* resolution is determined automatically. If x_pixels is less than zero,
* calling this function results in no changes to filter state.
*/
- void set_resolution(double x_pixels);
+ void set_resolution(double const x_pixels);
/**
* Sets the width and height of intermediate images in pixels. If not set,
* less than zero, calling this function results in no changes to filter
* state.
*/
- void set_resolution(double x_pixels, double y_pixels);
+ void set_resolution(double const x_pixels, double const y_pixels);
/**
* Resets the filter resolution to its default value, i.e. automatically
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index aae143e8d608b594bcbd0673d558d91517503972..e9c2af19db457a1b7acccfc5983975f0e470c5a9 100644 (file)
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_X:
+ case SP_ATTR_X:
filter->x.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_Y:
- filter->y.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ case SP_ATTR_Y:
+ filter->y.readOrUnset(value);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_WIDTH:
- filter->width.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ case SP_ATTR_WIDTH:
+ filter->width.readOrUnset(value);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_HEIGHT:
- filter->height.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ case SP_ATTR_HEIGHT:
+ filter->height.readOrUnset(value);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_FILTERRES:
- filter->filterRes.set(value);
+ case SP_ATTR_FILTERRES:
+ filter->filterRes.set(value);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_XLINK_HREF:
if (value) {
nr_filter->set_width(sp_filter->width);
nr_filter->set_height(sp_filter->height);
+ if (sp_filter->filterRes.getNumber() >= 0) {
+ if (sp_filter->filterRes.getOptNumber() >= 0) {
+ nr_filter->set_resolution(sp_filter->filterRes.getNumber(),
+ sp_filter->filterRes.getOptNumber());
+ } else {
+ nr_filter->set_resolution(sp_filter->filterRes.getNumber());
+ }
+ }
+
nr_filter->clear_primitives();
SPObject *primitive_obj = sp_filter->children;
while (primitive_obj) {