Browse Source

REPORT-70446 交互视觉修改 svg图片绘制问题

release/11.0
hades 3 years ago
parent
commit
f2bdb74713
  1. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java
  2. 23
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java
  3. 2
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java

@ -2,8 +2,10 @@ package com.fr.design.mainframe.alphafine.component;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.svg.SVGLoader; import com.fr.base.svg.SVGLoader;
import com.fr.base.svg.SystemScaleUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.utils.SvgPaintUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@ -56,7 +58,9 @@ public class ProductNewsImagePanel extends JPanel {
} }
Set<Long> readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); Set<Long> readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet();
if (!readSet.contains(productNews.getId())) { if (!readSet.contains(productNews.getId())) {
g2.drawImage(NEW_TIP_IMAGE, 0, 0, (int) (NEW_TIP_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE), (int) (NEW_TIP_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE), this); SvgPaintUtils.beforePaint(g2);
g2.drawImage(NEW_TIP_IMAGE, 0, 0, this);
SvgPaintUtils.afterPaint(g2);
} }
g2.setColor(BACKGROUND_COLOR); g2.setColor(BACKGROUND_COLOR);

23
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.alphafine.question; package com.fr.design.mainframe.alphafine.question;
import com.fr.base.svg.SVGLoader; import com.fr.base.svg.SVGLoader;
import com.fr.base.svg.SystemScaleUtils;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.utils.SvgPaintUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@ -23,6 +25,10 @@ public class QuestionPane extends JPanel {
private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg");
private static final int WIDTH = 40;
private static final int HEIGHT = 40;
public QuestionPane() { public QuestionPane() {
this.setBackground(new Color(0, 0, 0, 0)); this.setBackground(new Color(0, 0, 0, 0));
@ -34,14 +40,21 @@ public class QuestionPane extends JPanel {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
SvgPaintUtils.beforePaint(g2);
// 宽高保持
int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth();
int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight();
if (AlphaFineUtil.unread()) { if (AlphaFineUtil.unread()) {
g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this);
} else { } else {
g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this);
} }
int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE);
int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); int imageWidth = QUESTION_IMAGE.getWidth(this);
g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); int imageHeight = QUESTION_IMAGE.getHeight(this);
g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this);
SvgPaintUtils.afterPaint(g2);
} }

2
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg

@ -1,4 +1,4 @@
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M32.9794 8.01574C32.1473 8.63412 31.1164 9 30 9C27.2386 9 25 6.76142 25 4C25 3.15756 25.2083 2.36378 25.5763 1.66737C23.2735 0.597339 20.7065 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36C27.9411 36 36 27.9411 36 18C36 14.3065 34.8875 10.8728 32.9794 8.01574ZM18.1874 10C19.6551 10 20.8185 10.3972 21.7062 11.2167C22.5658 12.0066 23 13.095 23 14.46C23 15.483 22.7055 16.3837 22.1198 17.1565C21.8802 17.444 21.2511 18.0441 20.3133 18.8752C19.8557 19.2704 19.533 19.6504 19.3154 20.042C19.0497 20.4917 18.9221 20.9866 18.9221 21.5577V22.0647L18.7384 22.2483H16.975L16.7913 22.0647V21.5577C16.7913 20.8039 16.9292 20.1376 17.2053 19.5623C17.5279 18.8711 18.2717 18.0163 19.4682 16.9531C19.9441 16.4772 20.096 16.3188 20.2041 16.1747C20.6219 15.6525 20.8251 15.119 20.8251 14.5481C20.8251 13.7278 20.5868 13.0854 20.1267 12.6253C19.6672 12.1457 18.9969 11.9104 18.0992 11.9104C17.0461 11.9104 16.29 12.2425 15.7969 12.9202C15.3385 13.5036 15.1087 14.3027 15.1087 15.3417L14.9251 15.5253H13.1837L13 15.3417C13 13.7383 13.4434 12.465 14.3483 11.5149C15.2669 10.5045 16.5511 10 18.1874 10ZM18.9571 23.8527C18.6667 23.5624 18.2962 23.4242 17.8573 23.4242C17.4239 23.4242 17.0725 23.5598 16.7796 23.8527C16.4894 24.1185 16.3511 24.4706 16.3511 24.9084C16.3511 25.3419 16.4867 25.6932 16.7796 25.9861C17.0907 26.2715 17.4454 26.4146 17.8573 26.4146C18.2693 26.4146 18.6239 26.2715 18.9293 25.9916C19.2344 25.7119 19.3856 25.3529 19.3856 24.9084C19.3856 24.4919 19.2388 24.1345 18.9571 23.8527Z" fill="#419BF9"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M32.9794 8.01574C32.1473 8.63412 31.1164 9 30 9C27.2386 9 25 6.76142 25 4C25 3.15756 25.2083 2.36378 25.5763 1.66737C23.2735 0.597339 20.7065 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36C27.9411 36 36 27.9411 36 18C36 14.3065 34.8875 10.8728 32.9794 8.01574Z" fill="#419BF9"/>
<circle cx="30" cy="4" r="4" fill="#EB1D1F"/> <circle cx="30" cy="4" r="4" fill="#EB1D1F"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 489 B

Loading…
Cancel
Save