W3C home > Mailing lists > Public > www-svg@w3.org > July 2010

feImage coordinates question

From: Tavmjong Bah <tavmjong@free.fr>
Date: Sat, 10 Jul 2010 17:46:43 +0200
To: www-svg@w3.org
Message-ID: <1278776803.1749.27.camel@localhost>


	I've been trying to understand the feImage spec as Inkscape's rendering
of a PNG via feImage is quite different from others. So I've trace
through the spec all the relevant parts. Here is what I find:

Filter effects region:

       filterUnits = userSpaceOnUse  or objectBoundingBox (default)

       filter "hard clipped" to x, y, width height
       	      (default: -10%, -10%, 120%, 120%)

       primitiveUnits  = userSpaceOnUse  (default) or objectBoundingBox

Filter effects subregion (filter primitive attribute)

       filter primitive "hard clipped" to x, y, width height
       	      (default: 0%, 0%, 100%, 100%)

       * First weirdness: the default is specified in percent,
         i.e. objectBoundingBox, but primitiveUnits default is
         userSpaceOnUse. Shouldn't the primitiveUnits default also be
         objectBoundingBox? Why is it different from the default of
         the filter effects region? (BTW, adding primitiveUnits =
         objectBoundingBox without adding x, y, width, and height
         breaks Batik.)

feImage primitive

       Coordinate system depends on "primitiveUnits"

       Image is to be rendered according to the "image" element which
       specifies that an image is rendered by default so that it
       is centered in the specified viewport with at least two
       opposite sides touching the viewport sides.

       * Second weirdness: The coordinate system "depends on the value
         of attribute 'primitiveUnits'" which defaults to bounding box
         of the referenced object. As I read the spec it says that an
         image drawn via the feImage primitive should be drawn by
         default so that two opposite edges touch the bounding box
         (i.e. xMidYMid). This is what Inkscape does. However, Batik
         and other browsers draw the image so that two opposite edges
         touch the edges of the filter effects region.

	 Inkscape's behavior makes more sense to me. The filter
	 effects region is described as a way to limit CPU use in
	 filter calculations. One would not expect the filter output
	 to change depending on the filter effects region except for
	 including or excluding area. This seems to be what the other
	 filters primitives do (e.g. the feTurbulence filter pattern
	 doesn't change when the filter effects region changes).

There is a test at:


	I would expect the images to fit in the red rectangles. Am I missing

Received on Saturday, 10 July 2010 15:47:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:27 UTC