Browse Source

Pull request #6612: REPORT-62433 11.0设计器-单元格样式-有部分样式显示的字体内容不全

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

* commit '9d43ffdb5e70d057d70cd9a5b3fb9ffb896f9f3d':
  REPORT-62433 11.0设计器-单元格样式-有部分样式显示的字体内容不全
feature/x
starryi 3 years ago
parent
commit
77aef9143b
  1. 26
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

26
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -51,14 +51,7 @@ public class CellStylePreviewPane extends JPanel {
}
private void paintTransparentBackground(Graphics2D g2d, Style style) {
Color fontColor = style.getFRFont().getForeground();
float g = fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F * fontColor.getBlue() * 0.114F;
float alpha = 1.0F;
if (g < 50) {
alpha = 0.2F;
} else if (g < 160){
alpha = 0.5F;
}
float alpha = computeTransparentBackgroundAlpha(style);
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth;
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight;
@ -76,6 +69,23 @@ public class CellStylePreviewPane extends JPanel {
g2d.setComposite(oldComposite);
}
private float computeTextColorBrightness(Style style) {
Color fontColor = style.getFRFont().getForeground();
return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F;
}
private float computeTransparentBackgroundAlpha(Style style) {
float textBrightness = computeTextColorBrightness(style);
float alpha = 1.0F;
if (textBrightness < 50) {
alpha = 0.2F;
} else if (textBrightness < 160){
alpha = 0.5F;
}
return alpha;
}
private void paintCellStyle(Graphics2D g2d, Style style) {
int resolution = ScreenResolution.getScreenResolution();

Loading…
Cancel
Save