You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Tonny Kohar <to...@kiyut.com> on 2003/10/13 00:30:22 UTC

Re: How to display SVG on screen using Batik

Hi,

I think there is 2 ways to achieve this
1) if you still want the ImageIO, then you need to write ImageIO reader
plugin that wrap batik basically wrap GVT renderer to produce
BufferedImage
2) not using ImageIO, then you need to utilize either JSVGCanvas or wrap
GVT renderer into you own function to produce BufferedImage

Regards
http://www.kiyut.com

On Mon, 2003-10-13 at 04:45, Chris wrote:
> 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.
> 
> Thanks,
> Chris
> -------------------------------------
> import java.io.*;
> import java.awt.*;
> import java.awt.event.*;
> import javax.imageio.*;
> 
> public class Example01 extends Frame 
> {
> public static void main(String args[]) 
> {
> new Example01();
> }
> 
> public Example01() 
> {
> super("Java 2D Example01");
> setSize(400,300); 
> setVisible(true);
> 
> addWindowListener(new WindowAdapter() 
> {public void windowClosing(WindowEvent e) 
> {dispose(); System.exit(0);}}
> );
> }
> 
> public void paint(Graphics g) 
> {
> Graphics2D g2d = (Graphics2D)g;
> try
> {
> Image bi = ImageIO.read(new File("burda_knitthruback.png")); 
> g2d.drawImage(bi, 40, 40, 50, 50, this);
> }
> catch(IOException ioe) 
> {
> System.err.println(ioe.getMessage());
> }
> }
> }
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
> additional commands, e-mail: batik-users-help@xml.apache.org


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