From: haa_rodrigues Date: Mon, 14 Aug 2006 18:54:26 +0000 (+0000) Subject: Work on filters. spFilterPrimitive structure added. Blur slider updated. Fixed sp... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8c833a9abfd335f0305466ad7451c03c2f6b50dd;p=inkscape.git Work on filters. spFilterPrimitive structure added. Blur slider updated. Fixed sp-object-repr.cpp typos --- diff --git a/src/Makefile_insert b/src/Makefile_insert index 4438353e2..d0ef0248b 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -174,6 +174,8 @@ libinkpre_a_SOURCES = \ sp-feturbulence.cpp sp-feturbulence.h \ sp-feturbulence-fns.h \ sp-filter-fns.h \ + sp-filter-primitive.cpp \ + sp-filter-primitive.h \ sp-filter-reference.cpp \ sp-filter-reference.h \ sp-filter-units.h \ diff --git a/src/dialogs/object-properties.cpp b/src/dialogs/object-properties.cpp index df750c71b..4d6298b05 100644 --- a/src/dialogs/object-properties.cpp +++ b/src/dialogs/object-properties.cpp @@ -35,6 +35,8 @@ #include "inkscape-stock.h" #include "prefs-utils.h" #include "svg/css-ostringstream.h" +#include "sp-gaussian-blur.h" +#include "sp-filter.h" #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -232,7 +234,7 @@ sp_object_properties_dialog (void) GtkWidget *blur_hb = gtk_hbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (b_vb), blur_hb, FALSE, FALSE, 0); - GtkObject *blur_a = gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.1, 0.0); + GtkObject *blur_a = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 1.0, 0.0); gtk_object_set_data(GTK_OBJECT(dlg), "blur_adjustment", blur_a); GtkWidget *blur_s = gtk_hscale_new (GTK_ADJUSTMENT (blur_a)); @@ -240,7 +242,7 @@ sp_object_properties_dialog (void) gtk_box_pack_start (GTK_BOX (blur_hb), blur_s, TRUE, TRUE, 4); gtk_label_set_mnemonic_widget (GTK_LABEL(blur_l), blur_s); - GtkWidget *blur_sb = gtk_spin_button_new (GTK_ADJUSTMENT (blur_a), 0.01, 3); + GtkWidget *blur_sb = gtk_spin_button_new (GTK_ADJUSTMENT (blur_a), 1.0, 3); gtk_box_pack_start (GTK_BOX (blur_hb), blur_sb, FALSE, FALSE, 0); gtk_signal_connect ( blur_a, "value_changed", @@ -248,7 +250,7 @@ sp_object_properties_dialog (void) dlg ); gtk_widget_show_all (b_vb); -*/ +*/ sp_fillstroke_selection_changed(NULL, NULL, NULL); gtk_widget_show (dlg); @@ -350,7 +352,6 @@ sp_fillstroke_opacity_changed (GtkAdjustment *a, SPWidget *dlg) } - /** * Creates new private filter for the given vector */ @@ -367,15 +368,15 @@ sp_filter_get(SPDocument *document, gdouble stdDeviation) repr = sp_repr_new("svg:filter"); // privates are garbage-collectable repr->setAttribute("inkscape:collect", "always"); - + Inkscape::XML::Node *b_repr; b_repr = sp_repr_new("svg:feGaussianBlur"); // privates are garbage-collectable - b_repr->setAttribute("inkscape:collect", "always"); + //b_repr->setAttribute("inkscape:collect", "always"); Inkscape::CSSOStringStream os; - os << CLAMP (stdDeviation, 0.0, 1.0); + os << stdDeviation; b_repr->setAttribute("stdDeviation", os.str().c_str()); repr->appendChild(b_repr); @@ -386,9 +387,13 @@ sp_filter_get(SPDocument *document, gdouble stdDeviation) Inkscape::GC::release(repr); // get corresponding object - SPFilter *f = (SPFilter *) document->getObjectByRepr(repr); + SPFilter *f = SP_FILTER( document->getObjectByRepr(repr) ); + SPGaussianBlur *b = SP_GAUSSIANBLUR( document->getObjectByRepr(b_repr) ); + add_primitive(f, /*(SPFilterPrimitive * )*/ b); g_assert(f != NULL); g_assert(SP_IS_FILTER(f)); + g_assert(b != NULL); + g_assert(SP_IS_GAUSSIANBLUR(b)); return f; } @@ -412,48 +417,52 @@ sp_fillstroke_blur_changed (GtkAdjustment *a, SPWidget *dlg) return; } - if(a->value==0.0) //blur set to zero, remove filter - { - //if there is a filter attached, remove it - SPCSSAttr *css = sp_repr_css_attr_new (); - sp_repr_css_unset_property (css, "filter"); - sp_desktop_set_style (desktop, css); - sp_repr_css_attr_unref (css); - - } else { //blur non-zero - - //get current selection - Inkscape::Selection *selection = sp_desktop_selection (desktop); - //get list of selected items - GSList const *items = selection->itemList(); - //get current document - SPDocument *document = sp_desktop_document (desktop); - - - //create new filter with feGaussianBlur primitive - SPFilter *constructed = sp_filter_get(document, a->value); - - //apply created filter to every selected item - for (GSList const *i = items; i != NULL; i = i->next) { - + //get current selection + Inkscape::Selection *selection = sp_desktop_selection (desktop); + //get list of selected items + GSList const *items = selection->itemList(); + //get current document + SPDocument *document = sp_desktop_document (desktop); + + + //create new filter with feGaussianBlur primitive + SPFilter *constructed = sp_filter_get(document, a->value); + + + //apply created filter to every selected item + for (GSList const *i = items; i != NULL; i = i->next) { + + SPItem * item = SP_ITEM(i->data); + SPStyle *style = SP_OBJECT_STYLE(item); + g_assert(style != NULL); + + if(a->value==0.0) //blur set to zero, remove filter + { + //if there is a filter attached, remove it + SPCSSAttr *css = sp_repr_css_attr_new (); + sp_repr_css_unset_property (css, "filter"); + sp_desktop_set_style (desktop, css); + sp_repr_css_attr_unref (css); + }/* else if( style->filter.filter ) { //item has a filter assigned + Inkscape::XML::Node *repr = SP_OBJECT_REPR ( style->filter.filter ); + Inkscape::CSSOStringStream os; + os << a->value; + repr->firstChild()->setAttribute("stdDeviation", os.str().c_str()); + }*/ else { gchar *val = g_strdup_printf("url(#%s)", SP_OBJECT_ID(constructed)); - SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "filter", val); g_free(val); - sp_repr_css_change_recursive(SP_OBJECT_REPR(SP_ITEM(i->data)), css, "style"); - + sp_repr_css_change_recursive(SP_OBJECT_REPR(item), css, "style"); sp_desktop_set_style (SP_ACTIVE_DESKTOP, css); sp_repr_css_attr_unref(css); - - SP_OBJECT(SP_ITEM(i->data))->requestDisplayUpdate(( SP_OBJECT_MODIFIED_FLAG | - SP_OBJECT_STYLE_MODIFIED_FLAG )); } + SP_OBJECT(item)->requestDisplayUpdate(( SP_OBJECT_MODIFIED_FLAG | + SP_OBJECT_STYLE_MODIFIED_FLAG )); } - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "fillstroke:blur", SP_VERB_NONE, "object-properties.cpp:467"); - - gtk_object_set_data (GTK_OBJECT (dlg), "blocked", GUINT_TO_POINTER (FALSE)); + sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "fillstroke:blur", SP_VERB_NONE, "object-properties.cpp:467"); + gtk_object_set_data (GTK_OBJECT (dlg), "blocked", GUINT_TO_POINTER (FALSE)); } @@ -467,3 +476,4 @@ sp_fillstroke_blur_changed (GtkAdjustment *a, SPWidget *dlg) End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : + diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 4653b5ce6..f9c203187 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -17,6 +17,8 @@ #include #include #include "display/nr-filter.h" +#include "display/nr-filter-gaussian.h" +#include "display/nr-filter-types.h" #include #include #include @@ -29,6 +31,8 @@ #include /* prefs-utils used for deciding, whether to run filtering test or not */ #include "prefs-utils.h" +#include "sp-filter.h" +#include "sp-gaussian-blur.h" //int showRuns=0; void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS); @@ -1087,9 +1091,35 @@ nr_arena_shape_set_style(NRArenaShape *shape, SPStyle *style) /* TODO: after SPStyle handles filters, get the correct filter * from there. */ - //if (prefs_get_double_attribute("options.filtertest", "value", 0) != 0) if (style->filter.set && style->filter.filter) + { shape->filter = new NR::Filter(); + shape->filter->set_x(style->filter.filter->x); + shape->filter->set_y(style->filter.filter->y); + shape->filter->set_width(style->filter.filter->width); + shape->filter->set_height(style->filter.filter->height); + + //go through all SP filter primitives + for(int i=0; ifilter.filter->_primitive_count; i++) + { + SPFilterPrimitive *primitive = style->filter.filter->_primitives[i]; + //if primitive is gaussianblur +// if(SP_IS_GAUSSIANBLUR(primitive)) + { + NR::FilterGaussian * gaussian = (NR::FilterGaussian *) shape->filter->add_primitive(NR::NR_FILTER_GAUSSIANBLUR); + SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); + float num = spblur->stdDeviation.getNumber(); + if( num>=0.0 ) + { + float optnum = spblur->stdDeviation.getOptNumber(); + if( optnum>=0.0 ) + gaussian->set_deviation((double) num, (double) optnum); + else + gaussian->set_deviation((double) num); + } + } + } + } nr_arena_item_request_update(shape, NR_ARENA_ITEM_STATE_ALL, FALSE); } diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index bda64c50c..a96b02a62 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -34,10 +34,12 @@ namespace NR { Filter::Filter() { - _primitive_count = 1; + _primitive_count = 0; _primitive_table_size = 1; _primitive = new FilterPrimitive*[1]; - _primitive[0] = new FilterGaussian; + _primitive[0] = NULL; + //_primitive_count = 1; + //_primitive[0] = new FilterGaussian; _common_init(); } @@ -317,6 +319,15 @@ void Filter::clear_primitives() _primitive_count = 0; } +void Filter::set_x(SVGLength &lenght) +{ /*write me*/ } +void Filter::set_y(SVGLength &length) +{ /*write me*/ } +void Filter::set_width(SVGLength &length) +{ /*write me*/ } +void Filter::set_height(SVGLength &length) +{ /*write me*/ } + } /* namespace NR */ /* diff --git a/src/number-opt-number.h b/src/number-opt-number.h index c08de58ef..abbc759d8 100644 --- a/src/number-opt-number.h +++ b/src/number-opt-number.h @@ -44,13 +44,33 @@ public: } gfloat getNumber() - { return number; } + { + if(_set) + return number; + return -1; + } gfloat getOptNumber() - { return optNumber; } + { + if(optNumber_set) + return optNumber; + return -1; + } + + void setOptNumber(gfloat num) + { + optNumber_set = true; + optNumber = num; + } + + void setNumber(gfloat num) + { + _set = true; + number = num; + } gchar *getValueString(gchar *str) - { + { if( _set ) { diff --git a/src/sp-feblend.cpp b/src/sp-feblend.cpp index 41f1ceaf1..9fc5ee483 100644 --- a/src/sp-feblend.cpp +++ b/src/sp-feblend.cpp @@ -22,19 +22,6 @@ #include "sp-feblend.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEBLEND -#ifdef DEBUG_FEBLEND -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeBlend base class */ @@ -47,7 +34,7 @@ static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *valu static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feBlend_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feBlend_parent_class; +static SPFilterPrimitiveClass *feBlend_parent_class; GType sp_feBlend_get_type() @@ -65,7 +52,7 @@ sp_feBlend_get_type() (GInstanceInitFunc) sp_feBlend_init, NULL, /* value_table */ }; - feBlend_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeBlend", &feBlend_info, (GTypeFlags)0); + feBlend_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeBlend", &feBlend_info, (GTypeFlags)0); } return feBlend_type; } @@ -75,7 +62,7 @@ sp_feBlend_class_init(SPFeBlendClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feBlend_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feBlend_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feBlend_build; sp_object_class->release = sp_feBlend_release; @@ -87,7 +74,6 @@ sp_feBlend_class_init(SPFeBlendClass *klass) static void sp_feBlend_init(SPFeBlend *feBlend) { - debug("0x%p",feBlend); } /** @@ -98,7 +84,6 @@ sp_feBlend_init(SPFeBlend *feBlend) static void sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feBlend_parent_class)->build) { ((SPObjectClass *) feBlend_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re static void sp_feBlend_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feBlend_parent_class)->release) ((SPObjectClass *) feBlend_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feBlend_release(SPObject *object) static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeBlend *feBlend = SP_FEBLEND(object); switch(key) { @@ -144,8 +125,6 @@ sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feBlend_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feblend.h b/src/sp-feblend.h index 3119524ca..dea1100a3 100644 --- a/src/sp-feblend.h +++ b/src/sp-feblend.h @@ -19,13 +19,13 @@ /* FeBlend base class */ class SPFeBlendClass; -struct SPFeBlend : public SPFilter { +struct SPFeBlend : public SPFilterPrimitive { /** BLEND ATTRIBUTES HERE */ }; struct SPFeBlendClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feBlend_get_type(); diff --git a/src/sp-fecolormatrix.cpp b/src/sp-fecolormatrix.cpp index 98333cc51..02ba17b0d 100644 --- a/src/sp-fecolormatrix.cpp +++ b/src/sp-fecolormatrix.cpp @@ -22,19 +22,6 @@ #include "sp-fecolormatrix.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FECOLORMATRIX -#ifdef DEBUG_FECOLORMATRIX -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeColorMatrix base class */ @@ -47,7 +34,7 @@ static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feColorMatrix_parent_class; +static SPFilterPrimitiveClass *feColorMatrix_parent_class; GType sp_feColorMatrix_get_type() @@ -65,7 +52,7 @@ sp_feColorMatrix_get_type() (GInstanceInitFunc) sp_feColorMatrix_init, NULL, /* value_table */ }; - feColorMatrix_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeColorMatrix", &feColorMatrix_info, (GTypeFlags)0); + feColorMatrix_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeColorMatrix", &feColorMatrix_info, (GTypeFlags)0); } return feColorMatrix_type; } @@ -75,7 +62,7 @@ sp_feColorMatrix_class_init(SPFeColorMatrixClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feColorMatrix_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feColorMatrix_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feColorMatrix_build; sp_object_class->release = sp_feColorMatrix_release; @@ -87,7 +74,6 @@ sp_feColorMatrix_class_init(SPFeColorMatrixClass *klass) static void sp_feColorMatrix_init(SPFeColorMatrix *feColorMatrix) { - debug("0x%p",feColorMatrix); } /** @@ -98,7 +84,6 @@ sp_feColorMatrix_init(SPFeColorMatrix *feColorMatrix) static void sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feColorMatrix_parent_class)->build) { ((SPObjectClass *) feColorMatrix_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::No static void sp_feColorMatrix_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feColorMatrix_parent_class)->release) ((SPObjectClass *) feColorMatrix_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feColorMatrix_release(SPObject *object) static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeColorMatrix *feColorMatrix = SP_FECOLORMATRIX(object); switch(key) { @@ -144,8 +125,6 @@ sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fecolormatrix.h b/src/sp-fecolormatrix.h index 8f3c8093a..85623c680 100644 --- a/src/sp-fecolormatrix.h +++ b/src/sp-fecolormatrix.h @@ -19,13 +19,13 @@ /* FeColorMatrix base class */ class SPFeColorMatrixClass; -struct SPFeColorMatrix : public SPFilter { +struct SPFeColorMatrix : public SPFilterPrimitive { /** COLORMATRIX ATTRIBUTES HERE */ }; struct SPFeColorMatrixClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feColorMatrix_get_type(); diff --git a/src/sp-fecomponenttransfer.cpp b/src/sp-fecomponenttransfer.cpp index 710faa2f5..739c24cdb 100644 --- a/src/sp-fecomponenttransfer.cpp +++ b/src/sp-fecomponenttransfer.cpp @@ -22,19 +22,6 @@ #include "sp-fecomponenttransfer.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FECOMPONENTTRANSFER -#ifdef DEBUG_FECOMPONENTTRANSFER -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeComponentTransfer base class */ @@ -47,7 +34,7 @@ static void sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feComponentTransfer_parent_class; +static SPFilterPrimitiveClass *feComponentTransfer_parent_class; GType sp_feComponentTransfer_get_type() @@ -65,7 +52,7 @@ sp_feComponentTransfer_get_type() (GInstanceInitFunc) sp_feComponentTransfer_init, NULL, /* value_table */ }; - feComponentTransfer_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeComponentTransfer", &feComponentTransfer_info, (GTypeFlags)0); + feComponentTransfer_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeComponentTransfer", &feComponentTransfer_info, (GTypeFlags)0); } return feComponentTransfer_type; } @@ -75,7 +62,7 @@ sp_feComponentTransfer_class_init(SPFeComponentTransferClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feComponentTransfer_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feComponentTransfer_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feComponentTransfer_build; sp_object_class->release = sp_feComponentTransfer_release; @@ -87,7 +74,6 @@ sp_feComponentTransfer_class_init(SPFeComponentTransferClass *klass) static void sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer) { - debug("0x%p",feComponentTransfer); } /** @@ -98,7 +84,6 @@ sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer) static void sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feComponentTransfer_parent_class)->build) { ((SPObjectClass *) feComponentTransfer_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feComponentTransfer_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feComponentTransfer_parent_class)->release) ((SPObjectClass *) feComponentTransfer_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feComponentTransfer_release(SPObject *object) static void sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeComponentTransfer *feComponentTransfer = SP_FECOMPONENTTRANSFER(object); switch(key) { @@ -144,8 +125,6 @@ sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *valu static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fecomponenttransfer.h b/src/sp-fecomponenttransfer.h index 0fb400ffa..8c4544613 100644 --- a/src/sp-fecomponenttransfer.h +++ b/src/sp-fecomponenttransfer.h @@ -19,13 +19,13 @@ /* FeComponentTransfer base class */ class SPFeComponentTransferClass; -struct SPFeComponentTransfer : public SPFilter { +struct SPFeComponentTransfer : public SPFilterPrimitive { /** COMPONENTTRANSFER ATTRIBUTES HERE */ }; struct SPFeComponentTransferClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feComponentTransfer_get_type(); diff --git a/src/sp-fecomposite.cpp b/src/sp-fecomposite.cpp index 621ea300a..9e6411bff 100644 --- a/src/sp-fecomposite.cpp +++ b/src/sp-fecomposite.cpp @@ -22,19 +22,6 @@ #include "sp-fecomposite.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FECOMPOSITE -#ifdef DEBUG_FECOMPOSITE -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeComposite base class */ @@ -47,7 +34,7 @@ static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const * static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feComposite_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feComposite_parent_class; +static SPFilterPrimitiveClass *feComposite_parent_class; GType sp_feComposite_get_type() @@ -65,7 +52,7 @@ sp_feComposite_get_type() (GInstanceInitFunc) sp_feComposite_init, NULL, /* value_table */ }; - feComposite_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeComposite", &feComposite_info, (GTypeFlags)0); + feComposite_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeComposite", &feComposite_info, (GTypeFlags)0); } return feComposite_type; } @@ -75,7 +62,7 @@ sp_feComposite_class_init(SPFeCompositeClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feComposite_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feComposite_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feComposite_build; sp_object_class->release = sp_feComposite_release; @@ -87,7 +74,6 @@ sp_feComposite_class_init(SPFeCompositeClass *klass) static void sp_feComposite_init(SPFeComposite *feComposite) { - debug("0x%p",feComposite); } /** @@ -98,7 +84,6 @@ sp_feComposite_init(SPFeComposite *feComposite) static void sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feComposite_parent_class)->build) { ((SPObjectClass *) feComposite_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node static void sp_feComposite_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feComposite_parent_class)->release) ((SPObjectClass *) feComposite_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feComposite_release(SPObject *object) static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeComposite *feComposite = SP_FECOMPOSITE(object); switch(key) { @@ -144,8 +125,6 @@ sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feComposite_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fecomposite.h b/src/sp-fecomposite.h index 468325827..4421ebbf2 100644 --- a/src/sp-fecomposite.h +++ b/src/sp-fecomposite.h @@ -19,13 +19,13 @@ /* FeComposite base class */ class SPFeCompositeClass; -struct SPFeComposite : public SPFilter { +struct SPFeComposite : public SPFilterPrimitive { /** COMPOSITE ATTRIBUTES HERE */ }; struct SPFeCompositeClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feComposite_get_type(); diff --git a/src/sp-feconvolvematrix.cpp b/src/sp-feconvolvematrix.cpp index 0db036742..f7c50971b 100644 --- a/src/sp-feconvolvematrix.cpp +++ b/src/sp-feconvolvematrix.cpp @@ -22,19 +22,6 @@ #include "sp-feconvolvematrix.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FECONVOLVEMATRIX -#ifdef DEBUG_FECONVOLVEMATRIX -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeConvolveMatrix base class */ @@ -47,7 +34,7 @@ static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar co static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feConvolveMatrix_parent_class; +static SPFilterPrimitiveClass *feConvolveMatrix_parent_class; GType sp_feConvolveMatrix_get_type() @@ -65,7 +52,7 @@ sp_feConvolveMatrix_get_type() (GInstanceInitFunc) sp_feConvolveMatrix_init, NULL, /* value_table */ }; - feConvolveMatrix_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeConvolveMatrix", &feConvolveMatrix_info, (GTypeFlags)0); + feConvolveMatrix_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeConvolveMatrix", &feConvolveMatrix_info, (GTypeFlags)0); } return feConvolveMatrix_type; } @@ -75,7 +62,7 @@ sp_feConvolveMatrix_class_init(SPFeConvolveMatrixClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feConvolveMatrix_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feConvolveMatrix_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feConvolveMatrix_build; sp_object_class->release = sp_feConvolveMatrix_release; @@ -87,7 +74,6 @@ sp_feConvolveMatrix_class_init(SPFeConvolveMatrixClass *klass) static void sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix) { - debug("0x%p",feConvolveMatrix); } /** @@ -98,7 +84,6 @@ sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix) static void sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feConvolveMatrix_parent_class)->build) { ((SPObjectClass *) feConvolveMatrix_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML: static void sp_feConvolveMatrix_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feConvolveMatrix_parent_class)->release) ((SPObjectClass *) feConvolveMatrix_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feConvolveMatrix_release(SPObject *object) static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeConvolveMatrix *feConvolveMatrix = SP_FECONVOLVEMATRIX(object); switch(key) { @@ -144,8 +125,6 @@ sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feconvolvematrix.h b/src/sp-feconvolvematrix.h index 911f5d71c..d19666976 100644 --- a/src/sp-feconvolvematrix.h +++ b/src/sp-feconvolvematrix.h @@ -19,13 +19,13 @@ /* FeConvolveMatrix base class */ class SPFeConvolveMatrixClass; -struct SPFeConvolveMatrix : public SPFilter { +struct SPFeConvolveMatrix : public SPFilterPrimitive { /** CONVOLVEMATRIX ATTRIBUTES HERE */ }; struct SPFeConvolveMatrixClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feConvolveMatrix_get_type(); diff --git a/src/sp-fediffuselighting.cpp b/src/sp-fediffuselighting.cpp index 5683b330d..a84628aa9 100644 --- a/src/sp-fediffuselighting.cpp +++ b/src/sp-fediffuselighting.cpp @@ -22,19 +22,6 @@ #include "sp-fediffuselighting.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEDIFFUSELIGHTING -#ifdef DEBUG_FEDIFFUSELIGHTING -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeDiffuseLighting base class */ @@ -47,7 +34,7 @@ static void sp_feDiffuseLighting_set(SPObject *object, unsigned int key, gchar c static void sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feDiffuseLighting_parent_class; +static SPFilterPrimitiveClass *feDiffuseLighting_parent_class; GType sp_feDiffuseLighting_get_type() @@ -65,7 +52,7 @@ sp_feDiffuseLighting_get_type() (GInstanceInitFunc) sp_feDiffuseLighting_init, NULL, /* value_table */ }; - feDiffuseLighting_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeDiffuseLighting", &feDiffuseLighting_info, (GTypeFlags)0); + feDiffuseLighting_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeDiffuseLighting", &feDiffuseLighting_info, (GTypeFlags)0); } return feDiffuseLighting_type; } @@ -75,7 +62,7 @@ sp_feDiffuseLighting_class_init(SPFeDiffuseLightingClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feDiffuseLighting_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feDiffuseLighting_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feDiffuseLighting_build; sp_object_class->release = sp_feDiffuseLighting_release; @@ -87,7 +74,6 @@ sp_feDiffuseLighting_class_init(SPFeDiffuseLightingClass *klass) static void sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting) { - debug("0x%p",feDiffuseLighting); } /** @@ -98,7 +84,6 @@ sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting) static void sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feDiffuseLighting_parent_class)->build) { ((SPObjectClass *) feDiffuseLighting_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML static void sp_feDiffuseLighting_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feDiffuseLighting_parent_class)->release) ((SPObjectClass *) feDiffuseLighting_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feDiffuseLighting_release(SPObject *object) static void sp_feDiffuseLighting_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeDiffuseLighting *feDiffuseLighting = SP_FEDIFFUSELIGHTING(object); switch(key) { @@ -144,8 +125,6 @@ sp_feDiffuseLighting_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fediffuselighting.h b/src/sp-fediffuselighting.h index 598f380e3..c937c2dd8 100644 --- a/src/sp-fediffuselighting.h +++ b/src/sp-fediffuselighting.h @@ -1,41 +1,3 @@ -#ifndef SP_FEDIFFUSELIGHTING_FNS_H -#define SP_FEDIFFUSELIGHTING_FNS_H - -/** \file - * Macros and fn declarations related to gaussian blur filter. - */ - -#include -#include - -namespace Inkscape { -namespace XML { -class Node; -} -} - -class SPFeDiffuseLighting; - -#define SP_TYPE_FEDIFFUSELIGHTING (sp_feDiffuseLighting_get_type()) -#define SP_FEDIFFUSELIGHTING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_FEDIFFUSELIGHTING, SPFeDiffuseLighting)) -#define SP_FEDIFFUSELIGHTING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_FEDIFFUSELIGHTING, SPFeDiffuseLightingClass)) -#define SP_IS_FEDIFFUSELIGHTING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEDIFFUSELIGHTING)) -#define SP_IS_FEDIFFUSELIGHTING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_FEDIFFUSELIGHTING)) - -GType sp_feDiffuseLighting_get_type(); - -#endif /* !SP_FEDIFFUSELIGHTING_FNS_H */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : #ifndef SP_FEDIFFUSELIGHTING_H_SEEN #define SP_FEDIFFUSELIGHTING_H_SEEN @@ -57,13 +19,13 @@ GType sp_feDiffuseLighting_get_type(); /* FeDiffuseLighting base class */ class SPFeDiffuseLightingClass; -struct SPFeDiffuseLighting : public SPFilter { +struct SPFeDiffuseLighting : public SPFilterPrimitive { /** DIFFUSELIGHTING ATTRIBUTES HERE */ }; struct SPFeDiffuseLightingClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feDiffuseLighting_get_type(); diff --git a/src/sp-fedisplacementmap.cpp b/src/sp-fedisplacementmap.cpp index 43eb82043..51bba62e3 100644 --- a/src/sp-fedisplacementmap.cpp +++ b/src/sp-fedisplacementmap.cpp @@ -22,19 +22,6 @@ #include "sp-fedisplacementmap.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEDISPLACEMENTMAP -#ifdef DEBUG_FEDISPLACEMENTMAP -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeDisplacementMap base class */ @@ -47,7 +34,7 @@ static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar c static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feDisplacementMap_parent_class; +static SPFilterPrimitiveClass *feDisplacementMap_parent_class; GType sp_feDisplacementMap_get_type() @@ -65,7 +52,7 @@ sp_feDisplacementMap_get_type() (GInstanceInitFunc) sp_feDisplacementMap_init, NULL, /* value_table */ }; - feDisplacementMap_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeDisplacementMap", &feDisplacementMap_info, (GTypeFlags)0); + feDisplacementMap_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeDisplacementMap", &feDisplacementMap_info, (GTypeFlags)0); } return feDisplacementMap_type; } @@ -75,7 +62,7 @@ sp_feDisplacementMap_class_init(SPFeDisplacementMapClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feDisplacementMap_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feDisplacementMap_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feDisplacementMap_build; sp_object_class->release = sp_feDisplacementMap_release; @@ -87,7 +74,6 @@ sp_feDisplacementMap_class_init(SPFeDisplacementMapClass *klass) static void sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap) { - debug("0x%p",feDisplacementMap); } /** @@ -98,7 +84,6 @@ sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap) static void sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feDisplacementMap_parent_class)->build) { ((SPObjectClass *) feDisplacementMap_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML static void sp_feDisplacementMap_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feDisplacementMap_parent_class)->release) ((SPObjectClass *) feDisplacementMap_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feDisplacementMap_release(SPObject *object) static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeDisplacementMap *feDisplacementMap = SP_FEDISPLACEMENTMAP(object); switch(key) { @@ -144,8 +125,6 @@ sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fedisplacementmap.h b/src/sp-fedisplacementmap.h index 6800d4485..1e4eb2845 100644 --- a/src/sp-fedisplacementmap.h +++ b/src/sp-fedisplacementmap.h @@ -19,13 +19,13 @@ /* FeDisplacementMap base class */ class SPFeDisplacementMapClass; -struct SPFeDisplacementMap : public SPFilter { +struct SPFeDisplacementMap : public SPFilterPrimitive { /** DISPLACEMENTMAP ATTRIBUTES HERE */ }; struct SPFeDisplacementMapClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feDisplacementMap_get_type(); diff --git a/src/sp-feflood.cpp b/src/sp-feflood.cpp index e10c871af..de7b658d7 100644 --- a/src/sp-feflood.cpp +++ b/src/sp-feflood.cpp @@ -22,19 +22,6 @@ #include "sp-feflood.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEFLOOD -#ifdef DEBUG_FEFLOOD -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeFlood base class */ @@ -47,7 +34,7 @@ static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *valu static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feFlood_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feFlood_parent_class; +static SPFilterPrimitiveClass *feFlood_parent_class; GType sp_feFlood_get_type() @@ -65,7 +52,7 @@ sp_feFlood_get_type() (GInstanceInitFunc) sp_feFlood_init, NULL, /* value_table */ }; - feFlood_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeFlood", &feFlood_info, (GTypeFlags)0); + feFlood_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeFlood", &feFlood_info, (GTypeFlags)0); } return feFlood_type; } @@ -75,7 +62,7 @@ sp_feFlood_class_init(SPFeFloodClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feFlood_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feFlood_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feFlood_build; sp_object_class->release = sp_feFlood_release; @@ -87,7 +74,6 @@ sp_feFlood_class_init(SPFeFloodClass *klass) static void sp_feFlood_init(SPFeFlood *feFlood) { - debug("0x%p",feFlood); } /** @@ -98,7 +84,6 @@ sp_feFlood_init(SPFeFlood *feFlood) static void sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feFlood_parent_class)->build) { ((SPObjectClass *) feFlood_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re static void sp_feFlood_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feFlood_parent_class)->release) ((SPObjectClass *) feFlood_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feFlood_release(SPObject *object) static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeFlood *feFlood = SP_FEFLOOD(object); switch(key) { @@ -144,8 +125,6 @@ sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feFlood_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feflood.h b/src/sp-feflood.h index 4fc5da31d..87d674ab7 100644 --- a/src/sp-feflood.h +++ b/src/sp-feflood.h @@ -19,13 +19,13 @@ /* FeFlood base class */ class SPFeFloodClass; -struct SPFeFlood : public SPFilter { +struct SPFeFlood : public SPFilterPrimitive { /** FLOOD ATTRIBUTES HERE */ }; struct SPFeFloodClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feFlood_get_type(); diff --git a/src/sp-feimage.cpp b/src/sp-feimage.cpp index 08bb1f3e2..b7c857d4e 100644 --- a/src/sp-feimage.cpp +++ b/src/sp-feimage.cpp @@ -1,4 +1,4 @@ -#define __SP_FEIMAGE_CPP__ + #define __SP_FEIMAGE_CPP__ /** \file * SVG implementation. @@ -22,19 +22,6 @@ #include "sp-feimage.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEIMAGE -#ifdef DEBUG_FEIMAGE -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeImage base class */ @@ -47,7 +34,7 @@ static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *valu static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feImage_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feImage_parent_class; +static SPFilterPrimitiveClass *feImage_parent_class; GType sp_feImage_get_type() @@ -65,7 +52,7 @@ sp_feImage_get_type() (GInstanceInitFunc) sp_feImage_init, NULL, /* value_table */ }; - feImage_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeImage", &feImage_info, (GTypeFlags)0); + feImage_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeImage", &feImage_info, (GTypeFlags)0); } return feImage_type; } @@ -75,7 +62,7 @@ sp_feImage_class_init(SPFeImageClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feImage_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feImage_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feImage_build; sp_object_class->release = sp_feImage_release; @@ -87,7 +74,6 @@ sp_feImage_class_init(SPFeImageClass *klass) static void sp_feImage_init(SPFeImage *feImage) { - debug("0x%p",feImage); } /** @@ -98,7 +84,6 @@ sp_feImage_init(SPFeImage *feImage) static void sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feImage_parent_class)->build) { ((SPObjectClass *) feImage_parent_class)->build(object, document, repr); } @@ -112,7 +97,6 @@ sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re static void sp_feImage_release(SPObject *object) { - debug("0x%p",object); if (((SPObjectClass *) feImage_parent_class)->release) ((SPObjectClass *) feImage_parent_class)->release(object); @@ -124,8 +108,6 @@ sp_feImage_release(SPObject *object) static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeImage *feImage = SP_FEIMAGE(object); switch(key) { @@ -144,8 +126,6 @@ sp_feImage_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +144,6 @@ sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feImage_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feimage.h b/src/sp-feimage.h index 958c6232f..cb6f48f40 100644 --- a/src/sp-feimage.h +++ b/src/sp-feimage.h @@ -19,13 +19,13 @@ /* FeImage base class */ class SPFeImageClass; -struct SPFeImage : public SPFilter { +struct SPFeImage : public SPFilterPrimitive { /** IMAGE ATTRIBUTES HERE */ }; struct SPFeImageClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feImage_get_type(); diff --git a/src/sp-femerge.cpp b/src/sp-femerge.cpp index 6904f5b52..830fe21e4 100644 --- a/src/sp-femerge.cpp +++ b/src/sp-femerge.cpp @@ -22,19 +22,6 @@ #include "sp-femerge.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEMERGE -#ifdef DEBUG_FEMERGE -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeMerge base class */ @@ -47,7 +34,7 @@ static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *valu static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feMerge_parent_class; +static SPFilterPrimitiveClass *feMerge_parent_class; GType sp_feMerge_get_type() @@ -65,7 +52,7 @@ sp_feMerge_get_type() (GInstanceInitFunc) sp_feMerge_init, NULL, /* value_table */ }; - feMerge_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeMerge", &feMerge_info, (GTypeFlags)0); + feMerge_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeMerge", &feMerge_info, (GTypeFlags)0); } return feMerge_type; } @@ -75,7 +62,7 @@ sp_feMerge_class_init(SPFeMergeClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feMerge_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feMerge_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feMerge_build; sp_object_class->release = sp_feMerge_release; @@ -87,7 +74,6 @@ sp_feMerge_class_init(SPFeMergeClass *klass) static void sp_feMerge_init(SPFeMerge *feMerge) { - debug("0x%p",feMerge); } /** @@ -98,7 +84,6 @@ sp_feMerge_init(SPFeMerge *feMerge) static void sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feMerge_parent_class)->build) { ((SPObjectClass *) feMerge_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re static void sp_feMerge_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feMerge_parent_class)->release) ((SPObjectClass *) feMerge_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feMerge_release(SPObject *object) static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeMerge *feMerge = SP_FEMERGE(object); switch(key) { @@ -144,8 +125,6 @@ sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-femerge.h b/src/sp-femerge.h index 41bdfa377..015f2e33c 100644 --- a/src/sp-femerge.h +++ b/src/sp-femerge.h @@ -19,13 +19,13 @@ /* FeMerge base class */ class SPFeMergeClass; -struct SPFeMerge : public SPFilter { +struct SPFeMerge : public SPFilterPrimitive { /** MERGE ATTRIBUTES HERE */ }; struct SPFeMergeClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feMerge_get_type(); diff --git a/src/sp-femorphology.cpp b/src/sp-femorphology.cpp index 5d015232f..a7497560c 100644 --- a/src/sp-femorphology.cpp +++ b/src/sp-femorphology.cpp @@ -22,19 +22,6 @@ #include "sp-femorphology.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEMORPHOLOGY -#ifdef DEBUG_FEMORPHOLOGY -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeMorphology base class */ @@ -47,7 +34,7 @@ static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feMorphology_parent_class; +static SPFilterPrimitiveClass *feMorphology_parent_class; GType sp_feMorphology_get_type() @@ -65,7 +52,7 @@ sp_feMorphology_get_type() (GInstanceInitFunc) sp_feMorphology_init, NULL, /* value_table */ }; - feMorphology_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeMorphology", &feMorphology_info, (GTypeFlags)0); + feMorphology_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeMorphology", &feMorphology_info, (GTypeFlags)0); } return feMorphology_type; } @@ -75,7 +62,7 @@ sp_feMorphology_class_init(SPFeMorphologyClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feMorphology_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feMorphology_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feMorphology_build; sp_object_class->release = sp_feMorphology_release; @@ -87,7 +74,6 @@ sp_feMorphology_class_init(SPFeMorphologyClass *klass) static void sp_feMorphology_init(SPFeMorphology *feMorphology) { - debug("0x%p",feMorphology); } /** @@ -98,7 +84,6 @@ sp_feMorphology_init(SPFeMorphology *feMorphology) static void sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feMorphology_parent_class)->build) { ((SPObjectClass *) feMorphology_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Nod static void sp_feMorphology_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feMorphology_parent_class)->release) ((SPObjectClass *) feMorphology_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feMorphology_release(SPObject *object) static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeMorphology *feMorphology = SP_FEMORPHOLOGY(object); switch(key) { @@ -144,8 +125,6 @@ sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-femorphology.h b/src/sp-femorphology.h index c810c0360..b3196fe08 100644 --- a/src/sp-femorphology.h +++ b/src/sp-femorphology.h @@ -19,13 +19,13 @@ /* FeMorphology base class */ class SPFeMorphologyClass; -struct SPFeMorphology : public SPFilter { +struct SPFeMorphology : public SPFilterPrimitive { /** MORPHOLOGY ATTRIBUTES HERE */ }; struct SPFeMorphologyClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feMorphology_get_type(); diff --git a/src/sp-feoffset.cpp b/src/sp-feoffset.cpp index 3429ceb18..0f2f05062 100644 --- a/src/sp-feoffset.cpp +++ b/src/sp-feoffset.cpp @@ -22,19 +22,6 @@ #include "sp-feoffset.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FEOFFSET -#ifdef DEBUG_FEOFFSET -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeOffset base class */ @@ -47,7 +34,7 @@ static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *val static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feOffset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feOffset_parent_class; +static SPFilterPrimitiveClass *feOffset_parent_class; GType sp_feOffset_get_type() @@ -65,7 +52,7 @@ sp_feOffset_get_type() (GInstanceInitFunc) sp_feOffset_init, NULL, /* value_table */ }; - feOffset_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeOffset", &feOffset_info, (GTypeFlags)0); + feOffset_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeOffset", &feOffset_info, (GTypeFlags)0); } return feOffset_type; } @@ -75,7 +62,7 @@ sp_feOffset_class_init(SPFeOffsetClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feOffset_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feOffset_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feOffset_build; sp_object_class->release = sp_feOffset_release; @@ -87,7 +74,6 @@ sp_feOffset_class_init(SPFeOffsetClass *klass) static void sp_feOffset_init(SPFeOffset *feOffset) { - debug("0x%p",feOffset); } /** @@ -98,7 +84,6 @@ sp_feOffset_init(SPFeOffset *feOffset) static void sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feOffset_parent_class)->build) { ((SPObjectClass *) feOffset_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *r static void sp_feOffset_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feOffset_parent_class)->release) ((SPObjectClass *) feOffset_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feOffset_release(SPObject *object) static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeOffset *feOffset = SP_FEOFFSET(object); switch(key) { @@ -144,8 +125,6 @@ sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feOffset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feoffset.h b/src/sp-feoffset.h index 7a5c2b783..2eda946c2 100644 --- a/src/sp-feoffset.h +++ b/src/sp-feoffset.h @@ -19,13 +19,13 @@ /* FeOffset base class */ class SPFeOffsetClass; -struct SPFeOffset : public SPFilter { +struct SPFeOffset : public SPFilterPrimitive { /** OFFSET ATTRIBUTES HERE */ }; struct SPFeOffsetClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feOffset_get_type(); diff --git a/src/sp-fespecularlighting.cpp b/src/sp-fespecularlighting.cpp index 4fe25d48a..d03d8bf06 100644 --- a/src/sp-fespecularlighting.cpp +++ b/src/sp-fespecularlighting.cpp @@ -22,19 +22,6 @@ #include "sp-fespecularlighting.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FESPECULARLIGHTING -#ifdef DEBUG_FESPECULARLIGHTING -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeSpecularLighting base class */ @@ -47,7 +34,7 @@ static void sp_feSpecularLighting_set(SPObject *object, unsigned int key, gchar static void sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feSpecularLighting_parent_class; +static SPFilterPrimitiveClass *feSpecularLighting_parent_class; GType sp_feSpecularLighting_get_type() @@ -65,7 +52,7 @@ sp_feSpecularLighting_get_type() (GInstanceInitFunc) sp_feSpecularLighting_init, NULL, /* value_table */ }; - feSpecularLighting_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeSpecularLighting", &feSpecularLighting_info, (GTypeFlags)0); + feSpecularLighting_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeSpecularLighting", &feSpecularLighting_info, (GTypeFlags)0); } return feSpecularLighting_type; } @@ -75,7 +62,7 @@ sp_feSpecularLighting_class_init(SPFeSpecularLightingClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feSpecularLighting_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feSpecularLighting_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feSpecularLighting_build; sp_object_class->release = sp_feSpecularLighting_release; @@ -87,7 +74,6 @@ sp_feSpecularLighting_class_init(SPFeSpecularLightingClass *klass) static void sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting) { - debug("0x%p",feSpecularLighting); } /** @@ -98,7 +84,6 @@ sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting) static void sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feSpecularLighting_parent_class)->build) { ((SPObjectClass *) feSpecularLighting_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XM static void sp_feSpecularLighting_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feSpecularLighting_parent_class)->release) ((SPObjectClass *) feSpecularLighting_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feSpecularLighting_release(SPObject *object) static void sp_feSpecularLighting_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeSpecularLighting *feSpecularLighting = SP_FESPECULARLIGHTING(object); switch(key) { @@ -144,8 +125,6 @@ sp_feSpecularLighting_set(SPObject *object, unsigned int key, gchar const *value static void sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fespecularlighting.h b/src/sp-fespecularlighting.h index 885215b89..3c0887f15 100644 --- a/src/sp-fespecularlighting.h +++ b/src/sp-fespecularlighting.h @@ -19,13 +19,13 @@ /* FeSpecularLighting base class */ class SPFeSpecularLightingClass; -struct SPFeSpecularLighting : public SPFilter { +struct SPFeSpecularLighting : public SPFilterPrimitive { /** SPECULARLIGHTING ATTRIBUTES HERE */ }; struct SPFeSpecularLightingClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feSpecularLighting_get_type(); diff --git a/src/sp-fetile.cpp b/src/sp-fetile.cpp index a11fbc020..a00bdd1e1 100644 --- a/src/sp-fetile.cpp +++ b/src/sp-fetile.cpp @@ -22,19 +22,6 @@ #include "sp-fetile.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FETILE -#ifdef DEBUG_FETILE -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeTile base class */ @@ -47,7 +34,7 @@ static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feTile_parent_class; +static SPFilterPrimitiveClass *feTile_parent_class; GType sp_feTile_get_type() @@ -65,7 +52,7 @@ sp_feTile_get_type() (GInstanceInitFunc) sp_feTile_init, NULL, /* value_table */ }; - feTile_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeTile", &feTile_info, (GTypeFlags)0); + feTile_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeTile", &feTile_info, (GTypeFlags)0); } return feTile_type; } @@ -75,7 +62,7 @@ sp_feTile_class_init(SPFeTileClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feTile_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feTile_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feTile_build; sp_object_class->release = sp_feTile_release; @@ -87,7 +74,6 @@ sp_feTile_class_init(SPFeTileClass *klass) static void sp_feTile_init(SPFeTile *feTile) { - debug("0x%p",feTile); } /** @@ -98,7 +84,6 @@ sp_feTile_init(SPFeTile *feTile) static void sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feTile_parent_class)->build) { ((SPObjectClass *) feTile_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep static void sp_feTile_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feTile_parent_class)->release) ((SPObjectClass *) feTile_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feTile_release(SPObject *object) static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeTile *feTile = SP_FETILE(object); switch(key) { @@ -144,8 +125,6 @@ sp_feTile_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-fetile.h b/src/sp-fetile.h index 4cec1c3aa..b6234c3f2 100644 --- a/src/sp-fetile.h +++ b/src/sp-fetile.h @@ -19,13 +19,13 @@ /* FeTile base class */ class SPFeTileClass; -struct SPFeTile : public SPFilter { +struct SPFeTile : public SPFilterPrimitive { /** TILE ATTRIBUTES HERE */ }; struct SPFeTileClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feTile_get_type(); diff --git a/src/sp-feturbulence.cpp b/src/sp-feturbulence.cpp index 0122f1f20..b1bfea613 100644 --- a/src/sp-feturbulence.cpp +++ b/src/sp-feturbulence.cpp @@ -22,19 +22,6 @@ #include "sp-feturbulence.h" #include "xml/repr.h" -//#define SP_MACROS_SILENT -//#include "macros.h" - -#define DEBUG_FETURBULENCE -#ifdef DEBUG_FETURBULENCE -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif /* FeTurbulence base class */ @@ -47,7 +34,7 @@ static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feTurbulence_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *feTurbulence_parent_class; +static SPFilterPrimitiveClass *feTurbulence_parent_class; GType sp_feTurbulence_get_type() @@ -65,7 +52,7 @@ sp_feTurbulence_get_type() (GInstanceInitFunc) sp_feTurbulence_init, NULL, /* value_table */ }; - feTurbulence_type = g_type_register_static(SP_TYPE_OBJECT, "SPFeTurbulence", &feTurbulence_info, (GTypeFlags)0); + feTurbulence_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeTurbulence", &feTurbulence_info, (GTypeFlags)0); } return feTurbulence_type; } @@ -75,7 +62,7 @@ sp_feTurbulence_class_init(SPFeTurbulenceClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - feTurbulence_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + feTurbulence_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); sp_object_class->build = sp_feTurbulence_build; sp_object_class->release = sp_feTurbulence_release; @@ -87,7 +74,6 @@ sp_feTurbulence_class_init(SPFeTurbulenceClass *klass) static void sp_feTurbulence_init(SPFeTurbulence *feTurbulence) { - debug("0x%p",feTurbulence); } /** @@ -98,7 +84,6 @@ sp_feTurbulence_init(SPFeTurbulence *feTurbulence) static void sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) feTurbulence_parent_class)->build) { ((SPObjectClass *) feTurbulence_parent_class)->build(object, document, repr); } @@ -112,8 +97,6 @@ sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Nod static void sp_feTurbulence_release(SPObject *object) { - debug("0x%p",object); - if (((SPObjectClass *) feTurbulence_parent_class)->release) ((SPObjectClass *) feTurbulence_parent_class)->release(object); } @@ -124,8 +107,6 @@ sp_feTurbulence_release(SPObject *object) static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPFeTurbulence *feTurbulence = SP_FETURBULENCE(object); switch(key) { @@ -144,8 +125,6 @@ sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value) static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -164,8 +143,6 @@ sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_feTurbulence_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); - // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { if (repr) { diff --git a/src/sp-feturbulence.h b/src/sp-feturbulence.h index 9040e7a99..bf9ed2572 100644 --- a/src/sp-feturbulence.h +++ b/src/sp-feturbulence.h @@ -19,13 +19,13 @@ /* FeTurbulence base class */ class SPFeTurbulenceClass; -struct SPFeTurbulence : public SPFilter { +struct SPFeTurbulence : public SPFilterPrimitive { /** TURBULENCE ATTRIBUTES HERE */ }; struct SPFeTurbulenceClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_feTurbulence_get_type(); diff --git a/src/sp-filter-fns.h b/src/sp-filter-fns.h index 21913c995..4e1b012a3 100644 --- a/src/sp-filter-fns.h +++ b/src/sp-filter-fns.h @@ -9,6 +9,7 @@ #include #include "libnr/nr-forward.h" #include "sp-filter-units.h" +#include "sp-filter-primitive.h" class SPFilter; @@ -34,6 +35,9 @@ void sp_filter_set_filter_units(SPFilter *filter, SPFilterUnits filterUnits); //need to define function void sp_filter_set_primitive_units(SPFilter *filter, SPFilterUnits filterUnits); +SPFilterPrimitive *add_primitive(SPFilter *filter, SPFilterPrimitive *primitive); +SPFilterPrimitive *get_primitive(SPFilter *filter, int index); + #endif /* !SEEN_SP_FILTER_FNS_H */ diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp new file mode 100644 index 000000000..6b208f1be --- /dev/null +++ b/src/sp-filter-primitive.cpp @@ -0,0 +1,198 @@ +#define __SP_FILTER_PRIMITIVE_CPP__ + +/** \file + * SVG implementation, used as an example for a base starting class + * when implementing new sp-objects. + * + * In vi, three global search-and-replaces will let you rename everything + * in this and the .h file: + * + * :%s/FILTER_PRIMITIVE/YOURNAME/g + * :%s/FilterPrimitive/Yourname/g + * :%s/filter_primitive/yourname/g + */ +/* + * Authors: + * Kees Cook + * + * Copyright (C) 2004 Kees Cook + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "attributes.h" +#include "sp-filter-primitive.h" +#include "xml/repr.h" + + +/* FilterPrimitive base class */ + +static void sp_filter_primitive_class_init(SPFilterPrimitiveClass *klass); +static void sp_filter_primitive_init(SPFilterPrimitive *filter_primitive); + +static void sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_filter_primitive_release(SPObject *object); +static void sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value); +static void sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags); +static Inkscape::XML::Node *sp_filter_primitive_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); + +static SPObjectClass *filter_primitive_parent_class; + +GType +sp_filter_primitive_get_type() +{ + static GType filter_primitive_type = 0; + + if (!filter_primitive_type) { + GTypeInfo filter_primitive_info = { + sizeof(SPFilterPrimitiveClass), + NULL, NULL, + (GClassInitFunc) sp_filter_primitive_class_init, + NULL, NULL, + sizeof(SPFilterPrimitive), + 16, + (GInstanceInitFunc) sp_filter_primitive_init, + NULL, /* value_table */ + }; + filter_primitive_type = g_type_register_static(SP_TYPE_OBJECT, "SPFilterPrimitive", &filter_primitive_info, (GTypeFlags)0); + } + return filter_primitive_type; +} + +static void +sp_filter_primitive_class_init(SPFilterPrimitiveClass *klass) +{ + //GObjectClass *gobject_class = (GObjectClass *)klass; + SPObjectClass *sp_object_class = (SPObjectClass *)klass; + + filter_primitive_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + + sp_object_class->build = sp_filter_primitive_build; + sp_object_class->release = sp_filter_primitive_release; + sp_object_class->write = sp_filter_primitive_write; + sp_object_class->set = sp_filter_primitive_set; + sp_object_class->update = sp_filter_primitive_update; +} + +static void +sp_filter_primitive_init(SPFilterPrimitive *filter_primitive) +{ +} + +/** + * Reads the Inkscape::XML::Node, and initializes SPFilterPrimitive variables. For this to get called, + * our name must be associated with a repr via "sp_object_type_register". Best done through + * sp-object-repr.cpp's repr_name_entries array. + */ +static void +sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +{ + if (((SPObjectClass *) filter_primitive_parent_class)->build) { + ((SPObjectClass *) filter_primitive_parent_class)->build(object, document, repr); + } + + /* + Pay attention to certain settings here + + sp_object_read_attr(object, "xlink:href"); + sp_object_read_attr(object, "attributeName"); + sp_object_read_attr(object, "attributeType"); + sp_object_read_attr(object, "begin"); + sp_object_read_attr(object, "dur"); + sp_object_read_attr(object, "end"); + sp_object_read_attr(object, "min"); + sp_object_read_attr(object, "max"); + sp_object_read_attr(object, "restart"); + sp_object_read_attr(object, "repeatCount"); + sp_object_read_attr(object, "repeatDur"); + sp_object_read_attr(object, "fill"); + */ +} + +/** + * Drops any allocated memory. + */ +static void +sp_filter_primitive_release(SPObject *object) +{ + + /* deal with our children and our selves here */ + + if (((SPObjectClass *) filter_primitive_parent_class)->release) + ((SPObjectClass *) filter_primitive_parent_class)->release(object); +} + +/** + * Sets a specific value in the SPFilterPrimitive. + */ +static void +sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value) +{ + SPFilterPrimitive *filter_primitive = SP_FILTER_PRIMITIVE(object); + + /* See if any parents need this value. */ + if (((SPObjectClass *) filter_primitive_parent_class)->set) { + ((SPObjectClass *) filter_primitive_parent_class)->set(object, key, value); + } +} + +/** + * Receives update notifications. + */ +static void +sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags) +{ + //SPFilterPrimitive *filter_primitive = SP_FILTER_PRIMITIVE(object); + + if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | + SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { + + /* do something to trigger redisplay, updates? */ + + } + + if (((SPObjectClass *) filter_primitive_parent_class)->update) { + ((SPObjectClass *) filter_primitive_parent_class)->update(object, ctx, flags); + } +} + +/** + * Writes its settings to an incoming repr object, if any. + */ +static Inkscape::XML::Node * +sp_filter_primitive_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +{ + //SPFilterPrimitive *filterPrimitive = SP_FILTER_PRIMITIVE(object); + + // Inkscape-only object, not copied during an "plain SVG" dump: + if (flags & SP_OBJECT_WRITE_EXT) { + if (repr) { + // is this sane? + repr->mergeFrom(SP_OBJECT_REPR(object), "id"); + } else { + repr = SP_OBJECT_REPR(object)->duplicate(); + } + } + + if (((SPObjectClass *) filter_primitive_parent_class)->write) { + ((SPObjectClass *) filter_primitive_parent_class)->write(object, repr, flags); + } + + return repr; +} + + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h new file mode 100644 index 000000000..9fa628aa5 --- /dev/null +++ b/src/sp-filter-primitive.h @@ -0,0 +1,26 @@ +#ifndef __SP_FILTER_PRIMITIVE_H__ +#define __SP_FILTER_PRIMITIVE_H__ + + +#include "sp-object.h" + + +#define SP_TYPE_FILTER_PRIMITIVE (sp_filter_primitive_get_type ()) +#define SP_FILTER_PRIMITIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_FILTER_PRIMITIVE, SPFilterPrimitive)) +#define SP_FILTER_PRIMITIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_FILTER_PRIMITIVE, SPFilterPrimitiveClass)) +#define SP_IS_FILTER_PRIMITIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_FILTER_PRIMITIVE)) +#define SP_IS_FILTER_PRIMITIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_FILTER_PRIMITIVE)) + +class SPFilterPrimitive; +class SPFilterPrimitiveClass; + +struct SPFilterPrimitive : public SPObject { +}; + +struct SPFilterPrimitiveClass { + SPObjectClass sp_object_class; +}; + +GType sp_filter_primitive_get_type (void); + +#endif diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index d7229bda1..a210c615a 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -27,36 +27,6 @@ #include "macros.h" -/* - * For debugging purposes only - */ -void printfilter(SPFilter *filter) -{ - if(filter->filterUnits==SP_FILTER_UNITS_USERSPACEONUSE) - g_print("filterUnits=SP_FILTER_UNITS_USERSPACEONUSE\n"); - else if(filter->filterUnits==SP_FILTER_UNITS_OBJECTBOUNDINGBOX) - g_print("filterUnits=SP_FILTER_UNITS_OBJECTBOUNDINGBOX\n"); - else - g_print("filterUnits=UNKNOWN!!!\n"); - - if(filter->primitiveUnits==SP_FILTER_UNITS_USERSPACEONUSE) - g_print("primitiveUnits=SP_FILTER_UNITS_USERSPACEONUSE\n"); - else if(filter->primitiveUnits==SP_FILTER_UNITS_OBJECTBOUNDINGBOX) - g_print("primitiveUnits=SP_FILTER_UNITS_OBJECTBOUNDINGBOX\n"); - else - g_print("primitiveUnits=UNKNOWN!!!\n"); - -//TODO: print X, Y, W and H units - g_print("x=%lf\n", filter->x.computed); - g_print("y=%lf\n", filter->y.computed); - g_print("width=%lf\n", filter->width.computed); - g_print("height=%lf\n", filter->height.computed); - g_print("filterRes=(%lf %lf)\n", filter->filterRes.getNumber(), filter->filterRes.getOptNumber()); - -} - - - /* Filter base class */ static void sp_filter_class_init(SPFilterClass *klass); @@ -66,6 +36,10 @@ static void sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XM static void sp_filter_release(SPObject *object); static void sp_filter_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_update(SPObject *object, SPCtx *ctx, guint flags); +static void sp_filter_child_added(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *ref); +static void sp_filter_remove_child(SPObject *object, Inkscape::XML::Node *child); static Inkscape::XML::Node *sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter); @@ -107,6 +81,8 @@ sp_filter_class_init(SPFilterClass *klass) sp_object_class->write = sp_filter_write; sp_object_class->set = sp_filter_set; sp_object_class->update = sp_filter_update; + sp_object_class->child_added = sp_filter_child_added; + sp_object_class->remove_child = sp_filter_remove_child; } static void @@ -124,6 +100,11 @@ sp_filter_init(SPFilter *filter) filter->primitiveUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX; filter->filterUnits_set = FALSE; filter->primitiveUnits_set = FALSE; + filter->_primitive_count=0; + + filter->_primitive_table_size = 1; + filter->_primitives = new SPFilterPrimitive*[1]; + filter->_primitives[0] = NULL; } @@ -219,24 +200,24 @@ sp_filter_set(SPObject *object, unsigned int key, gchar const *value) } object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_X: + case SP_ATTR_X: filter->x.readOrUnset(value); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_Y: - filter->y.readOrUnset(value); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + case SP_ATTR_Y: + filter->y.readOrUnset(value); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_WIDTH: - filter->width.readOrUnset(value); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + case SP_ATTR_WIDTH: + filter->width.readOrUnset(value); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_HEIGHT: - filter->height.readOrUnset(value); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + case SP_ATTR_HEIGHT: + filter->height.readOrUnset(value); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_FILTERRES: - filter->filterRes.set(value); + case SP_ATTR_FILTERRES: + filter->filterRes.set(value); break; case SP_ATTR_XLINK_HREF: if (value) { @@ -337,8 +318,8 @@ sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) repr->setAttribute("height", NULL); } - if (filter->filterRes._set) { - char filterRes[32]; + if (filter->filterRes.getNumber()>=0) { + char filterRes[32]; repr->setAttribute("filterRes", filter->filterRes.getValueString(filterRes)); } else { repr->setAttribute("filterRes", NULL); @@ -384,6 +365,63 @@ filter_ref_modified(SPObject *href, guint flags, SPFilter *filter) } +void _enlarge_primitive_table(SPFilter * filter) { + SPFilterPrimitive **new_tbl = new SPFilterPrimitive*[filter->_primitive_table_size * 2]; + for (int i = 0 ; i < filter->_primitive_count ; i++) { + new_tbl[i] = filter->_primitives[i]; + } + filter->_primitive_table_size *= 2; + for (int i = filter->_primitive_count ; i < filter->_primitive_table_size ; i++) { + new_tbl[i] = NULL; + } + delete[] filter->_primitives; + filter->_primitives = new_tbl; +} + +SPFilterPrimitive *add_primitive(SPFilter *filter, SPFilterPrimitive *primitive) +{ + if (filter->_primitive_count >= filter->_primitive_table_size) { + _enlarge_primitive_table(filter); + } + filter->_primitives[filter->_primitive_count] = primitive; + filter->_primitive_count++; + return primitive; +} + +/** + * Callback for child_added event. + */ +static void +sp_filter_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +{/* + SPFilter *f = SP_FILTER(object); + + if (((SPObjectClass *) filter_parent_class)->child_added) + (* ((SPObjectClass *) filter_parent_class)->child_added)(object, child, ref); + + object->requestModified(SP_OBJECT_MODIFIED_FLAG); + */ +} + +/** + * Callback for remove_child event. + */ +static void +sp_filter_remove_child(SPObject *object, Inkscape::XML::Node *child) +{/* + SPFilter *f = SP_FILTER(object); + + if (((SPObjectClass *) filter_parent_class)->remove_child) + (* ((SPObjectClass *) filter_parent_class)->remove_child)(object, child); + + SPObject *ochild; + + + object->requestModified(SP_OBJECT_MODIFIED_FLAG); + */ +} + + /* Local Variables: mode:c++ diff --git a/src/sp-filter.h b/src/sp-filter.h index 74cb1bfa8..68f7f0a1c 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -16,6 +16,7 @@ #include "number-opt-number.h" #include "sp-object.h" #include "sp-filter-units.h" +#include "sp-filter-fns.h" #include "svg/svg-length.h" /* Filter base class */ @@ -47,13 +48,16 @@ struct SPFilter : public SPObject { NumberOptNumber filterRes; /** HREF attribute */ SPFilterReference *href; + + int _primitive_count; + int _primitive_table_size; + SPFilterPrimitive ** _primitives; }; struct SPFilterClass { SPObjectClass parent_class; }; -#include "sp-filter-fns.h" #endif /* !SP_FILTER_H_SEEN */ diff --git a/src/sp-gaussian-blur-fns.h b/src/sp-gaussian-blur-fns.h index 2dadd9e6e..030739263 100644 --- a/src/sp-gaussian-blur-fns.h +++ b/src/sp-gaussian-blur-fns.h @@ -23,6 +23,8 @@ class SPGaussianBlur; #define SP_IS_GAUSSIANBLUR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GAUSSIANBLUR)) GType sp_gaussianBlur_get_type(); +void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num); +void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num, float optnum); #endif /* !SP_GAUSSIANBLUR_FNS_H */ diff --git a/src/sp-gaussian-blur.cpp b/src/sp-gaussian-blur.cpp index 0e26fbbf4..68f22c8d4 100644 --- a/src/sp-gaussian-blur.cpp +++ b/src/sp-gaussian-blur.cpp @@ -25,17 +25,6 @@ //#define SP_MACROS_SILENT //#include "macros.h" -#define DEBUG_GAUSSIANBLUR -#ifdef DEBUG_GAUSSIANBLUR -# define debug(f, a...) { g_print("%s(%d) %s:", \ - __FILE__,__LINE__,__FUNCTION__); \ - g_print(f, ## a); \ - g_print("\n"); \ - } -#else -# define debug(f, a...) /**/ -#endif - /* GaussianBlur base class */ static void sp_gaussianBlur_class_init(SPGaussianBlurClass *klass); @@ -47,7 +36,7 @@ static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); -static SPObjectClass *gaussianBlur_parent_class; +static SPFilterPrimitiveClass *gaussianBlur_parent_class; GType sp_gaussianBlur_get_type() @@ -65,7 +54,7 @@ sp_gaussianBlur_get_type() (GInstanceInitFunc) sp_gaussianBlur_init, NULL, /* value_table */ }; - gaussianBlur_type = g_type_register_static(SP_TYPE_OBJECT, "SPGaussianBlur", &gaussianBlur_info, (GTypeFlags)0); + gaussianBlur_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPGaussianBlur", &gaussianBlur_info, (GTypeFlags)0); } return gaussianBlur_type; } @@ -75,7 +64,7 @@ sp_gaussianBlur_class_init(SPGaussianBlurClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; - gaussianBlur_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass); + gaussianBlur_parent_class = (SPFilterPrimitiveClass *)g_type_class_peek_parent(klass); sp_object_class->build = sp_gaussianBlur_build; sp_object_class->release = sp_gaussianBlur_release; @@ -87,9 +76,6 @@ sp_gaussianBlur_class_init(SPGaussianBlurClass *klass) static void sp_gaussianBlur_init(SPGaussianBlur *gaussianBlur) { - debug("0x%p",gaussianBlur); - -// gaussianBlur->stdDeviation = 1; } /** @@ -100,7 +86,6 @@ sp_gaussianBlur_init(SPGaussianBlur *gaussianBlur) static void sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - debug("0x%p",object); if (((SPObjectClass *) gaussianBlur_parent_class)->build) { ((SPObjectClass *) gaussianBlur_parent_class)->build(object, document, repr); } @@ -115,7 +100,6 @@ sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Nod static void sp_gaussianBlur_release(SPObject *object) { - debug("0x%p",object); if (((SPObjectClass *) gaussianBlur_parent_class)->release) ((SPObjectClass *) gaussianBlur_parent_class)->release(object); @@ -127,13 +111,11 @@ sp_gaussianBlur_release(SPObject *object) static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value) { - debug("0x%p %s(%u): '%s'",object, - sp_attribute_name(key),key,value); SPGaussianBlur *gaussianBlur = SP_GAUSSIANBLUR(object); switch(key) { - case SP_ATTR_STDDEVIATION: - gaussianBlur->stdDeviation.set(value); + case SP_ATTR_STDDEVIATION: + gaussianBlur->stdDeviation.set(value); break; default: if (((SPObjectClass *) gaussianBlur_parent_class)->set) @@ -149,7 +131,6 @@ sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value) static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags) { - debug("0x%p",object); if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -169,7 +150,6 @@ sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - debug("0x%p",object); // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -189,6 +169,17 @@ sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } +void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num) +{ + blur->stdDeviation.setNumber(num); +} +void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num, float optnum) +{ + blur->stdDeviation.setNumber(num); + blur->stdDeviation.setOptNumber(optnum); +} + + /* Local Variables: mode:c++ diff --git a/src/sp-gaussian-blur.h b/src/sp-gaussian-blur.h index e9ef50c8c..c86ee3288 100644 --- a/src/sp-gaussian-blur.h +++ b/src/sp-gaussian-blur.h @@ -19,13 +19,13 @@ /* GaussianBlur base class */ class SPGaussianBlurClass; -struct SPGaussianBlur : public SPFilter { +struct SPGaussianBlur : public SPFilterPrimitive { /** stdDeviation attribute */ NumberOptNumber stdDeviation; }; struct SPGaussianBlurClass { - SPFilterClass parent_class; + SPFilterPrimitiveClass parent_class; }; GType sp_gaussianBlur_get_type(); diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index 2ab53163a..6180ea244 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -129,22 +129,22 @@ populate_dtables() { "svg:flowRoot", SP_TYPE_FLOWTEXT }, { "svg:flowSpan", SP_TYPE_FLOWTSPAN }, { "svg:g", SP_TYPE_GROUP }, - { "feBlend", SP_TYPE_FEBLEND }, - { "feColorMatrix", SP_TYPE_FECOLORMATRIX }, - { "feComponentTransfer", SP_TYPE_FECOMPONENTTRANSFER }, - { "feComposite", SP_TYPE_FECOMPOSITE }, - { "feConvolveMatrix", SP_TYPE_FECONVOLVEMATRIX }, - { "feDiffuseLighting", SP_TYPE_FEDIFFUSELIGHTING }, - { "feDisplacementMap", SP_TYPE_FEDISPLACEMENTMAP }, - { "feFlood", SP_TYPE_FEFLOOD }, - { "feGaussianBlur", SP_TYPE_GAUSSIANBLUR }, - { "feImage", SP_TYPE_FEIMAGE }, - { "feMerge", SP_TYPE_FEMERGE }, - { "feMorphology", SP_TYPE_FEMORPHOLOGY }, - { "feOffset", SP_TYPE_FEOFFSET }, - { "feSpecularLighting", SP_TYPE_FESPECULARLIGHTING }, - { "feTile", SP_TYPE_FETILE }, - { "feTurbulence", SP_TYPE_FETURBULENCE }, + { "svg:feBlend", SP_TYPE_FEBLEND }, + { "svg:feColorMatrix", SP_TYPE_FECOLORMATRIX }, + { "svg:feComponentTransfer", SP_TYPE_FECOMPONENTTRANSFER }, + { "svg:feComposite", SP_TYPE_FECOMPOSITE }, + { "svg:feConvolveMatrix", SP_TYPE_FECONVOLVEMATRIX }, + { "svg:feDiffuseLighting", SP_TYPE_FEDIFFUSELIGHTING }, + { "svg:feDisplacementMap", SP_TYPE_FEDISPLACEMENTMAP }, + { "svg:feFlood", SP_TYPE_FEFLOOD }, + { "svg:feGaussianBlur", SP_TYPE_GAUSSIANBLUR }, + { "svg:feImage", SP_TYPE_FEIMAGE }, + { "svg:feMerge", SP_TYPE_FEMERGE }, + { "svg:feMorphology", SP_TYPE_FEMORPHOLOGY }, + { "svg:feOffset", SP_TYPE_FEOFFSET }, + { "svg:feSpecularLighting", SP_TYPE_FESPECULARLIGHTING }, + { "svg:feTile", SP_TYPE_FETILE }, + { "svg:feTurbulence", SP_TYPE_FETURBULENCE }, { "svg:image", SP_TYPE_IMAGE }, { "svg:line", SP_TYPE_LINE }, { "svg:linearGradient", SP_TYPE_LINEARGRADIENT },