Example #1
0
/**
 * Sets a specific value in the SPFeBlend.
 */
static void
sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value)
{
    SPFeBlend *feBlend = SP_FEBLEND(object);
    (void)feBlend;

    Inkscape::Filters::FilterBlendMode mode;
    int input;
    switch(key) {
	/*DEAL WITH SETTING ATTRIBUTES HERE*/
        case SP_ATTR_MODE:
            mode = sp_feBlend_readmode(value);
            if (mode != feBlend->blend_mode) {
                feBlend->blend_mode = mode;
                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_IN2:
            input = sp_filter_primitive_read_in(feBlend, value);
            if (input != feBlend->in2) {
                feBlend->in2 = input;
                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        default:
            if (((SPObjectClass *) feBlend_parent_class)->set)
                ((SPObjectClass *) feBlend_parent_class)->set(object, key, value);
            break;
    }

}
Example #2
0
/**
 * Sets a specific value in the SPFeBlend.
 */
void SPFeBlend::set(unsigned int key, gchar const *value) {
    Inkscape::Filters::FilterBlendMode mode;
    int input;

    switch(key) {
	/*DEAL WITH SETTING ATTRIBUTES HERE*/
        case SP_ATTR_MODE:
            mode = sp_feBlend_readmode(value);

            if (mode != this->blend_mode) {
                this->blend_mode = mode;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_IN2:
            input = sp_filter_primitive_read_in(this, value);

            if (input != this->in2) {
                this->in2 = input;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        default:
        	SPFilterPrimitive::set(key, value);
            break;
    }
}
Example #3
0
/**
 * Sets a specific value in the SPFeMergeNode.
 */
void SPFeMergeNode::set(unsigned int key, gchar const *value) {
    SPFeMerge *parent = SP_FEMERGE(this->parent);

    if (key == SP_ATTR_IN) {
        int input = sp_filter_primitive_read_in(parent, value);
        if (input != this->input) {
            this->input = input;
            this->requestModified(SP_OBJECT_MODIFIED_FLAG);
        }
    }

    /* See if any parents need this value. */
    SPObject::set(key, value);
}
Example #4
0
/**
 * Sets a specific value in the SPFilterPrimitive.
 */
void SPFilterPrimitive::set(unsigned int key, gchar const *value) {

    int image_nr;
    switch (key) {
        case SP_ATTR_IN:
            if (value) {
                image_nr = sp_filter_primitive_read_in(this, value);
            } else {
                image_nr = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
            }
            if (image_nr != this->image_in) {
                this->image_in = image_nr;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_RESULT:
            if (value) {
                image_nr = sp_filter_primitive_read_result(this, value);
            } else {
                image_nr = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
            }
            if (image_nr != this->image_out) {
                this->image_out = image_nr;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        /* Filter primitive sub-region */
        case SP_ATTR_X:
            this->x.readOrUnset(value);
            this->requestModified(SP_OBJECT_MODIFIED_FLAG);
            break;
        case SP_ATTR_Y:
            this->y.readOrUnset(value);
            this->requestModified(SP_OBJECT_MODIFIED_FLAG);
            break;
        case SP_ATTR_WIDTH:
            this->width.readOrUnset(value);
            this->requestModified(SP_OBJECT_MODIFIED_FLAG);
            break;
        case SP_ATTR_HEIGHT:
            this->height.readOrUnset(value);
            this->requestModified(SP_OBJECT_MODIFIED_FLAG);
            break;
    }

    /* See if any parents need this value. */
    SPObject::set(key, value);
}
Example #5
0
/**
 * Sets a specific value in the SPFeDisplacementMap.
 */
void SPFeDisplacementMap::set(unsigned int key, gchar const *value) {
    int input;
    double read_num;
    FilterDisplacementMapChannelSelector read_selector;
    
    switch(key) {
	/*DEAL WITH SETTING ATTRIBUTES HERE*/
        case SP_ATTR_XCHANNELSELECTOR:
            read_selector = sp_feDisplacementMap_readChannelSelector(value);
            
            if (read_selector != this->xChannelSelector){
                this->xChannelSelector = read_selector;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_YCHANNELSELECTOR:
            read_selector = sp_feDisplacementMap_readChannelSelector(value);
            
            if (read_selector != this->yChannelSelector){
                this->yChannelSelector = read_selector;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_SCALE:
            read_num = value ? helperfns_read_number(value) : 0;
            
            if (read_num != this->scale) {
                this->scale = read_num;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        case SP_ATTR_IN2:
            input = sp_filter_primitive_read_in(this, value);
            
            if (input != this->in2) {
                this->in2 = input;
                this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;
        default:
        	SPFilterPrimitive::set(key, value);
            break;
    }
}
Example #6
0
/**
 * Sets a specific value in the SPFeComposite.
 */
static void
sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value)
{
    SPFeComposite *feComposite = SP_FECOMPOSITE(object);
    (void)feComposite;

    int input;
    FeCompositeOperator op;
    double k_n;
    switch(key) {
	/*DEAL WITH SETTING ATTRIBUTES HERE*/
        case SP_ATTR_OPERATOR:
            op = sp_feComposite_read_operator(value);
            if (op != feComposite->composite_operator) {
                feComposite->composite_operator = op;
                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        case SP_ATTR_K1:
            k_n = value ? helperfns_read_number(value) : 0;
            if (k_n != feComposite->k1) {
                feComposite->k1 = k_n;
                if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
                    object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        case SP_ATTR_K2:
            k_n = value ? helperfns_read_number(value) : 0;
            if (k_n != feComposite->k2) {
                feComposite->k2 = k_n;
                if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
                    object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        case SP_ATTR_K3:
            k_n = value ? helperfns_read_number(value) : 0;
            if (k_n != feComposite->k3) {
                feComposite->k3 = k_n;
                if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
                    object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        case SP_ATTR_K4:
            k_n = value ? helperfns_read_number(value) : 0;
            if (k_n != feComposite->k4) {
                feComposite->k4 = k_n;
                if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
                    object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        case SP_ATTR_IN2:
            input = sp_filter_primitive_read_in(feComposite, value);
            if (input != feComposite->in2) {
                feComposite->in2 = input;
                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
            }
            break;

        default:
            if (((SPObjectClass *) feComposite_parent_class)->set)
                ((SPObjectClass *) feComposite_parent_class)->set(object, key, value);
            break;
    }

}