我正在寻找一种用纯色和图像填充SVG圆的方法。
我现在尝试的是使用以下代码:
<svg>
<defs>
<pattern id="visits" height="23" width="14">
<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="icons/visit.png" height="23" width="14" x="0" y="0"></image>
</pattern>
</defs>
<circle cx="30" cy="39" r="9" fill="url(#visits)"></circle>
</svg>
Run Code Online (Sandbox Code Playgroud)
哪个会用我的背景图像绘制一个圆圈,但是我也想给圆圈添加背景颜色-如何实现此目的?
我正在寻找这样的最终结果:http : //www.tiikoni.com/tis/view/?id= 4ff44d1-可以更改红色背景,而白色十字是图像。
只需在图案上添加红色背景即可。
<svg>
<defs>
<pattern id="visits" height="23" width="14">
<rect height="23" width="14" fill="red"/>
<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="icons/visit.png" height="23" width="14" x="0" y="0"></image>
</pattern>
</defs>
<circle cx="30" cy="39" r="9" fill="url(#visits)"></circle>
</svg>
Run Code Online (Sandbox Code Playgroud)