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