summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 722f7db)
raw | patch | inline | side by side (parent: 722f7db)
author | jucablues <jucablues@users.sourceforge.net> | |
Sat, 4 Aug 2007 04:18:36 +0000 (04:18 +0000) | ||
committer | jucablues <jucablues@users.sourceforge.net> | |
Sat, 4 Aug 2007 04:18:36 +0000 (04:18 +0000) |
probably deal with setting default attribute values for these filters
14 files changed:
src/display/Makefile_insert | patch | blob | history | |
src/display/nr-filter-colormatrix.cpp | [new file with mode: 0644] | patch | blob |
src/display/nr-filter-colormatrix.h | [new file with mode: 0644] | patch | blob |
src/display/nr-filter-flood.cpp | [new file with mode: 0644] | patch | blob |
src/display/nr-filter-flood.h | [new file with mode: 0644] | patch | blob |
src/display/nr-filter-morphology.cpp | [new file with mode: 0644] | patch | blob |
src/display/nr-filter-morphology.h | [new file with mode: 0644] | patch | blob |
src/display/nr-filter.cpp | patch | blob | history | |
src/sp-fecolormatrix.cpp | patch | blob | history | |
src/sp-fecolormatrix.h | patch | blob | history | |
src/sp-feflood.cpp | patch | blob | history | |
src/sp-feflood.h | patch | blob | history | |
src/sp-femorphology.cpp | patch | blob | history | |
src/sp-femorphology.h | patch | blob | history |
index ed9eae9befe7523a93d9e21ebae96770a2f2dd52..de6e64c4a124b261299592deb346325e85692c1d 100644 (file)
display/nr-filter.h \
display/nr-filter-blend.cpp \
display/nr-filter-blend.h \
+ display/nr-filter-colormatrix.cpp \
+ display/nr-filter-colormatrix.h \
+ display/nr-filter-component-transfer.cpp \
+ display/nr-filter-component-transfer.h \
display/nr-filter-composite.h \
display/nr-filter-composite.cpp \
display/nr-filter-convolve-matrix.cpp \
display/nr-filter-diffuselighting.h \
display/nr-filter-displacement-map.cpp \
display/nr-filter-displacement-map.h \
+ display/nr-filter-flood.cpp \
+ display/nr-filter-flood.h \
display/nr-filter-gaussian.cpp \
display/nr-filter-gaussian.h \
display/nr-filter-getalpha.cpp \
display/nr-filter-image.h \
display/nr-filter-merge.cpp \
display/nr-filter-merge.h \
+ display/nr-filter-morphology.cpp \
+ display/nr-filter-morphology.h \
display/nr-filter-offset.cpp \
display/nr-filter-offset.h \
display/nr-filter-primitive.cpp \
diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * feColorMatrix filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-colormatrix.h"
+namespace NR {
+
+FilterColorMatrix::FilterColorMatrix()
+{
+ g_warning("FilterColorMatrix::render not implemented.");
+}
+
+FilterPrimitive * FilterColorMatrix::create() {
+ return new FilterColorMatrix();
+}
+
+FilterColorMatrix::~FilterColorMatrix()
+{}
+
+int FilterColorMatrix::render(FilterSlot &slot, Matrix const &trans) {
+ NRPixBlock *in = slot.get(_input);
+ NRPixBlock *out = new NRPixBlock;
+
+ nr_pixblock_setup_fast(out, in->mode,
+ in->area.x0, in->area.y0, in->area.x1, in->area.y1,
+ true);
+
+ unsigned char *in_data = NR_PIXBLOCK_PX(in);
+ unsigned char *out_data = NR_PIXBLOCK_PX(out);
+
+//IMPLEMENT ME!
+
+ out->empty = FALSE;
+ slot.set(_output, out);
+ return 0;
+}
+
+void FilterColorMatrix::area_enlarge(NRRectL &area, Matrix const &trans)
+{
+}
+
+} /* namespace NR */
+
+/*
+ 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/display/nr-filter-colormatrix.h b/src/display/nr-filter-colormatrix.h
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __NR_FILTER_COLOR_MATRIX_H__
+#define __NR_FILTER_COLOR_MATRIX_H__
+
+/*
+ * feColorMatrix filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-primitive.h"
+#include "display/nr-filter-slot.h"
+
+namespace NR {
+
+class FilterColorMatrix : public FilterPrimitive {
+public:
+ FilterColorMatrix();
+ static FilterPrimitive *create();
+ virtual ~FilterColorMatrix();
+
+ virtual int render(FilterSlot &slot, Matrix const &trans);
+ virtual void area_enlarge(NRRectL &area, Matrix const &trans);
+};
+
+} /* namespace NR */
+
+#endif /* __NR_FILTER_COLOR_MATRIX_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 :
diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * feFlood filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-flood.h"
+namespace NR {
+
+FilterFlood::FilterFlood()
+{
+ g_warning("FilterFlood::render not implemented.");
+}
+
+FilterPrimitive * FilterFlood::create() {
+ return new FilterFlood();
+}
+
+FilterFlood::~FilterFlood()
+{}
+
+int FilterFlood::render(FilterSlot &slot, Matrix const &trans) {
+ NRPixBlock *in = slot.get(_input);
+ NRPixBlock *out = new NRPixBlock;
+
+ nr_pixblock_setup_fast(out, in->mode,
+ in->area.x0, in->area.y0, in->area.x1, in->area.y1,
+ true);
+
+ unsigned char *in_data = NR_PIXBLOCK_PX(in);
+ unsigned char *out_data = NR_PIXBLOCK_PX(out);
+
+//IMPLEMENT ME!
+
+ out->empty = FALSE;
+ slot.set(_output, out);
+ return 0;
+}
+
+void FilterFlood::area_enlarge(NRRectL &area, Matrix const &trans)
+{
+}
+
+} /* namespace NR */
+
+/*
+ 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/display/nr-filter-flood.h b/src/display/nr-filter-flood.h
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __NR_FILTER_FLOOD_H__
+#define __NR_FILTER_FLOOD_H__
+
+/*
+ * feFlood filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-primitive.h"
+#include "display/nr-filter-slot.h"
+
+namespace NR {
+
+class FilterFlood : public FilterPrimitive {
+public:
+ FilterFlood();
+ static FilterPrimitive *create();
+ virtual ~FilterFlood();
+
+ virtual int render(FilterSlot &slot, Matrix const &trans);
+ virtual void area_enlarge(NRRectL &area, Matrix const &trans);
+};
+
+} /* namespace NR */
+
+#endif /* __NR_FILTER_FLOOD_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 :
diff --git a/src/display/nr-filter-morphology.cpp b/src/display/nr-filter-morphology.cpp
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * feMorphology filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-morphology.h"
+namespace NR {
+
+FilterMorphology::FilterMorphology()
+{
+ g_warning("FilterMorphology::render not implemented.");
+}
+
+FilterPrimitive * FilterMorphology::create() {
+ return new FilterMorphology();
+}
+
+FilterMorphology::~FilterMorphology()
+{}
+
+int FilterMorphology::render(FilterSlot &slot, Matrix const &trans) {
+ NRPixBlock *in = slot.get(_input);
+ NRPixBlock *out = new NRPixBlock;
+
+ nr_pixblock_setup_fast(out, in->mode,
+ in->area.x0, in->area.y0, in->area.x1, in->area.y1,
+ true);
+
+ unsigned char *in_data = NR_PIXBLOCK_PX(in);
+ unsigned char *out_data = NR_PIXBLOCK_PX(out);
+
+//IMPLEMENT ME!
+
+ out->empty = FALSE;
+ slot.set(_output, out);
+ return 0;
+}
+
+void FilterMorphology::area_enlarge(NRRectL &area, Matrix const &trans)
+{
+}
+
+} /* namespace NR */
+
+/*
+ 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/display/nr-filter-morphology.h b/src/display/nr-filter-morphology.h
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __NR_FILTER_MORPHOLOGY_H__
+#define __NR_FILTER_MORPHOLOGY_H__
+
+/*
+ * feMorphology filter primitive renderer
+ *
+ * Authors:
+ * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/nr-filter-primitive.h"
+#include "display/nr-filter-slot.h"
+
+namespace NR {
+
+class FilterMorphology : public FilterPrimitive {
+public:
+ FilterMorphology();
+ static FilterPrimitive *create();
+ virtual ~FilterMorphology();
+
+ virtual int render(FilterSlot &slot, Matrix const &trans);
+ virtual void area_enlarge(NRRectL &area, Matrix const &trans);
+};
+
+} /* namespace NR */
+
+#endif /* __NR_FILTER_MORPHOLOGY_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 :
index 31c3478a2619ec937d5a9f7f07457c28b05d3cce..34a33e2b88bbcd4acc53f4916c7a7858c768aee0 100644 (file)
#include "display/nr-filter-blend.h"
#include "display/nr-filter-composite.h"
#include "display/nr-filter-convolve-matrix.h"
+#include "display/nr-filter-colormatrix.h"
+#include "display/nr-filter-component-transfer.h"
#include "display/nr-filter-diffuselighting.h"
#include "display/nr-filter-displacement-map.h"
+#include "display/nr-filter-flood.h"
#include "display/nr-filter-gaussian.h"
#include "display/nr-filter-image.h"
#include "display/nr-filter-merge.h"
+#include "display/nr-filter-morphology.h"
#include "display/nr-filter-offset.h"
#include "display/nr-filter-specularlighting.h"
#include "display/nr-filter-tile.h"
if(created) return;
/* Some filter classes are not implemented yet.
- Filters with constructors appearing in this table are not necessarilly already implemented.
- Some of them still have only boilerplate-code.*/
+ Some of them still have only boilerplate code.*/
_constructor[NR_FILTER_BLEND] = &FilterBlend::create;
- _constructor[NR_FILTER_COLORMATRIX] = NULL;
- _constructor[NR_FILTER_COMPONENTTRANSFER] = NULL;
+ _constructor[NR_FILTER_COLORMATRIX] = &FilterColorMatrix::create;
+ _constructor[NR_FILTER_COMPONENTTRANSFER] = &FilterComponentTransfer::create;
_constructor[NR_FILTER_COMPOSITE] = &FilterComposite::create;
_constructor[NR_FILTER_CONVOLVEMATRIX] = &FilterConvolveMatrix::create;
_constructor[NR_FILTER_DIFFUSELIGHTING] = &FilterDiffuseLighting::create;
_constructor[NR_FILTER_DISPLACEMENTMAP] = &FilterDisplacementMap::create;
- _constructor[NR_FILTER_FLOOD] = NULL;
+ _constructor[NR_FILTER_FLOOD] = &FilterFlood::create;
_constructor[NR_FILTER_GAUSSIANBLUR] = &FilterGaussian::create;
_constructor[NR_FILTER_IMAGE] = &FilterImage::create;
_constructor[NR_FILTER_MERGE] = &FilterMerge::create;
- _constructor[NR_FILTER_MORPHOLOGY] = NULL;
+ _constructor[NR_FILTER_MORPHOLOGY] = &FilterMorphology::create;
_constructor[NR_FILTER_OFFSET] = &FilterOffset::create;
_constructor[NR_FILTER_SPECULARLIGHTING] = &FilterSpecularLighting::create;
_constructor[NR_FILTER_TILE] = &FilterTile::create;
index 747ceeb4f1195470fd7ed3c3fc438fa975397e3b..f8378135a1124b2dd62c0c0d972d11f240c472c8 100644 (file)
--- a/src/sp-fecolormatrix.cpp
+++ b/src/sp-fecolormatrix.cpp
static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value);
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 void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter);
static SPFilterPrimitiveClass *feColorMatrix_parent_class;
sp_feColorMatrix_class_init(SPFeColorMatrixClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *)klass;
-
+ SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass;
+
feColorMatrix_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass);
sp_object_class->build = sp_feColorMatrix_build;
sp_object_class->write = sp_feColorMatrix_write;
sp_object_class->set = sp_feColorMatrix_set;
sp_object_class->update = sp_feColorMatrix_update;
+ sp_primitive_class->build_renderer = sp_feColorMatrix_build_renderer;
}
static void
@@ -161,6 +164,19 @@ sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
return repr;
}
+static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) {
+ g_assert(primitive != NULL);
+ g_assert(filter != NULL);
+
+ SPFeColorMatrix *sp_colormatrix = SP_FECOLORMATRIX(primitive);
+
+ int primitive_n = filter->add_primitive(NR::NR_FILTER_COLORMATRIX);
+ NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
+ NR::FilterColorMatrix *nr_colormatrix = dynamic_cast<NR::FilterColorMatrix*>(nr_primitive);
+ g_assert(nr_colormatrix != NULL);
+
+ sp_filter_primitive_renderer_common(primitive, nr_primitive);
+}
/*
Local Variables:
diff --git a/src/sp-fecolormatrix.h b/src/sp-fecolormatrix.h
index 85623c6802bcb52d5902ed32eb104f4ab80012d2..6dc0b6966a83c36eb1aa09db548ef6132e19a02e 100644 (file)
--- a/src/sp-fecolormatrix.h
+++ b/src/sp-fecolormatrix.h
#include "sp-filter.h"
#include "sp-fecolormatrix-fns.h"
+#include "display/nr-filter.h"
+#include "display/nr-filter-colormatrix.h"
/* FeColorMatrix base class */
class SPFeColorMatrixClass;
diff --git a/src/sp-feflood.cpp b/src/sp-feflood.cpp
index 924fb8f648e5c9955135b2000680323c846df5cf..837ccf4aeed7f9670baedecf1199f24aa64510b6 100644 (file)
--- a/src/sp-feflood.cpp
+++ b/src/sp-feflood.cpp
static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value);
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 void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter);
static SPFilterPrimitiveClass *feFlood_parent_class;
sp_feFlood_class_init(SPFeFloodClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *)klass;
-
+ SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass;
+
feFlood_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass);
sp_object_class->build = sp_feFlood_build;
sp_object_class->write = sp_feFlood_write;
sp_object_class->set = sp_feFlood_set;
sp_object_class->update = sp_feFlood_update;
+ sp_primitive_class->build_renderer = sp_feFlood_build_renderer;
}
static void
return repr;
}
+static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) {
+ g_assert(primitive != NULL);
+ g_assert(filter != NULL);
+
+ SPFeFlood *sp_flood = SP_FEFLOOD(primitive);
+
+ int primitive_n = filter->add_primitive(NR::NR_FILTER_FLOOD);
+ NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
+ NR::FilterFlood *nr_flood = dynamic_cast<NR::FilterFlood*>(nr_primitive);
+ g_assert(nr_flood != NULL);
+
+ sp_filter_primitive_renderer_common(primitive, nr_primitive);
+}
+
/*
Local Variables:
diff --git a/src/sp-feflood.h b/src/sp-feflood.h
index 87d674ab732b5de2db3d5b4a44cdd229d1f1c686..c0df0d31201742a542e6cdf9ddc98e16faca2b8e 100644 (file)
--- a/src/sp-feflood.h
+++ b/src/sp-feflood.h
#include "sp-filter.h"
#include "sp-feflood-fns.h"
+#include "display/nr-filter.h"
+#include "display/nr-filter-flood.h"
+
/* FeFlood base class */
class SPFeFloodClass;
index 78b7bbaf4acc934000cc294002b2fbd57207af08..980d77968e2163a74e5936630b151fa9a67e3467 100644 (file)
--- a/src/sp-femorphology.cpp
+++ b/src/sp-femorphology.cpp
static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value);
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 void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter);
static SPFilterPrimitiveClass *feMorphology_parent_class;
sp_feMorphology_class_init(SPFeMorphologyClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *)klass;
-
+ SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass;
+
feMorphology_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass);
sp_object_class->build = sp_feMorphology_build;
sp_object_class->write = sp_feMorphology_write;
sp_object_class->set = sp_feMorphology_set;
sp_object_class->update = sp_feMorphology_update;
+ sp_primitive_class->build_renderer = sp_feMorphology_build_renderer;
}
static void
@@ -161,6 +164,19 @@ sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
return repr;
}
+static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) {
+ g_assert(primitive != NULL);
+ g_assert(filter != NULL);
+
+ SPFeMorphology *sp_morphology = SP_FEMORPHOLOGY(primitive);
+
+ int primitive_n = filter->add_primitive(NR::NR_FILTER_MORPHOLOGY);
+ NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
+ NR::FilterMorphology *nr_morphology = dynamic_cast<NR::FilterMorphology*>(nr_primitive);
+ g_assert(nr_morphology != NULL);
+
+ sp_filter_primitive_renderer_common(primitive, nr_primitive);
+}
/*
Local Variables:
diff --git a/src/sp-femorphology.h b/src/sp-femorphology.h
index b3196fe084c1a892cb01a5b2287009469c64505e..11206b2da7d5540d81cbf9fe338b1724ad2439b7 100644 (file)
--- a/src/sp-femorphology.h
+++ b/src/sp-femorphology.h
#include "sp-filter.h"
#include "sp-femorphology-fns.h"
+#include "display/nr-filter.h"
+#include "display/nr-filter-morphology.h"
+
+
/* FeMorphology base class */
class SPFeMorphologyClass;