Code

User message context in extensions
[inkscape.git] / src / display / nr-filter-primitive.cpp
1 #define __NR_FILTER_PRIMITIVE_CPP__
3 /*
4  * SVG filters rendering
5  *
6  * Author:
7  *   Niko Kiirala <niko@kiirala.com>
8  *
9  * Copyright (C) 2006 Niko Kiirala
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #include "display/nr-filter-primitive.h"
15 #include "display/nr-filter-types.h"
16 #include "libnr/nr-pixblock.h"
17 #include "svg/svg-length.h"
19 namespace Inkscape {
20 namespace Filters {
22 FilterPrimitive::FilterPrimitive()
23 {
24     _input = NR_FILTER_SLOT_NOT_SET;
25     _output = NR_FILTER_SLOT_NOT_SET;
27     // These defaults are according to SVG standard.
28     // NB: SVGLength.set takes prescaled percent values: 1 means 100%
29     _region_x.set(SVGLength::PERCENT, 0, 0);
30     _region_y.set(SVGLength::PERCENT, 0, 0);
31     _region_width.set(SVGLength::PERCENT, 1, 0);
32     _region_height.set(SVGLength::PERCENT, 1, 0);
33 }
35 FilterPrimitive::~FilterPrimitive()
36 {
37     // Nothing to do here
38 }
40 void FilterPrimitive::area_enlarge(NRRectL &/*area*/, Geom::Matrix const &/*m*/)
41 {
42     // This doesn't need to do anything by default
43 }
45 void FilterPrimitive::set_input(int slot) {
46     set_input(0, slot);
47 }
49 void FilterPrimitive::set_input(int input, int slot) {
50     if (input == 0) _input = slot;
51 }
53 void FilterPrimitive::set_output(int slot) {
54     if (slot >= 0) _output = slot;
55 }
57 FilterTraits FilterPrimitive::get_input_traits() {
58     return TRAIT_ANYTHING;
59 }
61 } /* namespace Filters */
62 } /* namespace Inkscape */
64 /*
65   Local Variables:
66   mode:c++
67   c-file-style:"stroustrup"
68   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
69   indent-tabs-mode:nil
70   fill-column:99
71   End:
72 */
73 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :