sp-femerge.cpp revision ad7e78cb16ace844160e613742645e012fd22cc9
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * SVG <feMerge> implementation.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * hugo Rodrigues <haa.rodrigues@gmail.com>
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Copyright (C) 2006 Hugo Rodrigues
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Released under GNU GPL, read the file 'COPYING' for more information
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen/* FeMerge base class */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_class_init(SPFeMergeClass *klass);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_init(SPFeMerge *feMerge);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_release(SPObject *object);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic Inkscape::XML::Node *sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic SPFilterPrimitiveClass *feMerge_parent_class;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen feMerge_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeMerge", &feMerge_info, (GTypeFlags)0);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen SPObjectClass *sp_object_class = (SPObjectClass *)klass;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen feMerge_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen sp_object_class->release = sp_feMerge_release;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen sp_primitive_class->build_renderer = sp_feMerge_build_renderer;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Reads the Inkscape::XML::Node, and initializes SPFeMerge variables. For this to get called,
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * our name must be associated with a repr via "sp_object_type_register". Best done through
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * sp-object-repr.cpp's repr_name_entries array.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelensp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if (((SPObjectClass *) feMerge_parent_class)->build) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen ((SPObjectClass *) feMerge_parent_class)->build(object, document, repr);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen /*LOAD ATTRIBUTES FROM REPR HERE*/
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Drops any allocated memory.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if (((SPObjectClass *) feMerge_parent_class)->release)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen ((SPObjectClass *) feMerge_parent_class)->release(object);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Sets a specific value in the SPFeMerge.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelensp_feMerge_set(SPObject *object, unsigned int key, gchar const *value)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen /*DEAL WITH SETTING ATTRIBUTES HERE*/
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if (((SPObjectClass *) feMerge_parent_class)->set)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen ((SPObjectClass *) feMerge_parent_class)->set(object, key, value);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Receives update notifications.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelensp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if (((SPObjectClass *) feMerge_parent_class)->update) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen ((SPObjectClass *) feMerge_parent_class)->update(object, ctx, flags);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Writes its settings to an incoming repr object, if any.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelensp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen // Inkscape-only object, not copied during an "plain SVG" dump:
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen // is this sane?
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen //repr->mergeFrom(SP_OBJECT_REPR(object), "id");
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if (((SPObjectClass *) feMerge_parent_class)->write) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen ((SPObjectClass *) feMerge_parent_class)->write(object, repr, flags);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelenstatic void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen int primitive_n = filter->add_primitive(NR::NR_FILTER_MERGE);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen NR::FilterMerge *nr_merge = dynamic_cast<NR::FilterMerge*>(nr_primitive);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen sp_filter_primitive_renderer_common(primitive, nr_primitive);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen Local Variables:
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen c-file-style:"stroustrup"
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen indent-tabs-mode:nil
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen fill-column:99
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :