Browse Source

REPORT-55709 frm中body背景设置了背景,不透明度设置0%没有透明效果

【问题原因】
绘制背景时没有考虑透明度
【改动思路】
绘制组件主体背景和标题背景时设置透明度
final/10.0
Starryi 3 years ago
parent
commit
2f0a6e485c
  1. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 10
      designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java

4
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -226,7 +226,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public void paintBackground(Graphics2D g2d) {
Background background4Painting = getBackground4Painting();
if (background4Painting != null) {
BorderPacker style = toData().getBorderStyle();
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, style.getAlpha()));
background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight()));
g2d.setComposite(oldComposite);
}
}

10
designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java

@ -19,6 +19,7 @@ import com.fr.form.ui.Label;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background;
import com.fr.general.act.BorderPacker;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -91,8 +92,13 @@ public class XLabel extends XWidgetCreator {
Label label = (Label) data;
Dimension size = this.getSize();
//先画背景,再画标题
if (toData().getBackground() != null) {
toData().getBackground().paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
Background background = label.getBackground();
if (background != null) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, label.getBackgroundOpacity()));
background.paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
g2d.setComposite(oldComposite);
}
if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create();

Loading…
Cancel
Save