Re: feImage image sizing

On Thu, 06 Mar 2008 13:01:54 +0100, Robert O'Callahan  
<robert@ocallahan.org> wrote:

> On Thu, Mar 6, 2008 at 11:42 PM, Erik Dahlström <ed@opera.com> wrote:
>
>> On Wed, 05 Mar 2008 09:17:43 +0100, Robert O'Callahan
>> <robert@ocallahan.org> wrote:
>>
>> > http://www.w3.org/TR/SVG/filters.html#feImage
>> >
>> > If the xlink:href references a stand-alone image resource such as a
>> JPEG,
>> >> PNG or SVG file, then the image resource is rendered according to the
>> >> behavior of the
>> >> 'image'<http://www.w3.org/TR/SVG/struct.html#ImageElement>element
>> >>
>> >
>> > For the <image> element, 'width' and 'height' are required attributes
>> > that
>> > define the size of the viewport into which the image is rendered.
>> > <feImage>
>> > doesn't have these attributes, so how should the image viewport be
>> > sized? If
>> > the image viewport is supposed to be (0,0)-(100%,100%) of the user
>> > coordinate system established by the value of 'primitiveUnits' on the
>> > 'filter' element, I think the spec needs to be clarified to say so
>> > explicitly.
>>
>> Actually, <feImage> have 'x', 'y', 'width' and 'height' attributes since
>> those describe the filter primitive subregion[1]. Even if not specified  
>> on
>> the <feImage>, these attributes take their defaults from the <filter>
>> element so that the filter primitive subregion is always defined.
>>
>
> But there is nothing that says to use the filter primitive subregion when
> the 'width' and 'height' attributes are not present, is there?

If you read section 15.7.3 you will find that the {x,y,width,height}  
attributes are defaulting to "0%,0%,100%,100%, where percentages are  
relative to the dimensions of the filter region.". Also feImage is  
explicitly mentioned there.

> Anyway, assuming you're right, then the text "In either case, the current
> user coordinate system depends on the value of attribute
> primitiveUnits<http://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute>on
> the
> 'filter' <http://www.w3.org/TR/SVG/filters.html#FilterElement> element."  
> is
> misleading and should be modified. For the external image case, if the
> viewport is established by the filter primitive subregion, then the user
> coordinate system is irrelevant.

Well, the same sentence is also in 15.7.3, so I'm guessing that this  
sentence in feImage is trying to remind implementors about this. I  
wouldn't say it's misleading, consider for example the case where an  
external svg image is referenced, or the case where 'feImage' behaves like  
a 'use'. I would still say for the external image case that the user  
coordinate system may depend on the value of 'primitiveUnits' even if the  
coordinate system may not be fully defined by that alone.

> This introduces an odd difference in behaviour for external images vs
> internal references. External images are transformed based on the filter
> primitive subregion, internal references are only clipped by it.

Well, that's the intent of the spec, feImage is like a combination of  
'use' and 'image'. I'm assuming that by "internal references" you mean a  
URI with a fragment identifier (e. g. "my.svg#someelement"), which  
triggers the 'use' behavior. But note that even if you use an external uri  
with a fragment identifier 'feImage' still behaves like a 'use'. If there  
is no fragment identifier then the 'image' behavior is triggered. This  
should be quite clear from the spec, by what URI references are accepted  
by 'use' and 'image' in the normal cases.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Friday, 7 March 2008 09:04:39 UTC