summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b34fba2)
raw | patch | inline | side by side (parent: b34fba2)
author | jucablues <jucablues@users.sourceforge.net> | |
Mon, 6 Aug 2007 22:14:47 +0000 (22:14 +0000) | ||
committer | jucablues <jucablues@users.sourceforge.net> | |
Mon, 6 Aug 2007 22:14:47 +0000 (22:14 +0000) |
diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp
index 1f519335dcf55fe75a4c55e7f8d400bd0e9b989b..909dc7d90607cbb1a22da8bebb20d0aaa4993ff5 100644 (file)
*/
#include "display/nr-filter-component-transfer.h"
+
namespace NR {
FilterComponentTransfer::FilterComponentTransfer()
{
}
+void FilterComponentTransfer::set_type(FilterComponentTransferType t){
+ type = t;
+}
+
+void FilterComponentTransfer::set_slope(double s){
+ slope = s;
+}
+
+void FilterComponentTransfer::set_tableValues(std::vector<double> &tv){
+ tableValues = tv;
+}
+
+
+void FilterComponentTransfer::set_intercept(double i){
+ intercept = i;
+}
+
+void FilterComponentTransfer::set_amplitude(double a){
+ amplitude = a;
+}
+
+void FilterComponentTransfer::set_exponent(double e){
+ exponent = e;
+}
+
+void FilterComponentTransfer::set_offset(double o){
+ offset = o;
+}
+
} /* namespace NR */
/*
diff --git a/src/display/nr-filter-component-transfer.h b/src/display/nr-filter-component-transfer.h
index b3045780971ca4d02f4eb57f61c7ae189b298874..9036a6644688aa01bcac37de5d74a644aa442748 100644 (file)
#include "display/nr-filter-primitive.h"
#include "display/nr-filter-slot.h"
+#include <vector>
namespace NR {
+enum FilterComponentTransferType {
+ COMPONENTTRANSFER_TYPE_IDENTITY,
+ COMPONENTTRANSFER_TYPE_TABLE,
+ COMPONENTTRANSFER_TYPE_DISCRETE,
+ COMPONENTTRANSFER_TYPE_LINEAR,
+ COMPONENTTRANSFER_TYPE_GAMMA,
+ COMPONENTTRANSFER_TYPE_ERROR
+};
+
class FilterComponentTransfer : public FilterPrimitive {
public:
FilterComponentTransfer();
virtual int render(FilterSlot &slot, Matrix const &trans);
virtual void area_enlarge(NRRectL &area, Matrix const &trans);
+
+ void set_type(FilterComponentTransferType t);
+ void set_tableValues(std::vector<gdouble>& tv);
+ void set_slope(double s);
+ void set_intercept(double i);
+ void set_amplitude(double a);
+ void set_exponent(double e);
+ void set_offset(double o);
+
+private:
+ FilterComponentTransferType type;
+ std::vector<gdouble> tableValues;
+ double slope;
+ double intercept;
+ double amplitude;
+ double exponent;
+ double offset;
};
} /* namespace NR */
index 9909511921febc810ea86e18342f65702fd66de2..2bf3e809a0346ea0373be2d9479da67086748d87 100644 (file)
#include "svg/svg.h"
#include "sp-fecomponenttransfer.h"
#include "xml/repr.h"
-
+#include "display/nr-filter-component-transfer.h"
/* FeComponentTransfer base class */
static void
sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer)
{
+ //Setting default values:
+//TODO: tableValues = "" (empty list);
+ feComponentTransfer->slope = 1;
+ feComponentTransfer->intercept = 0;
+ feComponentTransfer->amplitude = 1;
+ feComponentTransfer->exponent = 1;
+ feComponentTransfer->offset = 0;
+// feComponentTransfer->type = NR::COMPONENTTRANSFER_TYPE_ERROR;
}
/**
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
+ sp_object_read_attr(object, "type");
+ sp_object_read_attr(object, "tableValues");
+ sp_object_read_attr(object, "slope");
+ sp_object_read_attr(object, "intercept");
+ sp_object_read_attr(object, "amplitude");
+ sp_object_read_attr(object, "exponent");
+ sp_object_read_attr(object, "offset");
}
/**
((SPObjectClass *) feComponentTransfer_parent_class)->release(object);
}
+static NR::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){
+ if (!value) return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
+ switch(value[0]){
+ case 'i':
+ if (strncmp(value, "identity", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_IDENTITY;
+ break;
+ case 't':
+ if (strncmp(value, "table", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_TABLE;
+ break;
+ case 'd':
+ if (strncmp(value, "discrete", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_DISCRETE;
+ break;
+ case 'l':
+ if (strncmp(value, "linear", 6) == 0) return NR::COMPONENTTRANSFER_TYPE_LINEAR;
+ break;
+ case 'g':
+ if (strncmp(value, "gamma", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_GAMMA;
+ break;
+ }
+ return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
+}
+
/**
* Sets a specific value in the SPFeComponentTransfer.
*/
index 8c4544613da88f4b0cdcb6ba9a24bc21f35fa960..2a0fa01ed41ae577c99e59327326cbc4839333df 100644 (file)
#include "sp-filter.h"
#include "sp-fecomponenttransfer-fns.h"
+#include "display/nr-filter-component-transfer.h"
+#include <vector>
/* FeComponentTransfer base class */
class SPFeComponentTransferClass;
struct SPFeComponentTransfer : public SPFilterPrimitive {
/** COMPONENTTRANSFER ATTRIBUTES HERE */
-
+ NR::FilterComponentTransferType type;
+ std::vector<double> tableValues;
+ double slope;
+ double intercept;
+ double amplitude;
+ double exponent;
+ double offset;
};
struct SPFeComponentTransferClass {