xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caron, Michael R" <michael.r.ca...@lmco.com>
Subject Affine Transforms in gvtBuildCompleted callback
Date Tue, 01 Feb 2005 22:41:23 GMT

Thanks for all the help so far in using Batik.

I have a question regarding the use of Affine Transforms in the
gvtBuildCompleted callback. I defined the method to be as follows:

  public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
    System.out.println("GVT Tree Build Complete");
    GraphicsNode g = e.getGVTRoot();
    AffineTransform tx = g.getTransform();
    if (tx != null) {
      Point heightOrig = new Point(docHeight,0);
      Point widthOrig = new Point(0,docWidth);
      Point2D heightNew = tx.transform(heightOrig,null);
      Point2D widthNew = tx.transform(widthOrig,null);
      System.out.println("Translated Height: " + heightNew.getY());
      System.out.println("Translated Width: " + widthNew.getX());	

I would assume that since the JSVGCanvas onto which I am loading the
document is constrained by the Jpanel it is contained by, neither of
which have PreferredWidth and Height as large as the SVG document
itself, that there would be an implicit transform. But it turns out that
tx is null. 

Why would the tx be null? And how would I get the translated heights and
widths of the SVG rendered onto the JSVGComponent (not the height and
width of the canvas itself, but the actual image as translated onto the


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

View raw message