xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Cavalliotis <anthony.cavallio...@googlemail.com>
Subject Re: Initial Rendering
Date Sat, 03 Dec 2005 01:19:38 GMT
Is there a reason you are using awt over swing?

Anyhow, reason it doesn't work is that you've not added a panel.  Try:

        Panel panel = new Panel();
        f.add(panel); // f & canvas are your components below
        panel.add(canvas);

in swing you'd go a JPanel and f.getContentPane().add() instead.

Cheers,

Anthony


On 02/12/05, Laurent Caron <laurent.caron@gmail.com> wrote:
> 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
>

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


Mime
View raw message