xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Caron <laurent.ca...@gmail.com>
Subject Initial Rendering
Date Fri, 02 Dec 2005 18:00:18 GMT
Hi,

I've got an image and I want to display it magnified (Zoom 2x) :

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.AffineTransform;
import java.io.File;

import org.apache.batik.swing.JSVGCanvas;
import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
import org.apache.batik.swing.svg.GVTTreeBuilderEvent;
import org.apache.batik.swing.svg.GVTTreeBuilderListener;

public class SVGApplication {

    public static void main(String[] args) {
        Frame f = new Frame("Batik");

        JSVGCanvas svgCanvas = new JSVGCanvas();

        JSVGCanvas canvas = new JSVGCanvas();
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        f.add(canvas);
        f.setSize(800, 600);
        f.setVisible(true);
        canvas.setURI(new File("test.svg").toURI().toString());
        AffineTransform at = AffineTransform.getScaleInstance(2, 2);
        canvas.setRenderingTransform(at,true);


    }
}

But unfortunately, when the image is diplayed, the size is orginal. Is it
possible to apply a renderingTransform before the image is displayed ?

Thanks,

Laurent

Mime
View raw message