Code

Patch from codedread. Prevents rendering of title/desc/metadata elements in text...
[inkscape.git] / src / display / nr-filter.h
index c1012475c3bdb3bb2e715e616e1332422a3e98c4..267f242d1aff218beae9421929b35dd40bcf33e9 100644 (file)
@@ -37,11 +37,11 @@ public:
      * Should this filter not have enough space for a new primitive, the filter
      * is enlarged to accomodate the new filter element. It may be enlarged by
      * more that one element.
-     * Returns a pointer to the filter primitive created.
-     * Returns NULL, if type is not valid filter primitive type or filter
+     * Returns a handle (non-negative integer) to the filter primitive created.
+     * Returns -1, if type is not valid filter primitive type or filter
      * primitive of such type cannot be created.
      */
-    FilterPrimitive *add_primitive(FilterPrimitiveType type);
+    int add_primitive(FilterPrimitiveType type);
     /**
      * Removes all filter primitives from this filter.
      * All pointers to filter primitives inside this filter should be
@@ -54,14 +54,19 @@ public:
      * If 'target' does not correspond to any primitive inside this filter OR
      * 'type' is not a valid filter primitive type OR
      * filter primitive of such type cannot be created,
-     * this function returns NULL and doesn't change the internal state of this
+     * this function returns -1 and doesn't change the internal state of this
      * filter.
      * Otherwise, a new filter primitive is created. Any pointers to filter
-     * primitive 'target' should be considered invalid. A pointer to the
+     * primitive 'target' should be considered invalid. A handle to the
      * newly created primitive is returned.
      */
-    FilterPrimitive *replace_primitive(FilterPrimitive *primitive,
-                                       FilterPrimitiveType type);
+    int replace_primitive(int primitive, FilterPrimitiveType type);
+
+    /**
+     * Returns a pointer to the primitive, which the handle corrensponds to.
+     * If the handle is not valid, returns NULL.
+     */
+    FilterPrimitive *get_primitive(int handle);
 
     /**
      * Sets the slot number 'slot' to be used as result from this filter.
@@ -72,10 +77,10 @@ public:
      */
     void set_output(int slot);
 
-    void set_x(SVGLength &lenght);
-    void set_y(SVGLength &length);
-    void set_width(SVGLength &length);
-    void set_height(SVGLength &length);
+    void set_x(SVGLength const &length);
+    void set_y(SVGLength const &length);
+    void set_width(SVGLength const &length);
+    void set_height(SVGLength const &length);
 
     /**
      * Sets the filter effects region.
@@ -100,7 +105,7 @@ public:
      * resolution is determined automatically. If x_pixels is less than zero,
      * calling this function results in no changes to filter state.
      */
-    void set_resolution(double x_pixels);
+    void set_resolution(double const x_pixels);
 
     /**
      * Sets the width and height of intermediate images in pixels. If not set,
@@ -108,7 +113,7 @@ public:
      * less than zero, calling this function results in no changes to filter
      * state.
      */
-    void set_resolution(double x_pixels, double y_pixels);
+    void set_resolution(double const x_pixels, double const y_pixels);
 
     /**
      * Resets the filter resolution to its default value, i.e. automatically
@@ -126,23 +131,31 @@ public:
 
     /**
      * Set the primitiveUnits-properterty. If not set, the default value of
-     * userSpaceOnUseis used. If the parameter value is not a valid
+     * userSpaceOnUse is used. If the parameter value is not a valid
      * enumeration value from SPFilterUnits, no changes to filter state
      * are made.
      */
     void set_primitive_units(SPFilterUnits unit);
 
     /** 
-     * Returns the amount of pixels the rendering area should be enlarged
-     * to prevent visual artefacts when filter needs to read pixels that
-     * are outside its output area (e.g. gaussian blur)
+     * Modifies the given area to accommodate for filters needing pixels
+     * outside the rendered area.
+     * When this function returns, area contains the area that needs
+     * to be rendered so that after filtering, the original area is
+     * drawn correctly.
      */
-    int get_enlarge(Matrix const &m);
+    void area_enlarge(NRRectL &area, Matrix const &m);
     /**
      * Given an object bounding box, this function enlarges it so that
      * it contains the filter effect area.
      */
     void bbox_enlarge(NRRectL &bbox);
+    /**
+     * Returns the filter effects area in user coordinate system.
+     * The given bounding box should be a bounding box as specified in
+     * SVG standard and in user coordinate system.
+     */
+    Rect filter_effect_area(Rect const &bbox);
 
     /** Creates a new filter with space for one filter element */
     Filter();
@@ -153,7 +166,7 @@ public:
      */
     Filter(int n);
     /** Destroys the filter and all its primitives */
-    ~Filter();
+    virtual ~Filter();
 
 private:
     int _primitive_count;