~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/sp-fecomponenttransfer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# include "config.h"
18
18
#endif
19
19
 
 
20
#include <string.h>
 
21
 
20
22
#include "attributes.h"
21
23
#include "svg/svg.h"
22
24
#include "sp-fecomponenttransfer.h"
23
25
#include "xml/repr.h"
24
 
 
 
26
#include "display/nr-filter-component-transfer.h"
25
27
 
26
28
/* FeComponentTransfer base class */
27
29
 
74
76
static void
75
77
sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer)
76
78
{
 
79
    //Setting default values:
 
80
//TODO: tableValues = "" (empty list);
 
81
    feComponentTransfer->slope = 1;
 
82
    feComponentTransfer->intercept = 0;
 
83
    feComponentTransfer->amplitude = 1;
 
84
    feComponentTransfer->exponent = 1;
 
85
    feComponentTransfer->offset = 0;
 
86
//    feComponentTransfer->type = NR::COMPONENTTRANSFER_TYPE_ERROR;
77
87
}
78
88
 
79
89
/**
89
99
    }
90
100
 
91
101
    /*LOAD ATTRIBUTES FROM REPR HERE*/
 
102
    sp_object_read_attr(object, "type");
 
103
    sp_object_read_attr(object, "tableValues");
 
104
    sp_object_read_attr(object, "slope");
 
105
    sp_object_read_attr(object, "intercept");
 
106
    sp_object_read_attr(object, "amplitude");
 
107
    sp_object_read_attr(object, "exponent");
 
108
    sp_object_read_attr(object, "offset");
92
109
}
93
110
 
94
111
/**
101
118
        ((SPObjectClass *) feComponentTransfer_parent_class)->release(object);
102
119
}
103
120
 
 
121
static NR::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){
 
122
    if (!value) return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
 
123
    switch(value[0]){
 
124
        case 'i':
 
125
            if (strncmp(value, "identity", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_IDENTITY;
 
126
            break;
 
127
        case 't':
 
128
            if (strncmp(value, "table", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_TABLE;
 
129
            break;
 
130
        case 'd':
 
131
            if (strncmp(value, "discrete", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_DISCRETE;
 
132
            break;
 
133
        case 'l':
 
134
            if (strncmp(value, "linear", 6) == 0) return NR::COMPONENTTRANSFER_TYPE_LINEAR;
 
135
            break;
 
136
        case 'g':
 
137
            if (strncmp(value, "gamma", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_GAMMA;
 
138
            break;
 
139
    }
 
140
    return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
 
141
}
 
142
 
104
143
/**
105
144
 * Sets a specific value in the SPFeComponentTransfer.
106
145
 */
108
147
sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *value)
109
148
{
110
149
    SPFeComponentTransfer *feComponentTransfer = SP_FECOMPONENTTRANSFER(object);
 
150
    (void)feComponentTransfer;
111
151
 
112
 
    switch(key) {
 
152
    NR::FilterComponentTransferType type;
 
153
    switch(key) {
 
154
        case SP_ATTR_TYPE:
 
155
            type = sp_feComponenttransfer_read_type(value);
 
156
            if(type != feComponentTransfer->type) {
 
157
                feComponentTransfer->type = type;
 
158
                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
 
159
            }
 
160
            break;
113
161
        /*DEAL WITH SETTING ATTRIBUTES HERE*/
114
162
        default:
115
163
            if (((SPObjectClass *) feComponentTransfer_parent_class)->set)
147
195
    if (flags & SP_OBJECT_WRITE_EXT) {
148
196
        if (repr) {
149
197
            // is this sane?
150
 
            repr->mergeFrom(SP_OBJECT_REPR(object), "id");
 
198
            //repr->mergeFrom(SP_OBJECT_REPR(object), "id");
151
199
        } else {
152
 
            repr = SP_OBJECT_REPR(object)->duplicate();
 
200
            repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME
153
201
        }
154
202
    }
155
203