summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fdb234b)
raw | patch | inline | side by side (parent: fdb234b)
author | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Fri, 17 Aug 2007 04:41:39 +0000 (04:41 +0000) | ||
committer | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Fri, 17 Aug 2007 04:41:39 +0000 (04:41 +0000) |
* Added most of the settings for feComponentTransfer to the filter dialog (still haven't done the table attribute)
diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp
index 111cd62f9ea860a25563d5dfec920a781cfad5e9..0fce491dd28a1e579c7525d69f48aaf7b9a893d3 100644 (file)
--- a/src/filter-enums.cpp
+++ b/src/filter-enums.cpp
};
const EnumDataConverter<FeCompositeOperator> CompositeOperatorConverter(CompositeOperatorData, COMPOSITE_ENDOPERATOR);
+// feComponentTransfer
+const EnumData<NR::FilterComponentTransferType> ComponentTransferTypeData[NR::COMPONENTTRANSFER_TYPE_ERROR] = {
+ {NR::COMPONENTTRANSFER_TYPE_IDENTITY, _("Identity"), "identity"},
+ {NR::COMPONENTTRANSFER_TYPE_TABLE, _("Table"), "table"},
+ {NR::COMPONENTTRANSFER_TYPE_DISCRETE, _("Discrete"), "discrete"},
+ {NR::COMPONENTTRANSFER_TYPE_LINEAR, _("Linear"), "linear"},
+ {NR::COMPONENTTRANSFER_TYPE_GAMMA, _("Gamma"), "gamma"},
+};
+const EnumDataConverter<NR::FilterComponentTransferType> ComponentTransferTypeConverter(ComponentTransferTypeData, NR::COMPONENTTRANSFER_TYPE_ERROR);
+
// feConvolveMatrix
const EnumData<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE] = {
{NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE, _("Duplicate"), "duplicate"},
diff --git a/src/filter-enums.h b/src/filter-enums.h
index c1e3fcdcc7a74794fc9120d3d0efba2903ee267d..fe517ea5ec8e77982d52664e5d5d5d0e71fcb26a 100644 (file)
--- a/src/filter-enums.h
+++ b/src/filter-enums.h
#include "display/nr-filter-blend.h"
#include "display/nr-filter-colormatrix.h"
+#include "display/nr-filter-component-transfer.h"
#include "display/nr-filter-composite.h"
#include "display/nr-filter-convolve-matrix.h"
#include "display/nr-filter-morphology.h"
// ColorMatrix type
extern const Inkscape::Util::EnumData<NR::FilterColorMatrixType> ColorMatrixTypeData[NR::COLORMATRIX_ENDTYPE];
extern const Inkscape::Util::EnumDataConverter<NR::FilterColorMatrixType> ColorMatrixTypeConverter;
+// ComponentTransfer type
+extern const Inkscape::Util::EnumData<NR::FilterComponentTransferType> ComponentTransferTypeData[NR::COMPONENTTRANSFER_TYPE_ERROR];
+extern const Inkscape::Util::EnumDataConverter<NR::FilterComponentTransferType> ComponentTransferTypeConverter;
// Composite operator
extern const Inkscape::Util::EnumData<FeCompositeOperator> CompositeOperatorData[COMPOSITE_ENDOPERATOR];
extern const Inkscape::Util::EnumDataConverter<FeCompositeOperator> CompositeOperatorConverter;
index 2bf3e809a0346ea0373be2d9479da67086748d87..1ff231a1ff1e32e8228ba3ae1e6a82a6236c1706 100644 (file)
@@ -147,7 +147,15 @@ sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *valu
SPFeComponentTransfer *feComponentTransfer = SP_FECOMPONENTTRANSFER(object);
(void)feComponentTransfer;
+ NR::FilterComponentTransferType type;
switch(key) {
+ case SP_ATTR_TYPE:
+ type = sp_feComponenttransfer_read_type(value);
+ if(type != feComponentTransfer->type) {
+ feComponentTransfer->type = type;
+ object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ }
+ break;
/*DEAL WITH SETTING ATTRIBUTES HERE*/
default:
if (((SPObjectClass *) feComponentTransfer_parent_class)->set)
index 60e2c8c8c5afcbdde7c7fe809ab67ce94b9f604b..0e3727ce81ff1f3e97a13319171979bc7a0ed761 100644 (file)
#include "selection.h"
#include "sp-feblend.h"
#include "sp-fecolormatrix.h"
+#include "sp-fecomponenttransfer.h"
#include "sp-fecomposite.h"
#include "sp-feconvolvematrix.h"
#include "sp-fedisplacementmap.h"
_color_matrix_values = _settings->add_colormatrixvalues(_("Value(s)"));
colmat->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::update_color_matrix));
+ _settings->type(NR_FILTER_COMPONENTTRANSFER);
+ _settings->add_combo(SP_ATTR_TYPE, _("Type"), ComponentTransferTypeConverter);
+ _ct_slope = _settings->add_spinslider(SP_ATTR_SLOPE, _("Slope"), -100, 100, 1, 0.01, 1);
+ _ct_intercept = _settings->add_spinslider(SP_ATTR_INTERCEPT, _("Intercept"), -100, 100, 1, 0.01, 1);
+ _ct_amplitude = _settings->add_spinslider(SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 100, 1, 0.01, 1);
+ _ct_exponent = _settings->add_spinslider(SP_ATTR_EXPONENT, _("Exponent"), 0, 100, 1, 0.01, 1);
+ _ct_offset = _settings->add_spinslider(SP_ATTR_OFFSET, _("Offset"), -100, 100, 1, 0.01, 1);
+
_settings->type(NR_FILTER_COMPOSITE);
_settings->add_combo(SP_ATTR_OPERATOR, _("Operator"), CompositeOperatorConverter);
_k1 = _settings->add_spinslider(SP_ATTR_K1, _("K1"), -10, 10, 1, 0.01, 1);
@@ -2032,6 +2041,8 @@ void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, cons
void FilterEffectsDialog::update_settings_view()
{
+ update_settings_sensitivity();
+
if(_attr_lock)
return;
_settings_box.show();
_empty_settings.show();
}
-
- update_settings_sensitivity();
}
void FilterEffectsDialog::update_settings_sensitivity()
_k2->set_sensitive(use_k);
_k3->set_sensitive(use_k);
_k4->set_sensitive(use_k);
+
+ if(SP_IS_FECOMPONENTTRANSFER(prim)) {
+ SPFeComponentTransfer* ct = SP_FECOMPONENTTRANSFER(prim);
+ const bool linear = ct->type == COMPONENTTRANSFER_TYPE_LINEAR;
+ const bool gamma = ct->type == COMPONENTTRANSFER_TYPE_GAMMA;
+ //_ct_table->set_sensitive(ct->type == COMPONENTTRANSFER_TYPE_TABLE || ct->type == COMPONENTTRANSFER_TYPE_DISCRETE);
+ _ct_slope->set_sensitive(linear);
+ _ct_intercept->set_sensitive(linear);
+ _ct_amplitude->set_sensitive(gamma);
+ _ct_exponent->set_sensitive(gamma);
+ _ct_offset->set_sensitive(gamma);
+ }
}
void FilterEffectsDialog::update_color_matrix()
index ac7b96fd664609f06033c25a4d602e19ff6a04a7..1a4285dd9300cf24882fa6e70dddbbaee640766b 100644 (file)
// For controlling setting sensitivity
Gtk::Widget* _k1, *_k2, *_k3, *_k4;
+ Gtk::Widget* _ct_table, *_ct_slope, *_ct_intercept, *_ct_amplitude, *_ct_exponent, *_ct_offset;
// To prevent unwanted signals
bool _locked;