Re: Request for explaining/interpreting clipping for <use> element

W dniu 21 listopada 2011 12:35 użytkownik Jeremie Patonnier
<jeremie.patonnier@gmail.com> napisał:
> Hello,
> I faced the same problem several times and I
> will appreciate some enlightenment to :)
> However, to circumvent those differences in implementation, I get used to
> this sort of thing :
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> <svg width="800" height="600" xmlns="http://www.w3.org/2000/svg"
> xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
>        <defs>
>                <image id="image" height="200" width="200"
> xlink:href="image.png" />
>                <clipPath id="clip">
>                        <rect x="100" y="100" width="100" height="100" />
>                </clipPath>
>        </defs>
>        <g clip-path="url(#clip)">
>               <use x="100" y="100" xlink:href="#image" />
>        </g>
> </svg>
> By adding a g element, you will get a coherent rendering across all browsers
> (which would be a rendering identical to your original test with Opera 10.6
> and Chrome 15).
> Regards,

You're right with your solution. g it parent of use, so it's "working"
in svg (root element) viewport (and so is clip-path). Interpretation
is clear.


I've found the following part in the specs:
> The following elements establish new viewports:
> (...)
> A ‘symbol’ element define new viewports whenever they are instanced by a ‘use’ element.

Can it be the case? We don't have <symbol>, but it seems to be similar/related.


AFAIU the <use> element establishes a new viewport. The question is
which viewport should be used by clip-path applied to <use> element.
The old one (established by <svg>) or the new one (established by
<use>)?

-- 
Rafał

Received on Monday, 21 November 2011 12:17:03 UTC