Hi, everyone. I'm experimenting with Batik 1.7 beta1, and found that the ExtendedPathIterator doesn't fetch Quads and Curves properly from the ExtendedGeneralPath.

The following sample program adds several path segments and then iterates over the constructed path. However, when Quads and Curves are supposed to be fetched, the values of earlier segments are returned instead.


import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
import org.apache.batik.ext.awt.geom.ExtendedPathIterator;

public class ExtGenPathTest {
        public static void main(String[] args) {

                ExtendedGeneralPath path = new ExtendedGeneralPath();
                path.moveTo(0,0);
                path.lineTo(1,1);
                path.quadTo(2,2,3,3);
                path.lineTo(4,4);
                path.curveTo(5,5,6,6,7,7);
                path.lineTo(8,8);

                ExtendedPathIterator iterator = path.getExtendedPathIterator();
                float[] points = new float[6];

                while(!iterator.isDone()) {
                        int type = iterator.currentSegment(points);
                        switch(type) {
                        case ExtendedPathIterator.SEG_MOVETO:
                                System.out.println( "MoveTo: 
"+points[0]+","+points[1] );
                                break;
                        case ExtendedPathIterator.SEG_LINETO:
                                System.out.println( "LineTo: 
"+points[0]+","+points[1] );
                                break;
                        case ExtendedPathIterator.SEG_QUADTO:
System.out.println( "QuadTo: "+points[0]+","+points[1]+"; "+points[2]+","+points[3] );
                                break;
                        case ExtendedPathIterator.SEG_CUBICTO:
System.out.println( "CubicTo: "+points[0]+","+points[1]+"; "+points[2]+","+points[3]+"; "+points[4]+","+points[5] );
                                break;
                        default:
                                System.out.println( "Default" );
                                break;
                        }
                        iterator.next();
                }
        }
}


A run of the program yields the following output for batik-1.7beta1, downloaded on 2007-04-28:

MoveTo: 0.0,0.0
LineTo: 1.0,1.0
QuadTo: 0.0,0.0; 1.0,1.0
LineTo: 4.0,4.0
CubicTo: 0.0,0.0; 1.0,1.0; 2.0,2.0
LineTo: 8.0,8.0

For Quads and Curves, earlier segment data is returned. A reference run of the same program with the stable release batik-1.6 yields normal results:

MoveTo: 0.0,0.0
LineTo: 1.0,1.0
QuadTo: 2.0,2.0; 3.0,3.0
LineTo: 4.0,4.0
CubicTo: 5.0,5.0; 6.0,6.0; 7.0,7.0
LineTo: 8.0,8.0

I am aware that Batik 1.7 is still in beta. I just wanted to know if this inconsistency is already known, or simply temporary during restructuring of the code. I couldn't find any comment on this in the forums.

Thanks,
Gerrit

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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

Reply via email to