1 #ifndef __NR_FILTER_COMPONENT_TRANSFER_H__
2 #define __NR_FILTER_COMPONENT_TRANSFER_H__
4 /*
5 * feComponentTransfer filter primitive renderer
6 *
7 * Authors:
8 * Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
9 *
10 * Copyright (C) 2007 authors
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #include "display/nr-filter-primitive.h"
16 #include "display/nr-filter-slot.h"
17 #include "display/nr-filter-units.h"
18 #include <vector>
20 namespace NR {
22 enum FilterComponentTransferType {
23 COMPONENTTRANSFER_TYPE_IDENTITY,
24 COMPONENTTRANSFER_TYPE_TABLE,
25 COMPONENTTRANSFER_TYPE_DISCRETE,
26 COMPONENTTRANSFER_TYPE_LINEAR,
27 COMPONENTTRANSFER_TYPE_GAMMA,
28 COMPONENTTRANSFER_TYPE_ERROR
29 };
31 class FilterComponentTransfer : public FilterPrimitive {
32 public:
33 FilterComponentTransfer();
34 static FilterPrimitive *create();
35 virtual ~FilterComponentTransfer();
37 virtual int render(FilterSlot &slot, FilterUnits const &units);
38 virtual void area_enlarge(NRRectL &area, Matrix const &trans);
40 void set_type(FilterComponentTransferType t);
41 void set_tableValues(std::vector<gdouble>& tv);
42 void set_slope(double s);
43 void set_intercept(double i);
44 void set_amplitude(double a);
45 void set_exponent(double e);
46 void set_offset(double o);
48 private:
49 FilterComponentTransferType type;
50 std::vector<gdouble> tableValues;
51 double slope;
52 double intercept;
53 double amplitude;
54 double exponent;
55 double offset;
56 };
58 } /* namespace NR */
60 #endif /* __NR_FILTER_COMPONENT_TRANSFER_H__ */
61 /*
62 Local Variables:
63 mode:c++
64 c-file-style:"stroustrup"
65 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
66 indent-tabs-mode:nil
67 fill-column:99
68 End:
69 */
70 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :