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 _region_x.set(SVGLength::PERCENT, 0, 0);
27 _region_y.set(SVGLength::PERCENT, 0, 0);
28 _region_width.set(SVGLength::PERCENT, 100, 0);
29 _region_height.set(SVGLength::PERCENT, 100, 0);
30 }
32 FilterPrimitive::~FilterPrimitive()
33 {
34 // Nothing to do here
35 }
37 int FilterPrimitive::render(FilterSlot &slot, NRMatrix const *trans) {
38 if(trans) {
39 return this->render(slot, *trans);
40 } else {
41 Matrix tmp;
42 tmp.set_identity();
43 return this->render(slot, tmp);
44 }
45 }
47 int FilterPrimitive::get_enlarge(Matrix const &m)
48 {
49 return 0;
50 }
52 void FilterPrimitive::set_input(int slot) {
53 set_input(0, slot);
54 }
56 void FilterPrimitive::set_input(int input, int slot) {
57 if (slot == 0) _input = slot;
58 }
60 void FilterPrimitive::set_output(int slot) {
61 if (slot >= 0) _output = slot;
62 }
64 } /* namespace NR */
66 /*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74 */
75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :