You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2001/03/16 19:31:50 UTC

cvs commit: xml-batik/sources/org/apache/batik/gvt CompositeShapePainter.java StrokeShapePainter.java

tkormann    01/03/16 10:31:50

  Modified:    sources/org/apache/batik/bridge SVGSVGElementBridge.java
                        ViewBox.java
               sources/org/apache/batik/gvt CompositeShapePainter.java
                        StrokeShapePainter.java
  Log:
  - bug fix in CompositeShapePainter (fix the first NullPointerException
  for the first document).
  
  - bug fix for the window size. The document's size was computed using
  the svg root element's dimension. The bug appears when external
  <image> element where used (anothe root svg element was found and the
  document's size was updated). Now, the size of the document is the
  outermost svg of the original document.
  
  Revision  Changes    Path
  1.11      +5 -2      xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
  
  Index: SVGSVGElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SVGSVGElementBridge.java	2001/03/12 09:58:05	1.10
  +++ SVGSVGElementBridge.java	2001/03/16 18:31:46	1.11
  @@ -31,7 +31,7 @@
    * Bridge class for the &lt;svg> element.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: SVGSVGElementBridge.java,v 1.10 2001/03/12 09:58:05 tkormann Exp $
  + * @version $Id: SVGSVGElementBridge.java,v 1.11 2001/03/16 18:31:46 tkormann Exp $
    */
   public class SVGSVGElementBridge implements GraphicsNodeBridge,
                                               SVGConstants,
  @@ -129,7 +129,10 @@
                   }
               }
           } else {
  -            ctx.setDocumentSize(new Dimension((int)w, (int)h));
  +            // <!> FIXME: hack to compute the original document's size
  +            if (ctx.getDocumentSize() == null) {
  +                ctx.setDocumentSize(new Dimension((int)w, (int)h));
  +            }
               clip = new Rectangle2D.Float(x, y, w, h);
           }
   
  
  
  
  1.2       +2 -3      xml-batik/sources/org/apache/batik/bridge/ViewBox.java
  
  Index: ViewBox.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/ViewBox.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ViewBox.java	2001/03/08 12:39:32	1.1
  +++ ViewBox.java	2001/03/16 18:31:47	1.2
  @@ -24,7 +24,7 @@
    * This class provides convenient methods to handle viewport.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: ViewBox.java,v 1.1 2001/03/08 12:39:32 tkormann Exp $
  + * @version $Id: ViewBox.java,v 1.2 2001/03/16 18:31:47 tkormann Exp $
    */
   public abstract class ViewBox implements SVGConstants, ErrorConstants {
   
  @@ -78,7 +78,6 @@
   
           String aspectRatio
               = e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
  -
           return getPreserveAspectRatioTransform(e, viewBox, aspectRatio, w, h);
       }
   
  @@ -180,7 +179,7 @@
           implements PreserveAspectRatioHandler {
   
           public short align;
  -        public boolean meet;
  +        public boolean meet = true;
   
           /**
            * Invoked when the PreserveAspectRatio parsing starts.
  
  
  
  1.6       +9 -4      xml-batik/sources/org/apache/batik/gvt/CompositeShapePainter.java
  
  Index: CompositeShapePainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/CompositeShapePainter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompositeShapePainter.java	2001/03/15 16:28:30	1.5
  +++ CompositeShapePainter.java	2001/03/16 18:31:48	1.6
  @@ -20,7 +20,7 @@
    * A shape painter which consists of multiple shape painters.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: CompositeShapePainter.java,v 1.5 2001/03/15 16:28:30 tkormann Exp $
  + * @version $Id: CompositeShapePainter.java,v 1.6 2001/03/16 18:31:48 tkormann Exp $
    */
   public class CompositeShapePainter implements ShapePainter {
       /**
  @@ -85,13 +85,18 @@
        */
       public Shape getPaintedArea(GraphicsNodeRenderContext rc){
           // <!> FIX ME: Use of GeneralPath is a work around Area problems.
  -        GeneralPath paintedArea = new GeneralPath();
           if (painters != null) {
  +            GeneralPath paintedArea = new GeneralPath();
               for (int i=0; i < count; ++i) {
  -                paintedArea.append(painters[i].getPaintedArea(rc), false);
  +                Shape s = painters[i].getPaintedArea(rc);
  +                if (s != null) {
  +                    paintedArea.append(s, false);
  +                }
               }
  +            return paintedArea;
  +        } else {
  +            return null;
           }
  -        return paintedArea;
       }
   
       /**
  
  
  
  1.5       +3 -3      xml-batik/sources/org/apache/batik/gvt/StrokeShapePainter.java
  
  Index: StrokeShapePainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/StrokeShapePainter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StrokeShapePainter.java	2001/02/06 01:56:39	1.4
  +++ StrokeShapePainter.java	2001/03/16 18:31:49	1.5
  @@ -17,7 +17,7 @@
    * A shape painter that can be used to draw the outline of a shape.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: StrokeShapePainter.java,v 1.4 2001/02/06 01:56:39 vhardy Exp $
  + * @version $Id: StrokeShapePainter.java,v 1.5 2001/03/16 18:31:49 tkormann Exp $
    */
   public class StrokeShapePainter implements ShapePainter {
       /** Shape painted by this painter */
  @@ -36,7 +36,7 @@
       /**
        * Constructs a new <tt>ShapePainter</tt> that can be used to draw
        * the outline of a <tt>Shape</tt>.
  -     * 
  +     *
        * @param shape shape to be painted by this painter. Should not be null.
        */
       public StrokeShapePainter(Shape shape) {
  @@ -91,7 +91,7 @@
           if(paint != null && stroke != null){
               return stroke.createStrokedShape(shape);
           } else {
  -            return shape;
  +            return null;
           }
       }
   
  
  
  

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