Code

use all 2geom typed pathv_matrix_point_bbox_wind_distance
[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-units.h"
20 struct NRArenaItem;
22 namespace NR {
24 class FilterSlot {
25 public:
26     /** Creates a new FilterSlot object.
27      * First parameter specifies the amount of slots this SilterSlot
28      * should reserve beforehand. If a negative number is given,
29      * two slots will be reserved.
30      * Second parameter specifies the arena item, which should be used
31      * for background accesses from filters.
32      */
33     FilterSlot(int slots, NRArenaItem const *item);
34     /** Destroys the FilterSlot object and all its contents */
35     virtual ~FilterSlot();
37     /** Returns the pixblock in specified slot.
38      * Parameter 'slot' may be either an positive integer or one of
39      * pre-defined filter slot types: NR_FILTER_SLOT_NOT_SET,
40      * NR_FILTER_SOURCEGRAPHIC, NR_FILTER_SOURCEALPHA,
41      * NR_FILTER_BACKGROUNDIMAGE, NR_FILTER_BACKGROUNDALPHA,
42      * NR_FILTER_FILLPAINT, NR_FILTER_SOURCEPAINT.
43      * If the defined filter slot is not set before, this function
44      * returns NULL. Also, that filter slot is created in process.
45      */
46     NRPixBlock *get(int slot);
48     /** Gets the final result from this filter.
49      * The result is fetched from the specified slot, see description of
50      * method get for valid values. The pixblock 'result' will be modified
51      * to contain the result image, ready to be used in the rest of rendering
52      * pipeline
53      */
54     void get_final(int slot, NRPixBlock *result);
56     /** Sets or re-sets the pixblock associated with given slot.
57      * If there was a pixblock already assigned with this slot,
58      * that pixblock is destroyed.
59      * Pixblocks passed to this function should be considered
60      * managed by this FilterSlot object.
61      * Pixblocks passed to this function should be reserved with
62      * c++ -style new-operator.
63      */
64     void set(int slot, NRPixBlock *pb);
66     /** Returns the number of slots in use. */
67     int get_slot_count();
69     /** arenaitem getter method*/
70     NRArenaItem const* get_arenaitem();
72     /** Sets the unit system to be used for the internal images. */
73     void set_units(FilterUnits const &units);
75 private:
76     NRPixBlock **_slot;
77     int *_slot_number;
78     int _slot_count;
80     int _last_out;
82     NRArenaItem const *_arena_item;
84     FilterUnits units;
86     /** Returns the table index of given slot. If that slot does not exist,
87      * it is created. Table index can be used to read the correct
88      * pixblock from _slot */
89     int _get_index(int slot);
90 };
92 }
94 #endif // __NR_FILTER_SLOT_H__
95 /*
96   Local Variables:
97   mode:c++
98   c-file-style:"stroustrup"
99   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
100   indent-tabs-mode:nil
101   fill-column:99
102   End:
103 */
104 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :