Browse Source

REPORT-99485 暂时修改带有filter的svg文件以正常显示图标(失去阴影)

newui
vito 10 months ago
parent
commit
00113dc9ae
  1. 17
      designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java
  2. 13
      designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg

17
designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java

@ -8,6 +8,7 @@ import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.GrayFilter;
import com.fr.clone.cloning.Immutable;
import com.fr.log.FineLoggerFactory;
import com.fr.value.NullableLazyValue;
import com.github.weisj.jsvg.SVGDocument;
import com.github.weisj.jsvg.attributes.ViewBox;
@ -112,12 +113,16 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon {
}
private void render(Component c, Graphics g, int x, int y) {
if (type == Type.white) {
Objects.requireNonNull(whiteSvgDocument.getValue())
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height));
} else {
Objects.requireNonNull(svgDocument.getValue())
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height));
try {
if (type == Type.white) {
Objects.requireNonNull(whiteSvgDocument.getValue())
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height));
} else {
Objects.requireNonNull(svgDocument.getValue())
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height));
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error("SvgIcon from url: " + resource + "can not paint.", e);
}
}

13
designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg

@ -1,19 +1,8 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#229;&#183;&#178;&#233;&#128;&#137;,&#229;&#141;&#149;&#233;&#128;&#137;=false">
<rect id="Rectangle 157" x="4" y="4" width="24" height="24" rx="1" fill="#2576EF" stroke="#2576EF" stroke-width="2"/>
<g id="Path 2" filter="url(#filter0_d_102_12520)">
<g id="Path 2">
<path d="M9.95096 17.4776C9.50465 17.0313 8.78104 17.0313 8.33473 17.4776C7.88842 17.9239 7.88842 18.6475 8.33473 19.0938L12.9061 23.6652C13.4161 24.1752 14.2651 24.0911 14.6651 23.491L23.8079 9.7769C24.1581 9.25173 24.0161 8.54218 23.491 8.19206C22.9658 7.84195 22.2562 7.98386 21.9061 8.50903L13.5366 21.0632L9.95096 17.4776Z" fill="white"/>
</g>
</g>
<defs>
<filter id="filter0_d_102_12520" x="7" y="8" width="18" height="18" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="0.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0901961 0 0 0 0 0.341176 0 0 0 0 0.776471 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_102_12520"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_102_12520" result="shape"/>
</filter>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 717 B

Loading…
Cancel
Save