From edb588e7bf4f728342557645d3426744b7a1b108 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 8 Jan 2024 21:00:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/icon/GraphicsFilter.java | 3 ++- .../java/com/fine/theme/icon/svg/SvgIcon.java | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java b/designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java index 63f86df5db..f35c1b67f8 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java +++ b/designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java @@ -41,8 +41,9 @@ public class GraphicsFilter @Override public void setPaint(Paint paint) { - if (paint instanceof Color) + if (paint instanceof Color) { paint = filterColor((Color) paint); + } super.setPaint(paint); } diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java index df5a52e787..37c399e5d4 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java @@ -42,7 +42,18 @@ import static com.fine.theme.utils.FineUIScale.scale; public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { public enum Type { - disable, white, origin + /** + * 灰化图 + */ + disable, + /** + * 白化图,用于反白场景 + */ + white, + /** + * 原始效果图 + */ + origin } private final Dimension size; @@ -74,14 +85,14 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { @Override public void paintIcon(Component c, Graphics g, int x, int y) { if (type == Type.disable) { - g = GrayGraphics(g); + g = grayGraphics(g); } Object[] oldRenderingHints = FlatUIUtils.setRenderingHints(g); render(c, g, x, y); FlatUIUtils.resetRenderingHints(g, oldRenderingHints); } - public Graphics2D GrayGraphics(Graphics g) { + public Graphics2D grayGraphics(Graphics g) { Object grayFilterObj = UIManager.get("Component.grayFilter"); RGBImageFilter grayFilter = (grayFilterObj instanceof RGBImageFilter) ? (RGBImageFilter) grayFilterObj