Browse Source

Pull request #5922: REPORT-58697 【主题切换】frm主题body背景设置默认图片,缩略图变黑

Merge in DESIGN/design from ~STARRYI/design:feature/x to feature/x

* commit '82319138ee7918b26e4583f54842b1374b68bef2':
  REPORT-58697 【主题切换】frm主题body背景设置默认图片,缩略图变黑
research/11.0
starryi 3 years ago
parent
commit
831a0df2f9
  1. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java

8
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java

@ -48,9 +48,6 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
int height = getHeight();
try {
// 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image,
// 使得创建出来的透明像素是(255, 255, 255, 1),而不是(0, 0, 0, 0)
// 这样不支持透明通道缩略图的旧设计器打开新设计器创建的模版时,就不会创建出拥有黑色背景的缩略图
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = image.createGraphics();
// 创建一个支持透明背景的buffer image
@ -58,8 +55,6 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
g2d.dispose();
g2d = image.createGraphics();
g2d.fillRect(0, 0, width, height);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.clipRect(0, 0, width, height);
@ -80,6 +75,9 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
@Override
public void paintComponent(Graphics g) {
g.clearRect(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
// 添加个默认白色,否则因为上面的clearRect导致无背景时会出现黑色
g.setColor(Color.WHITE);
g.fillRect(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
paintBackground((Graphics2D) g);
}

Loading…
Cancel
Save