Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
非SourceGraphic svg元素作为过滤器的源?_Svg - Fatal编程技术网

非SourceGraphic svg元素作为过滤器的源?

非SourceGraphic svg元素作为过滤器的源?,svg,Svg,我们能否创建一个过滤器,使其创建一个临时svg元素并将其作为源图形? 像这样: <svg version="1.1" width="700" height="700" > <defs> <filter id="f1" x="0" y="0" width="100%" height="100%"> <rect id="rect1" width="30" height="30" fill="#aaaaaa"/&

我们能否创建一个过滤器,使其创建一个临时svg元素并将其作为源图形?
像这样:

<svg version="1.1" width="700" height="700" >
    <defs>
        <filter id="f1" x="0" y="0" width="100%" height="100%">
            <rect id="rect1" width="30" height="30" fill="#aaaaaa"/>
            <feComposite in="url(#rect1)" in2="SourceGraphic" operator="over" />
        </filter>
    </defs>
    <circle cx="50" cy="50" r="50" fill="#ffffff" filter="url(#f1)" />
</svg>

它不起作用。

您可以这样使用:

<svg version="1.1" width="700" height="700" >
    <defs>
        <filter id="f1" x="0" y="0" width="100%" height="100%">
            <feImage xlink:href="#rect1"/>
            <feComposite in2="SourceGraphic" operator="over" />
        </filter>
        <rect id="rect1" width="30" height="30" fill="blue"/>
    </defs>

    <circle cx="50" cy="50" r="50" fill="green" filter="url(#f1)" />
</svg>


然而,有些浏览器并不完全支持,例如Firefox和IE,但它在Chrome和Opera中运行良好。

非常感谢兄弟!正是我想要的!