summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ceadd9a)
raw | patch | inline | side by side (parent: ceadd9a)
author | jucablues <jucablues@users.sourceforge.net> | |
Fri, 27 Jul 2007 03:07:02 +0000 (03:07 +0000) | ||
committer | jucablues <jucablues@users.sourceforge.net> | |
Fri, 27 Jul 2007 03:07:02 +0000 (03:07 +0000) |
NumberOptNumber::optNumIsSet()
using it for default attribute values in feTubulence and
feConvolvematrix
feDisplacementMap scale parameter variable is a double
using it for default attribute values in feTubulence and
feConvolvematrix
feDisplacementMap scale parameter variable is a double
index f8a00cb4b734b07e0f706828ae0dadce355c5862..9c9cf5f210c222709a1034c3fb23278955cdfa73 100644 (file)
namespace NR {
FilterConvolveMatrix::FilterConvolveMatrix()
-: bias(0),
+: orderX(3),
+ orderY(3),
+ targetX((int)(orderX/2)),
+ targetY((int)(orderY/2)),
+ bias(0),
edgeMode(0),
preserveAlpha(false)
{}
diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp
index 8d2e6dc3c2b657fd2c0082109412851597b2d91b..4b401bb33c43356c98c4addba51b5c61877bf188 100644 (file)
y1 = out->area.y1;
width = x1 - x0;
- for (x=x0 + scale/2; x < x1 - scale/2; x++){
- for (y=y0 + scale/2; y < y1 - scale/2; y++){
+ for (x=x0 + (int)(scale/2); x < x1 - (int)(scale/2); x++){
+ for (y=y0 + (int)(scale/2); y < y1 - (int)(scale/2); y++){
/* SVG spec states that pixel values must be alpha-demultiplied before processing this filter operation.
The following code does it, but when we DON'T do it, output is more similar to output from Batik.
_input = slot;
}
-void FilterDisplacementMap::set_scale(int s) {
+void FilterDisplacementMap::set_scale(double s) {
scale = s;
}
void FilterDisplacementMap::area_enlarge(NRRectL &area, Matrix const &trans)
{
//I'm in doubt whether this affects all input buffers or only 'in'
- area.x0 -= scale/2;
- area.y0 -= scale/2;
- area.x1 += scale/2;
- area.y1 += scale/2;
+ area.x0 -= (int)(scale/2);
+ area.y0 -= (int)(scale/2);
+ area.x1 += (int)(scale/2);
+ area.y1 += (int)(scale/2);
}
} /* namespace NR */
index 4b5c6ada55a3e2b1232bffb0e1a0deaf136ac75f..fbe0d3064c5dbd34632cd8fdb5a40fd0571e7f51 100644 (file)
virtual void set_input(int slot);
virtual void set_input(int input, int slot);
- virtual void set_scale(int s);
+ virtual void set_scale(double s);
virtual void set_channel_selector(int channel, int s);
virtual int render(FilterSlot &slot, Matrix const &trans);
virtual void area_enlarge(NRRectL &area, Matrix const &trans);
private:
- int scale;
+ double scale;
int _input2;
int Xchannel;
int Ychannel;
index ef1675079b280a92060bc3758cace99a91f47f97..0025f2d07b73e51911e79c174cfb4766b72761a7 100644 (file)
--- a/src/number-opt-number.h
+++ b/src/number-opt-number.h
number = num;
}
+ bool optNumIsSet(){
+ return optNumber_set;
+ }
+
+ bool numIsSet(){
+ return _set;
+ }
+
gchar *getValueString()
{
Inkscape::SVGOStringStream os;
index 059475e5fc40ae8487e28c75d6ada2bd95cf5a76..edd093499883324052eaea98c5e79a14b1bf5c9b 100644 (file)
static void
sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix)
-{
- feConvolveMatrix->divisor=0;
- feConvolveMatrix->preserveAlpha = false;
- feConvolveMatrix->order.set("3 3");
-}
+{}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeConvolveMatrix variables. For this to get called,
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_ORDER:
feConvolveMatrix->order.set(value);
+ //From SVG spec: If <orderY> is not provided, it defaults to <orderX>.
+ if (feConvolveMatrix->order.optNumIsSet() == false)
+ feConvolveMatrix->order.setOptNumber(feConvolveMatrix->order.getNumber());
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_KERNELMATRIX:
index 1387789842c6683bf6f4c2c249bf2b172788ac8d..f7b256898023d39fd9908774905c2a971299ca27 100644 (file)
--- a/src/sp-feturbulence.cpp
+++ b/src/sp-feturbulence.cpp
case SP_ATTR_BASEFREQUENCY:
feTurbulence->baseFrequency.set(value);
//From SVG spec: If two <number>s are provided, the first number represents a base frequency in the X direction and the second value represents a base frequency in the Y direction. If one number is provided, then that value is used for both X and Y.
- if (feTurbulence->baseFrequency.getOptNumber() == -1) // -1 means "not set"
+ if (feTurbulence->baseFrequency.optNumIsSet() == false)
feTurbulence->baseFrequency.setOptNumber(feTurbulence->baseFrequency.getNumber());
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;