use of com.kitfox.svg.SVGException in project megameklab by MegaMek.
the class PrintProtomech method printImage.
public void printImage(Graphics2D g2d, PageFormat pageFormat) {
if ((null == g2d) || (null == protoMech)) {
return;
}
currentMargin = 0;
// g2d.drawImage(ImageHelper.getRecordSheet(protoMech, false), 18, 18,
// 558, 738, null);
int stop = Math.min(5, protoMechList.size() - currentPosition);
for (int pos = 1; pos <= stop; pos++) {
protoMech = protoMechList.get((pos + currentPosition) - 1);
try {
ImageHelper.loadSVGImage(new File("data/images/recordsheets/ProtomechTemplate" + pos + ".svg")).render(g2d);
} catch (SVGException e) {
e.printStackTrace();
}
g2d.setColor(Color.BLACK);
printProtomechData(g2d);
printWeaponsNEquipment(g2d);
drawArmor(g2d);
currentMargin += pageMarginBase;
}
System.gc();
Font font = UnitUtil.deriveFont(true, 6.5f);
g2d.setFont(font);
g2d.drawString(Integer.toString(Calendar.getInstance().get(Calendar.YEAR)), 119f, 759.5f);
g2d.drawImage(ImageHelper.getFluffImage(protoMech, ImageHelper.imageProto), 410, 23, 35, 45, null);
g2d.scale(pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
}
use of com.kitfox.svg.SVGException in project megameklab by MegaMek.
the class PrintBattleArmor method printImage.
public void printImage(Graphics2D g2d, PageFormat pageFormat) {
if ((null == g2d) || (null == battleArmor)) {
return;
}
isAdvanced = false;
currentMargin = 0;
try {
ImageHelper.loadSVGImage(new File("data/images/recordsheets/BA/BATemplate.svg")).render(g2d);
} catch (SVGException e) {
e.printStackTrace();
}
g2d.drawImage(ImageHelper.getFluffImage(battleArmor, ImageHelper.imageBattleArmor), 420, 20, 25, 45, null);
int stop = Math.min(5, battleArmorList.size() - currentPosition);
for (int pos = 0; pos < stop; pos++) {
battleArmor = battleArmorList.get(pos + currentPosition);
int squadNumber = pos + 1;
try {
ImageHelper.loadSVGImage(new File("data/images/recordsheets/BA/Squad" + squadNumber + "_" + battleArmor.getTroopers() + ".svg")).render(g2d);
} catch (SVGException e) {
e.printStackTrace();
}
printBattleArmorData(g2d, squadNumber);
if (battleArmor.getArmor(1) > 0) {
try {
ImageHelper.loadSVGImage(new File("data/images/recordsheets/BA/Squad" + squadNumber + "_" + battleArmor.getTroopers() + "_" + battleArmor.getArmor(1) + ".svg")).render(g2d);
} catch (SVGException e) {
e.printStackTrace();
}
}
printWeaponsNEquipment(g2d);
currentMargin += pageMarginBase;
}
System.gc();
Font font = UnitUtil.deriveFont(true, 6);
g2d.setFont(font);
g2d.drawString(Integer.toString(Calendar.getInstance().get(Calendar.YEAR)), 41f, 769.5f);
g2d.scale(pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
}
use of com.kitfox.svg.SVGException in project pivot by apache.
the class TestPanel method initComponents.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
panelDisplay = new javax.swing.JPanel();
button1 = new javax.swing.JButton();
button2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
panelDisplay.setLayout(new java.awt.BorderLayout());
getContentPane().add(panelDisplay, java.awt.BorderLayout.CENTER);
button1.setText("Visible");
button1.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
SVGElement root = Pivot964Swing.this.panel.root;
try {
root.setAttribute("viewBox", AnimationElement.AT_XML, "0 0 2368 1652");
root.updateTime(0f);
repaint();
} catch (SVGElementException e) {
e.printStackTrace();
} catch (SVGException e) {
e.printStackTrace();
}
}
});
button2.setText("Invisible");
button2.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
SVGElement root = Pivot964Swing.this.panel.root;
try {
root.setAttribute("viewBox", AnimationElement.AT_XML, "800 0 2368 1652");
root.updateTime(0f);
repaint();
} catch (SVGElementException e) {
e.printStackTrace();
} catch (SVGException e) {
e.printStackTrace();
}
}
});
panelDisplay.add(button1, java.awt.BorderLayout.EAST);
panelDisplay.add(button2, java.awt.BorderLayout.WEST);
pack();
}
Aggregations