|
|
|
@ -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,14 +12,13 @@ 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; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -51,12 +50,10 @@ 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@2x.png"; |
|
|
|
|
private static final String SPLASH_PATH = "/com/fr/design/images/splash.png"; |
|
|
|
|
|
|
|
|
|
private static int uiScale(int i) { |
|
|
|
|
return (int) (i * JBUI_INIT_SCALE); |
|
|
|
@ -66,10 +63,6 @@ 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 |
|
|
|
@ -88,20 +81,10 @@ public class SplashPane extends JPanel {
|
|
|
|
|
@Override |
|
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
|
super.paintComponent(g); |
|
|
|
|
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(); |
|
|
|
|
} |
|
|
|
|
Icon icon = IconLoader.getIcon(OEM_PATH); |
|
|
|
|
icon.paintIcon(null, g, 0, 0); |
|
|
|
|
paintShowText((Graphics2D) g); |
|
|
|
|
g.dispose(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,11 +106,8 @@ public class SplashPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Dimension getSplashDimension() { |
|
|
|
|
// 默认使用两倍图,缩放绘制,保证高分屏的清晰度
|
|
|
|
|
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); |
|
|
|
|
Icon icon = IconLoader.getIcon(OEM_PATH); |
|
|
|
|
return new Dimension(icon.getIconWidth(), icon.getIconHeight()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isDialogFont(Font font) { |
|
|
|
|