index 4a7bdb140faa0f5d3b3102c033ed158ee8cbf485..74b41211bb3acddf13829c3f03d7d1a3365b855f 100644 (file)
* Author:
* Niko Kiirala <niko@kiirala.com>
*
- * Copyright (C) 2006 Niko Kiirala
+ * Copyright (C) 2006-2007 Niko Kiirala
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include "display/nr-filter-slot.h"
#include "libnr/nr-pixblock.h"
-#include "libnr/nr-matrix.h"
+#include "libnr/nr-rect-l.h"
#include "svg/svg-length.h"
-namespace NR {
+namespace Inkscape {
+namespace Filters {
+
+/*
+ * Different filter effects need different types of inputs. This is what
+ * traits are used for: one can specify, what special restrictions
+ * there are for inputs.
+ *
+ * Example: gaussian blur requires that x- and y-axis of input image
+ * are paraller to blurred object's x- and y-axis, respectively.
+ * Otherwise blur wouldn't rotate with the object.
+ *
+ * Values here should be powers of two, so these can be used as bitfield.
+ * That is: any combination ef existing traits can be specified. (excluding
+ * TRAIT_ANYTHING, which is alias for no traits defined)
+ */
+enum FilterTraits {
+ TRAIT_ANYTHING = 0,
+ TRAIT_PARALLER = 1
+};
class FilterPrimitive {
public:
FilterPrimitive();
- virtual ~FilterPrimitive()
- {}
- int render(NRPixBlock **pb, NRMatrix const *trans);
- virtual int render(NRPixBlock **pb, Matrix const &trans) = 0;
- virtual int get_enlarge(Matrix const &m);
+ virtual ~FilterPrimitive();
+
+ virtual int render(FilterSlot &slot, FilterUnits const &units) = 0;
+ virtual void area_enlarge(NRRectL &area, Geom::Matrix const &m);
/**
* Sets the input slot number 'slot' to be used as input in rendering
*/
void reset_region();
+ /**
+ * Queries the filter, which traits it needs from its input buffers.
+ * At the time of writing this, only one trait was needed, having
+ * user coordinate system and input pixelblock coordinates paraller to
+ * each other.
+ */
+ virtual FilterTraits get_input_traits();
+
protected:
int _input;
int _output;
};
-} /* namespace NR */
+} /* namespace Filters */
+} /* namespace Inkscape */