keiron      01/09/25 06:22:55

  Modified:    src/org/apache/fop/render/awt AWTRenderer.java
  Log:
  fixed viewbox for svg
  inline images are now correctly placed
  
  Revision  Changes    Path
  1.37      +21 -5     xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- AWTRenderer.java  2001/09/24 07:31:52     1.36
  +++ AWTRenderer.java  2001/09/25 13:22:55     1.37
  @@ -1,5 +1,5 @@
   /*
  - * $Id: AWTRenderer.java,v 1.36 2001/09/24 07:31:52 keiron Exp $
  + * $Id: AWTRenderer.java,v 1.37 2001/09/25 13:22:55 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -487,11 +487,11 @@
   
       public void renderImageArea(ImageArea area) {
   
  -        int x = currentAreaContainerXPosition + area.getXOffset();
  -
  +        int x = currentXPosition + area.getXOffset();
           int y = currentYPosition;
           int w = area.getContentWidth();
           int h = area.getHeight();
  +        this.currentYPosition -= h;
   
           FopImage img = area.getImage();
   
  @@ -557,7 +557,7 @@
               }
           }
   
  -        currentYPosition -= h;
  +        this.currentXPosition += area.getContentWidth();
       }
   
       public void renderWordArea(WordArea area) {
  @@ -699,18 +699,34 @@
           GVTBuilder builder = new GVTBuilder();
           BridgeContext ctx = new BridgeContext(userAgent);
           GraphicsNode root;
  +        root = builder.build(ctx, doc);
  +        float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
  +        float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
   
           // correct integer roundoff     aml/rlc
           // graphics.translate(x / 1000f, pageHeight - y / 1000f);
           graphics.translate((x + 500) / 1000, pageHeight - (y + 500) / 1000);
   
  +        SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
  +        AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w / 
1000f, h / 1000f);
  +        AffineTransform inverse = null;
           try {
  -            root = builder.build(ctx, doc);
  +            inverse = at.createInverse();
  +        } catch(NoninvertibleTransformException e) {
  +        }
  +        if(!at.isIdentity()) {
  +            graphics.transform(at);
  +        }
  +
  +        try {
               root.paint(graphics);
           } catch (Exception e) {
               e.printStackTrace();
           }
   
  +        if(inverse != null && !inverse.isIdentity()) {
  +            graphics.transform(inverse);
  +        }
           // correct integer roundoff     aml/rlc
           // graphics.translate(-x / 1000f, y / 1000f - pageHeight);
           graphics.translate(-(x + 500) / 1000, (y + 500) / 1000 - pageHeight);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to