/** \file
* Superclass for all the filter primitives
*
*/
/*
* Authors:
* Kees Cook <kees@outflux.net>
* Niko Kiirala <niko@kiirala.com>
* Abhishek Sharma
*
* Copyright (C) 2004-2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "display/nr-filter-primitive.h"
#include "display/nr-filter-types.h"
#include "attributes.h"
#include "style.h"
#include "sp-filter-primitive.h"
#include "sp-filter.h"
#include "sp-item.h"
// CPPIFY: Make pure virtual.
//void SPFilterPrimitive::build_renderer(Inkscape::Filters::Filter* filter) {
// throw;
//}
// We must keep track if a value is set or not, if not set then the region defaults to 0%, 0%,
// 100%, 100% ("x", "y", "width", "height") of the -> filter <- region. If set then
// percentages are in terms of bounding box or viewbox, depending on value of "primitiveUnits"
// NB: SVGLength.set takes prescaled percent values: 1 means 100%
}
}
/**
* 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.
*/
}
/**
* Drops any allocated memory.
*/
}
/**
* Sets a specific value in the SPFilterPrimitive.
*/
int image_nr;
switch (key) {
case SP_ATTR_IN:
if (value) {
} else {
}
}
break;
case SP_ATTR_RESULT:
if (value) {
} else {
}
}
break;
/* Filter primitive sub-region */
case SP_ATTR_X:
this->x.readOrUnset(value);
break;
case SP_ATTR_Y:
this->y.readOrUnset(value);
break;
case SP_ATTR_WIDTH:
break;
case SP_ATTR_HEIGHT:
break;
}
/* See if any parents need this value. */
}
/**
* Receives update notifications.
*/
// Do here since we know viewport (Bounding box case handled during rendering)
this->x._set = true;
}
this->y._set = true;
}
}
}
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFilterPrimitive::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
if (!repr) {
}
/* Do we need to add x,y,width,height? */
return repr;
}
{
}
// TODO: are these case sensitive or not? (assumed yes)
switch (name[0]) {
case 'S':
break;
case 'B':
break;
case 'F':
break;
}
}
{
}
/**
* Gives name for output of previous filter. Makes things clearer when prim
* is a filter with two or more inputs. Returns the slot number of result
* of previous primitive, or NR_FILTER_SOURCEGRAPHIC if this is the first
* primitive.
*/
if (i) {
//XML Tree is being directly used while it shouldn't be.
return slot;
} else {
}
}
}
/* Common initialization for filter primitives */
void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim)
{
/* TODO: place here code to handle input images, filter area etc. */
// We don't know current viewport or bounding box, this is wrong approach.
// Give renderer access to filter properties
}
/*
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:fileencoding=utf-8:textwidth=99 :