Code

Change desktop coordinate system to match SVG (LP #170049)
[inkscape.git] / src / display / nr-filter-slot.h
1 #ifndef __NR_FILTER_SLOT_H__
2 #define __NR_FILTER_SLOT_H__
4 /*
5  * A container class for filter slots. Allows for simple getting and
6  * setting images in filter slots without having to bother with
7  * table indexes and such.
8  *
9  * Author:
10  *   Niko Kiirala <niko@kiirala.com>
11  *
12  * Copyright (C) 2006,2007 Niko Kiirala
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include "libnr/nr-pixblock.h"
18 #include "display/nr-filter-types.h"
19 #include "display/nr-filter-units.h"
21 struct NRArenaItem;
23 namespace Inkscape {
24 namespace Filters {
26 class FilterSlot {
27 public:
28     /** Creates a new FilterSlot object.
29      * First parameter specifies the amount of slots this SilterSlot
30      * should reserve beforehand. If a negative number is given,
31      * two slots will be reserved.
32      * Second parameter specifies the arena item, which should be used
33      * for background accesses from filters.
34      */
35     FilterSlot(int slots, NRArenaItem const *item);
36     /** Destroys the FilterSlot object and all its contents */
37     virtual ~FilterSlot();
39     /** Returns the pixblock in specified slot.
40      * Parameter 'slot' may be either an positive integer or one of
41      * pre-defined filter slot types: NR_FILTER_SLOT_NOT_SET,
42      * NR_FILTER_SOURCEGRAPHIC, NR_FILTER_SOURCEALPHA,
43      * NR_FILTER_BACKGROUNDIMAGE, NR_FILTER_BACKGROUNDALPHA,
44      * NR_FILTER_FILLPAINT, NR_FILTER_SOURCEPAINT.
45      * If the defined filter slot is not set before, this function
46      * returns NULL. Also, that filter slot is created in process.
47      */
48     NRPixBlock *get(int slot);
50     /** Gets the final result from this filter.
51      * The result is fetched from the specified slot, see description of
52      * method get for valid values. The pixblock 'result' will be modified
53      * to contain the result image, ready to be used in the rest of rendering
54      * pipeline
55      */
56     void get_final(int slot, NRPixBlock *result);
58     /** Sets or re-sets the pixblock associated with given slot.
59      * If there was a pixblock already assigned with this slot,
60      * that pixblock is destroyed.
61      * Pixblocks passed to this function should be considered
62      * managed by this FilterSlot object.
63      * Pixblocks passed to this function should be reserved with
64      * c++ -style new-operator.
65      */
66     void set(int slot, NRPixBlock *pb);
68     /** Returns the number of slots in use. */
69     int get_slot_count();
71     /** arenaitem getter method*/
72     NRArenaItem const* get_arenaitem();
74     /** Sets the unit system to be used for the internal images. */
75     void set_units(FilterUnits const &units);
77     /** Sets the filtering quality. Affects used interpolation methods */
78     void set_quality(FilterQuality const q);
80     /** Sets the gaussian filtering quality. Affects used interpolation methods */
81     void set_blurquality(int const q);
83     /** Gets the gaussian filtering quality. Affects used interpolation methods */
84     int get_blurquality(void);
86 private:
87     NRPixBlock **_slot;
88     int *_slot_number;
89     int _slot_count;
91     int _last_out;
93     FilterQuality filterquality;
95     int blurquality;
97     NRArenaItem const *_arena_item;
99     FilterUnits units;
101     /** Returns the table index of given slot. If that slot does not exist,
102      * it is created. Table index can be used to read the correct
103      * pixblock from _slot */
104     int _get_index(int slot);
105 };
107 } /* namespace Filters */
108 } /* namespace Inkscape */
110 #endif // __NR_FILTER_SLOT_H__
111 /*
112   Local Variables:
113   mode:c++
114   c-file-style:"stroustrup"
115   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116   indent-tabs-mode:nil
117   fill-column:99
118   End:
119 */
120 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :