summaryrefslogtreecommitdiffstats
path: root/src/sp-fecolormatrix.cpp
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2007-08-05 05:07:59 +0000
committerjucablues <jucablues@users.sourceforge.net>2007-08-05 05:07:59 +0000
commitaab5635cecbece9ea6cf9273a3502d9f66a8a321 (patch)
tree08aa05cd3236a807b3b6571578b596995225174e /src/sp-fecolormatrix.cpp
parentFilter effects dialog: (diff)
downloadinkscape-aab5635cecbece9ea6cf9273a3502d9f66a8a321.tar.gz
inkscape-aab5635cecbece9ea6cf9273a3502d9f66a8a321.zip
feColorMatrix filter primitive implementation
(bzr r3374)
Diffstat (limited to 'src/sp-fecolormatrix.cpp')
-rw-r--r--src/sp-fecolormatrix.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/sp-fecolormatrix.cpp b/src/sp-fecolormatrix.cpp
index cc7ee6138..d20c11456 100644
--- a/src/sp-fecolormatrix.cpp
+++ b/src/sp-fecolormatrix.cpp
@@ -94,7 +94,8 @@ sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::No
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
-
+ sp_object_read_attr(object, "type");
+ sp_object_read_attr(object, "values");
}
/**
@@ -130,7 +131,7 @@ static int sp_feColorMatrix_read_type(gchar const *value){
* Sets a specific value in the SPFeColorMatrix.
*/
static void
-sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value)
+sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *str)
{
SPFeColorMatrix *feColorMatrix = SP_FECOLORMATRIX(object);
(void)feColorMatrix;
@@ -140,39 +141,22 @@ sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value)
/*DEAL WITH SETTING ATTRIBUTES HERE*/
switch(key) {
case SP_ATTR_TYPE:
- read_int = sp_feColorMatrix_read_type(value);
+ read_int = sp_feColorMatrix_read_type(str);
if (feColorMatrix->type != read_int){
feColorMatrix->type = read_int;
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_VALUES:
- switch(feColorMatrix->type){
- case '0': //matrix
- feColorMatrix->values = helperfns_read_vector(value, 20);
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
- break;
- case '1': //saturate
- read_num = helperfns_read_number(value);
- if (feColorMatrix->value != read_num){ //TODO: check if it is a real number between 0 and 1;
- feColorMatrix->value = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
- }
- break;
- case '2': //hueRotate
- read_num = helperfns_read_number(value);
- if (feColorMatrix->value != read_num){
- feColorMatrix->value = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
- }
- break;
- case '3': //luminanceToAlpha
- g_warning("value attribute is not applicable for feColorMatrix type='luminanceToAlpha'.");
- break;
+ if (str){
+ feColorMatrix->values = helperfns_read_vector(str, 20);
+ feColorMatrix->value = helperfns_read_number(str);
+ object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
+ break;
default:
if (((SPObjectClass *) feColorMatrix_parent_class)->set)
- ((SPObjectClass *) feColorMatrix_parent_class)->set(object, key, value);
+ ((SPObjectClass *) feColorMatrix_parent_class)->set(object, key, str);
break;
}
}