xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <unkn...@devnull.org>
Subject How to display SVG on screen using Batik
Date Sun, 12 Oct 2003 21:45:26 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
<font size="-1">         I have the following working code which reads in 
a PNG graphic and displays it on screen. It uses ImageIO and is fairly simple. 
I have the same symbols in SVG format. I have downloaded Batik from Apache, 
but I can't for the life of me find code to simply load the image and display 
it on screen. Can someone direct me to working code that does this.<br>
<br>
Thanks,<br>
Chris<br>
-------------------------------------<br>
import java.io.*;<br>
import java.awt.*;<br>
import java.awt.event.*;<br>
import javax.imageio.*;<br>
<br>
public class Example01 extends Frame <br>
{<br>
    public static void main(String args[]) <br>
    {<br>
        new Example01();<br>
    }<br>
<br>
    public Example01() <br>
    {<br>
        super("Java 2D Example01");<br>
        setSize(400,300); <br>
        setVisible(true);<br>
<br>
        addWindowListener(new WindowAdapter() <br>
            {public void windowClosing(WindowEvent e) <br>
                {dispose(); System.exit(0);}}<br>
        );<br>
    }<br>
<br>
    public void paint(Graphics g) <br>
    {<br>
        Graphics2D g2d = (Graphics2D)g;<br>
        try<br>
        {<br>
            Image bi = ImageIO.read(new File("burda_knitthruback.png"));
 <br>
            g2d.drawImage(bi, 40, 40, 50, 50, this);<br>
        }<br>
        catch(IOException ioe) <br>
        {<br>
            System.err.println(ioe.getMessage());<br>
        }<br>
    }<br>
}</font>
</body>
</html>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message