xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomaz Luiz Santos <thomaz.san...@gmail.com>
Subject xlink:href
Date Tue, 29 Jan 2013 16:30:54 GMT
Hello!
I am struggling to display svg file, using the tag xlink: href =
"image.bmp" in other software such as internet explorer is shown the normal
image and the process, an image, and svg file makes some markings on image.

the image can be exchanged for any other test.


SVG:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="
http://www.w3.org/1999/xlink" version="1.1" width="1280" height="1024"
viewBox="0 0 1280 1024">
<image x="0.0" y="0.0" width="1280px" height="1024px"
xlink:href="LINUX000.bmp"/>
<polyline points="5,0 -1,-3 0,0 -1,3" fill="#000080" stroke="#000080"
transform="translate(146.3 380.6) rotate(88.9)"/>
<polyline points="5,0 -1,-3 0,0 -1,3" fill="#000080" stroke="#000080"
transform="translate(467.0 323.2) rotate(-1.1)"/>
<text x="126.3" y="392.9"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000080">X</text>
<text x="466.7" y="315.2"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000080">Y</text>
<path d="M 145.3,329.7 L 788.7,316.8  L 790.7,418.6  L 147.4,431.5 z "
stroke-width="1" stroke="#000080" fill="none"/>
<polygon  points="159.3,355.3 196.3,353.9 197.4,410.9 160.5,412.3 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="196.3" y="333.9" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="196.3" y="345.9"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">1</text>
<polygon  points="237.2,350.4 286.2,348.5 287.4,410.5 238.5,412.3 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="286.2" y="328.5" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="286.2" y="340.5"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">2</text>
<polygon  points="342.2,346.4 392.1,344.5 393.4,405.5 343.4,407.4 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="392.1" y="324.5" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="392.1" y="336.5"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">5</text>
<polygon  points="440.1,344.7 489.1,342.9 490.3,402.9 441.3,404.7 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="489.1" y="322.9" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="489.1" y="334.9"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">9</text>
<polygon  points="505.0,336.3 583.9,333.4 585.5,412.3 506.6,415.3 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="583.9" y="313.4" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="583.9" y="325.4"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">
</text>
<polygon  points="596.1,340.9 655.0,338.7 656.4,405.7 597.4,407.9 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="655.0" y="318.7" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="655.0" y="330.7"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">X</text>
<polygon  points="691.0,338.3 747.0,336.2 748.2,397.2 692.2,399.3 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="747.0" y="316.2" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="747.0" y="328.2"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">8</text>
<text x="500.0" y="836.0"
style="font-family:Arial;font-size:36pt;font-style:normal;font-weight:normal;fill:#0000FF">Aprovado</text>
<polyline points="5,0 -1,-3 0,0 -1,3" fill="#000080" stroke="#000080"
transform="translate(131.6 297.7) rotate(89.0)"/>
<polyline points="5,0 -1,-3 0,0 -1,3" fill="#000080" stroke="#000080"
transform="translate(487.0 237.1) rotate(-1.0)"/>
<text x="111.6" y="310.1"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000080">X</text>
<text x="486.7" y="229.1"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000080">Y</text>
<path d="M 130.7,243.4 L 843.4,230.8  L 845.3,339.5  L 132.6,352.0 z "
stroke-width="1" stroke="#000080" fill="none"/>
<polygon  points="157.7,272.4 208.7,271.5 209.8,332.5 158.8,333.4 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="208.7" y="251.5" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="208.7" y="263.5"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">0</text>
<polygon  points="249.6,266.8 299.6,265.9 300.7,327.9 250.7,328.8 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="299.6" y="245.9" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="299.6" y="257.9"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">3</text>
<polygon  points="353.6,267.9 388.6,267.3 389.6,323.3 354.6,323.9 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="388.6" y="247.3" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="388.6" y="259.3"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">/</text>
<polygon  points="434.5,261.5 489.5,260.6 490.6,320.5 435.6,321.5 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="489.5" y="240.6" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="489.5" y="252.6"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">0</text>
<polygon  points="511.5,257.2 564.5,256.2 565.5,315.2 512.5,316.2 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="564.5" y="236.2" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="564.5" y="248.2"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">7</text>
<polygon  points="599.6,262.6 635.6,262.0 636.5,317.0 600.6,317.6 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="635.6" y="242.0" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="635.6" y="254.0"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">/</text>
<polygon  points="677.5,255.2 713.5,254.6 714.5,312.6 678.5,313.2 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="713.5" y="234.6" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="713.5" y="246.6"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">1</text>
<polygon  points="750.5,254.0 799.4,253.1 800.5,315.1 751.5,316.0 "
stroke-width="1" stroke="#008000" fill="none"/>
<rect x="799.4" y="233.1" width="9.6pt" height="12.0pt" fill="#00FF00" />
<text x="799.4" y="245.1"
style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#000000">4</text>
</svg>


java code:

import java.awt.Dimension;
import java.io.File;
import java.io.IOException;
import javax.swing.JFileChooser;
import org.apache.batik.swing.JSVGCanvas;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author thomaz.santos
 */
public class SVGTest extends javax.swing.JFrame {

    /**
     * Creates new form SVGTest
     */
    public SVGTest() {
        initComponents();
        setLocationRelativeTo(null);


    }

    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">

    private void initComponents() {

        jFileChooser1 = new javax.swing.JFileChooser();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Visualizar arquivo SVG");

        jMenu2.setText("Localizar arquivo");

        jMenuItem1.setText("Abrir arquivo SVG ");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuBar2.add(jMenu2);

        setJMenuBar(jMenuBar2);

        javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 711, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 472, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt)
{
        // TODO add your handling code here:
        Object source = evt.getSource ();
        canvas.setMySize(new Dimension(300, 300));
        this.setContentPane(canvas);
        if (source == jMenuItem1) {
            int returnVal = jFileChooser1.showOpenDialog (this);
            try {
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = jFileChooser1.getSelectedFile();
                    canvas.setURI (file.toURL() .toString() );

                }
            } catch (IOException ioe) {
                System.err.print (ioe.toString());
            }
        }

        this.revalidate();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel
setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with
the default look and feel.
         * For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(SVGTest.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(SVGTest.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(SVGTest.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(SVGTest.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new SVGTest().setVisible(true);
            }
        });
    }

    private JSVGCanvas canvas = new JSVGCanvas();
    // Variables declaration - do not modify
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuItem jMenuItem1;
    // End of variables declaration
}


[image: Inline image 1]




[image: Inline image 2]

-- 
------------------------------
Thomaz Luiz Santos
Linux User: #359356
http://thomaz.santos.googlepages.com/

Mime
View raw message