我有一个SVG,有一个类似渐变的背景和一个前景图标.目前,图标只是一条顶部有多段线的填充路径,但可以将其拆分为多条路径,其中多段线就是笔划.但是,我想让它们显示背景,而不是多段线/笔划有 colored颜色 ,就像它在前景中切割了一个孔一样.由于背景是渐变色(实际上是一个阴影滤镜)而不是纯色,我不能用与背景 colored颜色 相同的笔划来实现这一点.这就是我想象的结果,如果我在多条路径上有一个负的笔划宽度.
作为一个例子,我将使用SVG(我的个人资料图片)
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" stroke="black" fill="rgb(95,95,95)" viewBox="-30 -30 276 260" width="276" height="260" stroke-width="4">
<defs>
<filter id="shadow" x="-30" y="-30" width="276" height="260">
<feGaussianBlur in="SourceAlpha" out="blurOut" stdDeviation="32"/>
<feBlend in="SourceGraphic" in2="blurOut" mode="normal"/>
</filter>
</defs>
<rect x="-30" y="-30" width="276" height="260" fill="#c41313" stroke="none"/>
<path d="M108 0 L216 54 L216 103 L162 130 L162 152 L135 166 L135 187 L108 200 L82 187 L82 166 L54 152 L54 130 L0 103 L0 54 Z" filter="url(#shadow)"/>
<g fill="none">
<polyline points="82 166, 108 179, 135 166"/>
<polyline points="54 130, 108 157, 162 130"/>
<polyline points="0 54, 108 108, 216 54"/>
<polyline points="49 78.5, 108 49, 167 78.5"/>
<line x1="108" y1="0" x2="108" y2="49"/>
<line x1="108" y1="200" x2="108" y2="108"/>
</g>
</svg>