|
|
|
@ -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) { |
|
|
|
|