Browse Source

Merge pull request #208 in DESIGN/design from ~PLOUGH/10-design:release/10.0 to release/10.0

* commit '9c62a9d3bc04ef8f41724a80af4c48686f0fc3f9':
  REPORT-8947 调整水印代码
  REPORT-8947 调整水印代码
  REPORT-8947 10.0水印导出的pdf,水印字体变小且字体模糊锯齿严重=>字体大小校正
master
plough 7 years ago
parent
commit
b568cd274d
  1. 3
      designer-base/src/main/java/com/fr/design/report/WatermarkPreviewPane.java
  2. 34
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  3. 24
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  4. 10
      designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

3
designer-base/src/main/java/com/fr/design/report/WatermarkPreviewPane.java

@ -32,6 +32,7 @@ public class WatermarkPreviewPane extends JPanel {
super.paint(g); super.paint(g);
Graphics2D g2d = (Graphics2D)g; Graphics2D g2d = (Graphics2D)g;
g2d.drawImage(UIConstants.WATERMARK_BACKGROUND, 0, 0, this.getWidth(), this.getHeight(), null); g2d.drawImage(UIConstants.WATERMARK_BACKGROUND, 0, 0, this.getWidth(), this.getHeight(), null);
new WatermarkPainter(watermark).paint(g2d, this.getWidth(), this.getHeight()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark);
painter.paint(g2d, this.getWidth(), this.getHeight());
} }
} }

34
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -1,18 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
@ -30,12 +17,23 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.WatermarkPainter; import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
/** /**
* FormDesigner的UI类是一个有状态的UI类它根据FormDesigner的当前状态画出 * FormDesigner的UI类是一个有状态的UI类它根据FormDesigner的当前状态画出
* 具有所见即所得的设计界面以及当前设计界面的一些辅助状态比如选择标识拖动区域 以及当前正在添加的组件 * 具有所见即所得的设计界面以及当前设计界面的一些辅助状态比如选择标识拖动区域 以及当前正在添加的组件
@ -46,7 +44,6 @@ public class FormDesignerUI extends ComponentUI {
private FormDesigner designer; private FormDesigner designer;
private SelectionModel selectionModel; private SelectionModel selectionModel;
private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0); private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0);
private WatermarkPainter watermarkPainter;
private float time; private float time;
public FormDesignerUI() { public FormDesignerUI() {
@ -119,11 +116,8 @@ public class FormDesignerUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g) { private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget());
// 不要每次都 new 一个 WatermarkPainter WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution());
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) { painter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
} }
private int[] getActualLine(int i) { private int[] getActualLine(int i) {

24
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -48,9 +48,20 @@ import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.*; import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D; import java.awt.geom.Line2D;
@ -98,7 +109,6 @@ public class GridUI extends ComponentUI {
protected int resolution; protected int resolution;
private boolean isAuthority = false; private boolean isAuthority = false;
private WatermarkPainter watermarkPainter;
public GridUI(int resolution) { public GridUI(int resolution) {
super(); super();
@ -1104,12 +1114,8 @@ public class GridUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book) { private void paintWatermark(Graphics2D g2d, FineBook book) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
// 不要每次都 new 一个 WatermarkPainter painter.paint(g2d, gridSize.width, gridSize.height);
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, gridSize.width, gridSize.height);
} }

10
designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

@ -10,7 +10,6 @@ import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.FineBook; import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
@ -56,7 +55,6 @@ public class PolyDesignUI extends ComponentUI {
private PolyDesigner designer; private PolyDesigner designer;
private int resolution; private int resolution;
private float time; private float time;
private WatermarkPainter watermarkPainter;
public PolyDesignUI(int resolution) { public PolyDesignUI(int resolution) {
if (resolution == 0){ if (resolution == 0){
@ -112,12 +110,8 @@ public class PolyDesignUI extends ComponentUI {
// 绘制水印 // 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) { private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
// 不要每次都 new 一个 WatermarkPainter painter.paint(g2d, width, height);
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, width, height);
} }
private void paintAddedData(Graphics g) { private void paintAddedData(Graphics g) {

Loading…
Cancel
Save