index 74cf7e003a1cf869576eec371d108ae26cbd6697..09190a9b0a105502d76df79a27d76aaea9f26dfc 100644 (file)
#include "libnr/nr-pixblock.h"
+struct NRArenaItem;
+
namespace NR {
class FilterSlot {
public:
- FilterSlot();
- FilterSlot(int slots);
+ /** Creates a new FilterSlot object.
+ * First parameter specifies the amount of slots this SilterSlot
+ * should reserve beforehand. If a negative number is given,
+ * two slots will be reserved.
+ * Second parameter specifies the arena item, which should be used
+ * for background accesses from filters.
+ */
+ FilterSlot(int slots, NRArenaItem const *item);
+ /** Destroys the FilterSlot object and all its contents */
~FilterSlot();
+ /** Returns the pixblock in specified slot.
+ * Parameter 'slot' may be either an positive integer or one of
+ * pre-defined filter slot types: NR_FILTER_SLOT_NOT_SET,
+ * NR_FILTER_SOURCEGRAPHIC, NR_FILTER_SOURCEALPHA,
+ * NR_FILTER_BACKGROUNDIMAGE, NR_FILTER_BACKGROUNDALPHA,
+ * NR_FILTER_FILLPAINT, NR_FILTER_SOURCEPAINT.
+ * If the defined filter slot is not set before, this function
+ * returns NULL. Also, that filter slot is created in process.
+ */
NRPixBlock *get(int slot);
+
+ /** Sets or re-sets the pixblock associated with given slot.
+ * If there was a pixblock already assigned with this slot,
+ * that pixblock is destroyed.
+ * Pixblocks passed to this function should be considered
+ * managed by this FilterSlot object.
+ * Pixblocks passed to this function should be reserved with
+ * c++ -style new-operator.
+ */
void set(int slot, NRPixBlock *pb);
+ /** Returns the number of slots in use. */
int get_slot_count();
private:
int _last_out;
+ NRArenaItem const *_arena_item;
+
+ /** Returns the table index of given slot. If that slot does not exist,
+ * it is created. Table index can be used to read the correct
+ * pixblock from _slot */
int _get_index(int slot);
};