Code

New Class SPDocumentUndo created which takes care of c++fying some non SPDocument...
[inkscape.git] / src / display / nr-filter-primitive.h
index 7c8018fe2a40762747fe8219bbcb5078ae0897dc..74b41211bb3acddf13829c3f03d7d1a3365b855f 100644 (file)
@@ -7,26 +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 {
+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(FilterSlot &slot, NRMatrix const *trans);
-    virtual int render(FilterSlot &slot, Matrix const &trans) = 0;
-    virtual int get_enlarge(Matrix const &m);
+    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
@@ -82,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;
@@ -93,7 +119,8 @@ protected:
 };
 
 
-} /* namespace NR */
+} /* namespace Filters */
+} /* namespace Inkscape */