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 NR {
21 FilterPrimitive::FilterPrimitive()
22 {
23 _input = NR_FILTER_SLOT_NOT_SET;
24 _output = NR_FILTER_SLOT_NOT_SET;
26 // These defaults are according to SVG standard.
27 // NB: SVGLength.set takes prescaled percent values: 1 means 100%
28 _region_x.set(SVGLength::PERCENT, 0, 0);
29 _region_y.set(SVGLength::PERCENT, 0, 0);
30 _region_width.set(SVGLength::PERCENT, 1, 0);
31 _region_height.set(SVGLength::PERCENT, 1, 0);
32 }
34 FilterPrimitive::~FilterPrimitive()
35 {
36 // Nothing to do here
37 }
39 void FilterPrimitive::area_enlarge(NRRectL &area, Matrix const &m)
40 {
41 // This doesn't need to do anything by default
42 }
44 void FilterPrimitive::set_input(int slot) {
45 set_input(0, slot);
46 }
48 void FilterPrimitive::set_input(int input, int slot) {
49 if (input == 0) _input = slot;
50 }
52 void FilterPrimitive::set_output(int slot) {
53 if (slot >= 0) _output = slot;
54 }
56 FilterTraits FilterPrimitive::get_input_traits() {
57 return TRAIT_ANYTHING;
58 }
60 } /* namespace NR */
62 /*
63 Local Variables:
64 mode:c++
65 c-file-style:"stroustrup"
66 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
67 indent-tabs-mode:nil
68 fill-column:99
69 End:
70 */
71 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :