从svg过滤器中剪切sourceGraphic形状,然后覆盖sourceGraphic

我正在尝试为svg路径制作一个“外部辉光”过滤器,因此重塑形状具有“辉光”。

问题是,路径是半透明的,我不希望通过路径可见辉光。我该如何获取sourceGraphic的轮廓,从过滤器中“剪切”它,然后将sourceGraphic重新覆盖在顶部。

这是我的路

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="w3.org/2000/svg" version="1.1">
  <g
     transform="translate(-6.011591,-2.5668894)"
     id="layer1">
    <path
       id="path1023"
       d="M 13.279347,9.9492382 24.624743,191.02179 191.62901,204.63627 349.1031,36.27056 Z"
       style="fill:#96b200;fill-opacity:0.26666667;stroke:#ffff00;stroke-width:13.58376789;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:40.75130608,40.75130608;stroke-dashoffset:0;stroke-opacity:0.67336683" />
  </g>
</svg>

这是到目前为止我想到的过滤器:

<filter id="filter" x="-20%" y="-20%" width="140%" height="140%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceonUse" color-interpolation-filters="linearRGB">
    <feComposite in="SourceAlpha" in2="SourceAlpha" operator="arithmetic" k1="0" k2="8" k3="-0.5" k4="-0.5" x="0%" y="0%" width="100%" height="100%" result="composite"/>
    <feColorMatrix type="matrix" values="1 0 0 0 1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0" x="0%" y="0%" width="100%" height="100%" in="composite" result="colormatrix1"/>
    <feMorphology operator="dilate" radius="10 10" x="0%" y="0%" width="100%" height="100%" in="colormatrix1" result="morphology1"/>
    <feGaussianBlur stdDeviation="10 10" x="0%" y="0%" width="100%" height="100%" in="morphology1" edgeMode="none" result="blur2"/>
    <feMerge x="0%" y="0%" width="100%" height="100%" result="merge">
            <feMergeNode in="blur2"/>
        <feMergeNode in="SourceGraphic"/>
    </feMerge>
</filter>

显然,这会使源路径看起来很糟糕且不彩色,我需要的是一种将feComposite用作“模板”的方法,以在feMerge之前切出feGaussianBlur,我只是不知道如何(或者是否可能)

landing1984 回答:从svg过滤器中剪切sourceGraphic形状,然后覆盖sourceGraphic

弄清楚了。我需要做一个feComposite,如下:

MEMBER  seen_1   seen_2   seen_3   seen_4   seen_5  event
  A       1        1        0         1       0       2   
  B       1        1        1         0       1       3 
  C       1        1        1         1       0       4
  D       0        0        0         1       0       1

这将采用原始合成中创建的实体形状,并将其“切”或“排除”到“发光”中,然后我可以使用feMerge将sourceGraphic放置在完成的滤镜上。

为完整起见,这是我完成的过滤器:

<feComposite in="merge" in2="composite" operator="out" x="0%" y="0%" width="100%" height="100%" result="composite2"/>
本文链接:https://www.f2er.com/3110487.html

大家都在问