From 567d3f67d4edb226ed1b9f658c8b0e2ddaf0a636 Mon Sep 17 00:00:00 2001 From: obo Date: Mon, 27 Mar 2023 15:55:22 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-92440=20mac-=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E5=B8=A6=E5=8F=B9=E5=8F=B7=E7=9A=84=E5=AE=BD=E5=BA=A6=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/icon/WarningIcon.java | 14 +++++++------- .../utils/{SvgPaintWorker.java => SvgPainter.java} | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) rename designer-base/src/main/java/com/fr/design/utils/{SvgPaintWorker.java => SvgPainter.java} (84%) diff --git a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java index 20e6462569..cadf64fd94 100644 --- a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java @@ -2,7 +2,7 @@ package com.fr.design.icon; import com.fr.base.svg.SVGLoader; import com.fr.base.svg.SystemScaleUtils; -import com.fr.design.utils.SvgPaintWorker; +import com.fr.design.utils.SvgPainter; import com.fr.log.FineLoggerFactory; import javax.swing.GrayFilter; @@ -45,20 +45,20 @@ public class WarningIcon extends ImageIcon { //裁剪绘制svg的位置,以免影响到图标右侧的文字 Graphics2D graphics = (Graphics2D) g.create(x, y, WARNING_IMAGE.getWidth(null), WARNING_IMAGE.getHeight(null)); if (mainImage != null) { - new SvgPaintWorker(graphics) { + new SvgPainter(graphics) { @Override - protected void doPrint() { + protected void doPaint() { this.drawImage(mainImage, x, y, null); } - }.execute(); + }.paint(); } if (WARNING_IMAGE != null) { - new SvgPaintWorker(graphics) { + new SvgPainter(graphics) { @Override - protected void doPrint() { + protected void doPaint() { this.drawImage(WARNING_IMAGE, x, y, null); } - }.execute(); + }.paint(); } graphics.dispose(); } diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgPaintWorker.java b/designer-base/src/main/java/com/fr/design/utils/SvgPainter.java similarity index 84% rename from designer-base/src/main/java/com/fr/design/utils/SvgPaintWorker.java rename to designer-base/src/main/java/com/fr/design/utils/SvgPainter.java index 6202f608aa..766dc3fc6b 100644 --- a/designer-base/src/main/java/com/fr/design/utils/SvgPaintWorker.java +++ b/designer-base/src/main/java/com/fr/design/utils/SvgPainter.java @@ -12,14 +12,14 @@ import java.awt.image.ImageObserver; * @since 11.0 * Created on 2023/3/24 */ -abstract public class SvgPaintWorker { +public abstract class SvgPainter { private final Graphics graphics; - public SvgPaintWorker(Graphics g) { + public SvgPainter(Graphics g) { graphics = g; } - protected abstract void doPrint(); + protected abstract void doPaint(); protected void drawImage(Image image, int x, int y, ImageObserver imageObserver) { //如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整 graphics.drawImage(image, SvgPaintUtils.calculatePosition(x), SvgPaintUtils.calculatePosition(y), imageObserver); @@ -32,9 +32,9 @@ abstract public class SvgPaintWorker { * @since 11.0 * Created on 2023/3/24 */ - public void execute() { + public void paint() { SvgPaintUtils.beforePaint((Graphics2D) graphics); - doPrint(); + doPaint(); SvgPaintUtils.afterPaint((Graphics2D) graphics); } }