Browse Source

REPORT-135888 fix:高分屏启动页缩放适配

fbp/merge
Levy.Xie-解安森 2 months ago
parent
commit
b2a0bfedda
  1. 40
      designer-realize/src/main/java/com/fr/start/common/SplashPane.java
  2. 7
      designer-realize/src/main/java/com/fr/start/common/SplashWindow.java
  3. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash.png
  4. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x.png
  5. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x_en.png
  6. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x_zh.png
  7. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x_zh_TW.png
  8. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_en.png
  9. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_zh.png
  10. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_zh_TW.png

40
designer-realize/src/main/java/com/fr/start/common/SplashPane.java

@ -1,9 +1,9 @@
package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader;
import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.GraphHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.general.IOUtils;
import com.fr.general.locale.image.I18nImage;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.GraphicsConfig;
@ -12,13 +12,14 @@ import com.fr.stable.os.OperatingSystem;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.util.Locale;
/**
@ -50,10 +51,12 @@ public class SplashPane extends JPanel {
private String thanksLog = StringUtils.EMPTY;
private String moduleText = StringUtils.EMPTY;
protected BufferedImage splashImg;
/**
* 正常图片路径
* 默认使用两倍图
*/
private static final String SPLASH_PATH = "/com/fr/design/images/splash.png";
private static final String SPLASH_PATH = "/com/fr/design/images/splash@2x.png";
private static int uiScale(int i) {
return (int) (i * JBUI_INIT_SCALE);
@ -63,6 +66,10 @@ public class SplashPane extends JPanel {
return I18nImage.getImagePath(SPLASH_PATH, DesignerEnvManager.getEnvManager().getLanguage());
}
public SplashPane() {
this.splashImg = IOUtils.readImage(OEM_PATH);
}
private NotNullLazyValue<Font> fontValue = new NotNullLazyValue<Font>() {
@NotNull
@Override
@ -81,10 +88,20 @@ public class SplashPane extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Icon icon = IconLoader.getIcon(OEM_PATH);
icon.paintIcon(null, g, 0, 0);
paintShowText((Graphics2D) g);
g.dispose();
Graphics2D g2d = (Graphics2D) g.create();
try {
Dimension dimension = getSplashDimension();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawImage(splashImg, 0, 0, (int) dimension.getWidth(), (int) dimension.getHeight(), this);
paintShowText(g2d);
} finally {
g2d.dispose();
}
}
@ -106,8 +123,11 @@ public class SplashPane extends JPanel {
}
Dimension getSplashDimension() {
Icon icon = IconLoader.getIcon(OEM_PATH);
return new Dimension(icon.getIconWidth(), icon.getIconHeight());
// 默认使用两倍图,缩放绘制,保证高分屏的清晰度
float imageScale = JBUI_INIT_SCALE / 2.0f;
int targetWidth = Math.round(splashImg.getWidth() * imageScale);
int targetHeight = Math.round(splashImg.getHeight() * imageScale);
return new Dimension(targetWidth, targetHeight);
}
private boolean isDialogFont(Font font) {

7
designer-realize/src/main/java/com/fr/start/common/SplashWindow.java

@ -32,12 +32,7 @@ public class SplashWindow extends JFrame {
initTitleIcon();
//slash pane
// 如果是Windows + JDK版本大于等于9时,一倍图启动会很模糊,这边使用两倍图
if (OperatingSystem.isWindows() && JdkVersion.GE_9.support()) {
this.splash = new SplashPane4WinAndJDK11();
} else {
this.splash = new SplashPane();
}
this.splash = new SplashPane();
splash.setBackground(null);
this.setContentPane(splash);

BIN
designer-realize/src/main/resources/com/fr/design/images/splash.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 KiB

After

Width:  |  Height:  |  Size: 252 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 KiB

After

Width:  |  Height:  |  Size: 869 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 KiB

After

Width:  |  Height:  |  Size: 869 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x_zh.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 KiB

After

Width:  |  Height:  |  Size: 868 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x_zh_TW.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 KiB

After

Width:  |  Height:  |  Size: 868 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 KiB

After

Width:  |  Height:  |  Size: 252 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_zh.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_zh_TW.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Loading…
Cancel
Save