From: jucablues Date: Fri, 3 Aug 2007 22:06:30 +0000 (+0000) Subject: boiler plate code for feTile X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=722f7dbea16756eec7d07b53cefbdbe8861bac09;p=inkscape.git boiler plate code for feTile --- diff --git a/src/display/Makefile_insert b/src/display/Makefile_insert index 1713dc751..ed9eae9be 100644 --- a/src/display/Makefile_insert +++ b/src/display/Makefile_insert @@ -93,6 +93,8 @@ display_libspdisplay_a_SOURCES = \ display/nr-filter-slot.h \ display/nr-filter-specularlighting.cpp \ display/nr-filter-specularlighting.h \ + display/nr-filter-tile.cpp \ + display/nr-filter-tile.h \ display/nr-filter-turbulence.cpp \ display/nr-filter-turbulence.h \ display/nr-filter-pixops.h \ diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp new file mode 100644 index 000000000..69d577687 --- /dev/null +++ b/src/display/nr-filter-tile.cpp @@ -0,0 +1,60 @@ +/* + * feTile filter primitive renderer + * + * Authors: + * Felipe Corrêa da Silva Sanches + * + * Copyright (C) 2007 authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "display/nr-filter-tile.h" +namespace NR { + +FilterTile::FilterTile() +{ + g_warning("FilterTile::render not implemented."); +} + +FilterPrimitive * FilterTile::create() { + return new FilterTile(); +} + +FilterTile::~FilterTile() +{} + +int FilterTile::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 FilterTile::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-tile.h b/src/display/nr-filter-tile.h new file mode 100644 index 000000000..32aa7b086 --- /dev/null +++ b/src/display/nr-filter-tile.h @@ -0,0 +1,44 @@ +#ifndef __NR_FILTER_TILE_H__ +#define __NR_FILTER_TILE_H__ + +/* + * feTile filter primitive renderer + * + * Authors: + * Felipe Corrêa da Silva Sanches + * + * 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" +#include "libnr/nr-matrix.h" +#include "libnr/nr-rect-l.h" + +namespace NR { + +class FilterTile : public FilterPrimitive { +public: + FilterTile(); + static FilterPrimitive *create(); + virtual ~FilterTile(); + + virtual int render(FilterSlot &slot, Matrix const &trans); + virtual void area_enlarge(NRRectL &area, Matrix const &trans); +}; + +} /* namespace NR */ + +#endif /* __NR_FILTER_TILE_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.cpp b/src/display/nr-filter.cpp index 95867363b..31c3478a2 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -31,6 +31,7 @@ #include "display/nr-filter-merge.h" #include "display/nr-filter-offset.h" #include "display/nr-filter-specularlighting.h" +#include "display/nr-filter-tile.h" #include "display/nr-filter-turbulence.h" #include "display/nr-arena-item.h" @@ -331,7 +332,7 @@ void Filter::_create_constructor_table() _constructor[NR_FILTER_MORPHOLOGY] = NULL; _constructor[NR_FILTER_OFFSET] = &FilterOffset::create; _constructor[NR_FILTER_SPECULARLIGHTING] = &FilterSpecularLighting::create; - _constructor[NR_FILTER_TILE] = NULL; + _constructor[NR_FILTER_TILE] = &FilterTile::create; _constructor[NR_FILTER_TURBULENCE] = &FilterTurbulence::create; created = true; } diff --git a/src/sp-fetile.cpp b/src/sp-fetile.cpp index 03967ce05..bb86a4627 100644 --- a/src/sp-fetile.cpp +++ b/src/sp-fetile.cpp @@ -33,6 +33,7 @@ static void sp_feTile_release(SPObject *object); 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 void sp_feTile_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feTile_parent_class; @@ -61,6 +62,7 @@ static void sp_feTile_class_init(SPFeTileClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; + SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass; feTile_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass); @@ -69,6 +71,7 @@ sp_feTile_class_init(SPFeTileClass *klass) sp_object_class->write = sp_feTile_write; sp_object_class->set = sp_feTile_set; sp_object_class->update = sp_feTile_update; + sp_primitive_class->build_renderer = sp_feTile_build_renderer; } static void @@ -161,6 +164,19 @@ sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) return repr; } +static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { + g_assert(primitive != NULL); + g_assert(filter != NULL); + + SPFeTile *sp_tile = SP_FETILE(primitive); + + int primitive_n = filter->add_primitive(NR::NR_FILTER_TILE); + NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + NR::FilterTile *nr_tile = dynamic_cast(nr_primitive); + g_assert(nr_tile != NULL); + + sp_filter_primitive_renderer_common(primitive, nr_primitive); +} /* Local Variables: diff --git a/src/sp-fetile.h b/src/sp-fetile.h index b6234c3f2..efcccf11d 100644 --- a/src/sp-fetile.h +++ b/src/sp-fetile.h @@ -16,6 +16,9 @@ #include "sp-filter.h" #include "sp-fetile-fns.h" +#include "display/nr-filter.h" +#include "display/nr-filter-tile.h" + /* FeTile base class */ class SPFeTileClass;