Code

use all 2geom typed pathv_matrix_point_bbox_wind_distance
[inkscape.git] / src / display / nr-filter-primitive.h
index 4a7bdb140faa0f5d3b3102c033ed158ee8cbf485..fba4c634419484fc1b83c50a3c277161ce49e357 100644 (file)
@@ -7,25 +7,44 @@
  * 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 {
 
+/*
+ * 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, Matrix const &m);
 
     /**
      * Sets the input slot number 'slot' to be used as input in rendering
@@ -81,6 +100,14 @@ public:
      */
     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;