You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/10/25 21:01:49 UTC

svn commit: r1402274 [7/31] - in /incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext: ./ awt/ awt/color/ awt/font/ awt/g2d/ awt/geom/ awt/image/ awt/image/codec/ awt/image/codec/jpeg/ awt/image/codec/pn...

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Polyline2D.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Polyline2D.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Polyline2D.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Polyline2D.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,427 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.Serializable;
+
+/**
+ * This class has the same behavior than {@link Polygon2D}, except that
+ * the figure is not closed.
+ *
+ * @version $Id: Polyline2D.java 594018 2007-11-12 04:17:41Z cam $
+ */
+public class Polyline2D implements Shape, Cloneable, Serializable {
+
+    private static final float ASSUME_ZERO = 0.001f;
+
+    /**
+     * The total number of points.  The value of <code>npoints</code>
+     * represents the number of points in this <code>Polyline2D</code>.
+     *
+     */
+    public int npoints;
+
+    /**
+     * The array of <i>x</i> coordinates. The value of {@link #npoints npoints} is equal to the
+     * number of points in this <code>Polyline2D</code>.
+     *
+     */
+    public float[] xpoints;
+
+    /**
+     * The array of <i>x</i> coordinates. The value of {@link #npoints npoints} is equal to the
+     * number of points in this <code>Polyline2D</code>.
+     *
+     */
+    public float[] ypoints;
+
+    /**
+     * Bounds of the Polyline2D.
+     * @see #getBounds()
+     */
+    protected Rectangle2D bounds;
+
+    private GeneralPath path;
+    private GeneralPath closedPath;
+
+    /**
+     * Creates an empty Polyline2D.
+     */
+    public Polyline2D() {
+        xpoints = new float[4];
+        ypoints = new float[4];
+    }
+
+    /**
+     * Constructs and initializes a <code>Polyline2D</code> from the specified
+     * parameters.
+     * @param xpoints an array of <i>x</i> coordinates
+     * @param ypoints an array of <i>y</i> coordinates
+     * @param npoints the total number of points in the
+     *                                <code>Polyline2D</code>
+     * @exception  NegativeArraySizeException if the value of
+     *                       <code>npoints</code> is negative.
+     * @exception  IndexOutOfBoundsException if <code>npoints</code> is
+     *             greater than the length of <code>xpoints</code>
+     *             or the length of <code>ypoints</code>.
+     * @exception  NullPointerException if <code>xpoints</code> or
+     *             <code>ypoints</code> is <code>null</code>.
+     */
+    public Polyline2D(float[] xpoints, float[] ypoints, int npoints) {
+        if (npoints > xpoints.length || npoints > ypoints.length) {
+            throw new IndexOutOfBoundsException("npoints > xpoints.length || npoints > ypoints.length");
+        }
+        this.npoints = npoints;
+        this.xpoints = new float[npoints+1];   // make space for one more to close the polyline
+        this.ypoints = new float[npoints+1];   // make space for one more to close the polyline
+        System.arraycopy(xpoints, 0, this.xpoints, 0, npoints);
+        System.arraycopy(ypoints, 0, this.ypoints, 0, npoints);
+        calculatePath();
+    }
+
+    /**
+     * Constructs and initializes a <code>Polyline2D</code> from the specified
+     * parameters.
+     * @param xpoints an array of <i>x</i> coordinates
+     * @param ypoints an array of <i>y</i> coordinates
+     * @param npoints the total number of points in the <code>Polyline2D</code>
+     * @exception  NegativeArraySizeException if the value of
+     *                       <code>npoints</code> is negative.
+     * @exception  IndexOutOfBoundsException if <code>npoints</code> is
+     *             greater than the length of <code>xpoints</code>
+     *             or the length of <code>ypoints</code>.
+     * @exception  NullPointerException if <code>xpoints</code> or
+     *             <code>ypoints</code> is <code>null</code>.
+     */
+    public Polyline2D(int[] xpoints, int[] ypoints, int npoints) {
+        if (npoints > xpoints.length || npoints > ypoints.length) {
+            throw new IndexOutOfBoundsException("npoints > xpoints.length || npoints > ypoints.length");
+        }
+        this.npoints = npoints;
+        this.xpoints = new float[npoints];
+        this.ypoints = new float[npoints];
+        for (int i = 0; i < npoints; i++) {
+            this.xpoints[i] = xpoints[i];
+            this.ypoints[i] = ypoints[i];
+        }
+        calculatePath();
+    }
+
+    public Polyline2D(Line2D line) {
+        npoints = 2;
+        xpoints = new float[2];
+        ypoints = new float[2];
+        xpoints[0] = (float)line.getX1();
+        xpoints[1] = (float)line.getX2();
+        ypoints[0] = (float)line.getY1();
+        ypoints[1] = (float)line.getY2();
+        calculatePath();
+    }
+
+    /**
+     * Resets this <code>Polyline2D</code> object to an empty polygon.
+     * The coordinate arrays and the data in them are left untouched
+     * but the number of points is reset to zero to mark the old
+     * vertex data as invalid and to start accumulating new vertex
+     * data at the beginning.
+     * All internally-cached data relating to the old vertices
+     * are discarded.
+     * Note that since the coordinate arrays from before the reset
+     * are reused, creating a new empty <code>Polyline2D</code> might
+     * be more memory efficient than resetting the current one if
+     * the number of vertices in the new polyline data is significantly
+     * smaller than the number of vertices in the data from before the
+     * reset.
+     */
+    public void reset() {
+        npoints = 0;
+        bounds = null;
+        path = new GeneralPath();
+        closedPath = null;
+    }
+
+    public Object clone() {
+        Polyline2D pol = new Polyline2D();
+        for (int i = 0; i < npoints; i++) {
+            pol.addPoint(xpoints[i], ypoints[i]);
+        }
+        return pol;
+    }
+
+    private void calculatePath() {
+        path = new GeneralPath();
+        path.moveTo(xpoints[0], ypoints[0]);
+        for (int i = 1; i < npoints; i++) {
+            path.lineTo(xpoints[i], ypoints[i]);
+        }
+        bounds = path.getBounds2D();
+        closedPath = null;
+    }
+
+    private void updatePath(float x, float y) {
+        closedPath = null;
+        if (path == null) {
+            path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
+            path.moveTo(x, y);
+            bounds = new Rectangle2D.Float(x, y, 0, 0);
+        } else {
+            path.lineTo(x, y);
+            float _xmax = (float)bounds.getMaxX();
+            float _ymax = (float)bounds.getMaxY();
+            float _xmin = (float)bounds.getMinX();
+            float _ymin = (float)bounds.getMinY();
+            if (x < _xmin) _xmin = x;
+            else if (x > _xmax) _xmax = x;
+            if (y < _ymin) _ymin = y;
+            else if (y > _ymax) _ymax = y;
+            bounds = new Rectangle2D.Float(_xmin, _ymin, _xmax - _xmin, _ymax - _ymin);
+        }
+    }
+
+    public void addPoint(Point2D p) {
+        addPoint((float)p.getX(), (float)p.getY());
+    }
+
+    /**
+     * Appends the specified coordinates to this <code>Polyline2D</code>.
+     * <p>
+     * If an operation that calculates the bounding box of this
+     * <code>Polyline2D</code> has already been performed, such as
+     * <code>getBounds</code> or <code>contains</code>, then this
+     * method updates the bounding box.
+     * @param       x the specified x coordinate
+     * @param       y the specified y coordinate
+     * @see         java.awt.Polygon#getBounds
+     * @see         java.awt.Polygon#contains(double,double)
+     */
+    public void addPoint(float x, float y) {
+        if (npoints == xpoints.length) {
+            float[] tmp;
+
+            tmp = new float[npoints * 2];
+            System.arraycopy(xpoints, 0, tmp, 0, npoints);
+            xpoints = tmp;
+
+            tmp = new float[npoints * 2];
+            System.arraycopy(ypoints, 0, tmp, 0, npoints);
+            ypoints = tmp;
+        }
+        xpoints[npoints] = x;
+        ypoints[npoints] = y;
+        npoints++;
+        updatePath(x, y);
+    }
+
+    /**
+     * Gets the bounding box of this <code>Polyline2D</code>.
+     * The bounding box is the smallest {@link Rectangle} whose
+     * sides are parallel to the x and y axes of the
+     * coordinate space, and can completely contain the <code>Polyline2D</code>.
+     * @return a <code>Rectangle</code> that defines the bounds of this
+     * <code>Polyline2D</code>.
+     */
+    public Rectangle getBounds() {
+        if (bounds == null) return null;
+        else return bounds.getBounds();
+    }
+
+    private void updateComputingPath() {
+        if (npoints >= 1) {
+            if (closedPath == null) {
+                closedPath = (GeneralPath)path.clone();
+                closedPath.closePath();
+            }
+        }
+    }
+
+    /**
+     * Determines whether the specified {@link Point} is inside this
+     * <code>Polyline2D</code>.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(Point p) {
+        return false;
+    }
+
+    /**
+     * Determines if the specified coordinates are inside this
+     * <code>Polyline2D</code>.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(double x, double y) {
+        return false;
+    }
+
+    /**
+     * Determines whether the specified coordinates are inside this
+     * <code>Polyline2D</code>.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(int x, int y) {
+        return false;
+    }
+
+    /**
+     * Returns the high precision bounding box of the {@link Shape}.
+     * @return a {@link Rectangle2D} that precisely
+     *                bounds the <code>Shape</code>.
+     */
+    public Rectangle2D getBounds2D() {
+        return bounds;
+    }
+
+    /**
+     * Tests if a specified {@link Point2D} is inside the boundary of this
+     * <code>Polyline2D</code>.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(Point2D p) {
+        return false;
+    }
+
+    /**
+     * Tests if the interior of this <code>Polygon</code> intersects the
+     * interior of a specified set of rectangular coordinates.
+     * @param x the x coordinate of the specified rectangular
+     *                        shape's top-left corner
+     * @param y the y coordinate of the specified rectangular
+     *                        shape's top-left corner
+     * @param w the width of the specified rectangular shape
+     * @param h the height of the specified rectangular shape
+     * @return <code>true</code> if the interior of this
+     *                        <code>Polygon</code> and the interior of the
+     *                        specified set of rectangular
+     *                         coordinates intersect each other;
+     *                        <code>false</code> otherwise.
+     */
+    public boolean intersects(double x, double y, double w, double h) {
+        if (npoints <= 0 || !bounds.intersects(x, y, w, h)) {
+            return false;
+        }
+        updateComputingPath();
+        return closedPath.intersects(x, y, w, h);
+    }
+
+    /**
+     * Tests if the interior of this <code>Polygon</code> intersects the
+     * interior of a specified <code>Rectangle2D</code>.
+     * @param r a specified <code>Rectangle2D</code>
+     * @return <code>true</code> if this <code>Polygon</code> and the
+     *                         interior of the specified <code>Rectangle2D</code>
+     *                         intersect each other; <code>false</code>
+     *                         otherwise.
+     */
+    public boolean intersects(Rectangle2D r) {
+        return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
+    }
+
+    /**
+     * Tests if the interior of this <code>Polyline2D</code> entirely
+     * contains the specified set of rectangular coordinates.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(double x, double y, double w, double h) {
+        return false;
+    }
+
+    /**
+     * Tests if the interior of this <code>Polyline2D</code> entirely
+     * contains the specified <code>Rectangle2D</code>.
+     * This method is required to implement the Shape interface,
+     * but in the case of Line2D objects it always returns false since a line contains no area.
+     */
+    public boolean contains(Rectangle2D r) {
+        return false;
+    }
+
+    /**
+     * Returns an iterator object that iterates along the boundary of this
+     * <code>Polygon</code> and provides access to the geometry
+     * of the outline of this <code>Polygon</code>.  An optional
+     * {@link AffineTransform} can be specified so that the coordinates
+     * returned in the iteration are transformed accordingly.
+     * @param at an optional <code>AffineTransform</code> to be applied to the
+     *                 coordinates as they are returned in the iteration, or
+     *                <code>null</code> if untransformed coordinates are desired
+     * @return a {@link PathIterator} object that provides access to the
+     *                geometry of this <code>Polygon</code>.
+     */
+    public PathIterator getPathIterator(AffineTransform at) {
+        if (path == null) return null;
+        else return path.getPathIterator(at);
+    }
+
+    /* get the associated {@link Polygon2D}.
+     * This method take care that may be the last point can
+     * be equal to the first. In that case it must not be included in the Polygon,
+     * as polygons declare their first point only once.
+     */
+    public Polygon2D getPolygon2D() {
+        Polygon2D pol = new Polygon2D();
+        for (int i = 0; i < npoints - 1; i++) {
+           pol.addPoint(xpoints[i], ypoints[i]);
+        }
+        Point2D.Double p0 =
+            new Point2D.Double(xpoints[0], ypoints[0]);
+        Point2D.Double p1 =
+            new Point2D.Double(xpoints[npoints-1], ypoints[npoints-1]);
+
+        if (p0.distance(p1) > ASSUME_ZERO)
+            pol.addPoint(xpoints[npoints-1], ypoints[npoints-1]);
+
+        return pol;
+    }
+
+    /**
+     * Returns an iterator object that iterates along the boundary of
+     * the <code>Shape</code> and provides access to the geometry of the
+     * outline of the <code>Shape</code>.  Only SEG_MOVETO and SEG_LINETO, point types
+     * are returned by the iterator.
+     * Since polylines are already flat, the <code>flatness</code> parameter
+     * is ignored.
+     * @param at an optional <code>AffineTransform</code> to be applied to the
+     *                 coordinates as they are returned in the iteration, or
+     *                <code>null</code> if untransformed coordinates are desired
+     * @param flatness the maximum amount that the control points
+     *                 for a given curve can vary from colinear before a subdivided
+     *                curve is replaced by a straight line connecting the
+     *                 endpoints.  Since polygons are already flat the
+     *                 <code>flatness</code> parameter is ignored.
+     * @return a <code>PathIterator</code> object that provides access to the
+     *                 <code>Shape</code> object's geometry.
+     */
+    public PathIterator getPathIterator(AffineTransform at, double flatness) {
+        return path.getPathIterator(at);
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Polyline2D.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Quadradic.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Quadradic.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Quadradic.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Quadradic.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,373 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.geom.Point2D;
+import java.awt.geom.QuadCurve2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * A class representing a quadratic path segment.
+ *
+ * @version $Id: Quadradic.java 478249 2006-11-22 17:29:37Z dvholten $
+ */
+public class Quadradic extends AbstractSegment {
+    public Point2D.Double p1, p2, p3;
+
+    public Quadradic() {
+        p1 = new Point2D.Double();
+        p2 = new Point2D.Double();
+        p3 = new Point2D.Double();
+    }
+
+    public Quadradic(double x1, double y1,
+                     double x2, double y2,
+                     double x3, double y3) {
+        p1 = new Point2D.Double(x1, y1);
+        p2 = new Point2D.Double(x2, y2);
+        p3 = new Point2D.Double(x3, y3);
+    }
+
+    public Quadradic(Point2D.Double p1,
+                     Point2D.Double p2,
+                     Point2D.Double p3) {
+        this.p1 = p1;
+        this.p2 = p2;
+        this.p3 = p3;
+    }
+
+    public Object clone() {
+        return new Quadradic(new Point2D.Double(p1.x, p1.y),
+                             new Point2D.Double(p2.x, p2.y),
+                             new Point2D.Double(p3.x, p3.y));
+    }
+
+    public Segment reverse() {
+        return new Quadradic(new Point2D.Double(p3.x, p3.y),
+                             new Point2D.Double(p2.x, p2.y),
+                             new Point2D.Double(p1.x, p1.y));
+    }
+
+    private void getMinMax(double p1, double p2,
+                           double p3, double [] minMax) {
+        if (p3 > p1){
+            minMax[0] = p1; minMax[1] = p3;
+        } else {
+            minMax[0] = p3; minMax[1] = p1;
+        }
+
+        double a = (p1-2*p2+p3);
+        double b = (p2-p1);
+
+        if (a == 0) return;
+
+        double tv = b/a;
+        if ((tv <= 0) || (tv >= 1)) return;
+
+        tv = ((p1-2*p2+p3)*tv+2*(p2-p1))*tv + p1;
+        if      (tv < minMax[0]) minMax[0] = tv;
+        else if (tv > minMax[1]) minMax[1] = tv;
+    }
+
+    public double minX() {
+        double [] minMax = {0, 0};
+        getMinMax(p1.x, p2.x, p3.x, minMax);
+        return minMax[0];
+    }
+    public double maxX() {
+        double [] minMax = {0, 0};
+        getMinMax(p1.x, p2.x, p3.x, minMax);
+        return minMax[1];
+    }
+    public double minY() {
+        double [] minMax = {0, 0};
+        getMinMax(p1.y, p2.y, p3.y, minMax);
+        return minMax[0];
+    }
+    public double maxY() {
+        double [] minMax = {0, 0};
+        getMinMax(p1.y, p2.y, p3.y, minMax);
+        return minMax[1];
+    }
+    public Rectangle2D getBounds2D() {
+        double [] minMaxX = {0, 0};
+        getMinMax(p1.x, p2.x, p3.x, minMaxX);
+        double [] minMaxY = {0, 0};
+        getMinMax(p1.y, p2.y, p3.y, minMaxY);
+
+        return new Rectangle2D.Double
+            (minMaxX[0], minMaxY[0],
+             minMaxX[1]-minMaxX[0], minMaxY[1]-minMaxY[0]);
+    }
+
+    protected int findRoots(double y, double [] roots) {
+        double [] eqn = { p1.y-y, 2*(p2.y-p1.y), p1.y-2*p2.y+p3.y };
+        return QuadCurve2D.solveQuadratic(eqn, roots);
+        // return solveQuad(eqn[2], eqn[1], eqn[0], roots);
+    }
+
+    public Point2D.Double evalDt(double t) {
+        double x = 2*(p1.x-2*p2.x+p3.x)*t + 2*(p2.x-p1.x);
+        double y = 2*(p1.y-2*p2.y+p3.y)*t + 2*(p2.y-p1.y);
+        return new Point2D.Double(x, y);
+    }
+    public Point2D.Double eval(double t)   {
+        double x = ((p1.x-2*p2.x+p3.x)*t+2*(p2.x-p1.x))*t + p1.x;
+        double y = ((p1.y-2*p2.y+p3.y)*t+2*(p2.y-p1.y))*t + p1.y;
+        return new Point2D.Double(x, y);
+    }
+
+    public Segment getSegment(double t0, double t1) {
+        double dt = t1-t0;
+        Point2D.Double np1 = eval(t0);
+        Point2D.Double dp1 = evalDt(t0);
+
+        Point2D.Double np2 = new Point2D.Double
+            (np1.x+.5*dt*dp1.x, np1.y+.5*dt*dp1.y);
+
+        Point2D.Double np3 = eval(t1);
+        return new Quadradic(np1, np2, np3);
+    }
+
+    /**
+     * Subdivides this Quadradic curve into two curves at t = 0.5.
+     * can be done with getSegment but this is more efficent.
+     * @param q0 if non-null contains portion of curve from  0->.5
+     * @param q1 if non-null contains portion of curve from .5->1
+     */
+    public void subdivide(Quadradic q0, Quadradic q1) {
+        if ((q0 == null) && (q1 == null)) return;
+
+        double x  = (p1.x-2*p2.x+p3.x)*.25+(p2.x-p1.x) + p1.x;
+        double y  = (p1.y-2*p2.y+p3.y)*.25+(p2.y-p1.y) + p1.y;
+
+        double dx = (p1.x-2*p2.x+p3.x)*.25 + (p2.x-p1.x)*.5;
+        double dy = (p1.y-2*p2.y+p3.y)*.25 + (p2.y-p1.y)*.5;
+
+        if (q0 != null) {
+            q0.p1.x = p1.x;
+            q0.p1.y = p1.y;
+            q0.p2.x = x-dx;
+            q0.p2.y = y-dy;
+            q0.p3.x = x;
+            q0.p3.y = y;
+        }
+
+        if (q1 != null) {
+            q1.p1.x = x;
+            q1.p1.y = y;
+            q1.p2.x = x+dx;
+            q1.p2.y = y+dy;
+            q1.p3.x = p3.x;
+            q1.p3.y = p3.y;
+        }
+    }
+
+    /**
+     * Subdivides this Quadradic curve into two curves at given t.
+     * @param q0 if non-null contains portion of curve from 0->t.
+     * @param q1 if non-null contains portion of curve from t->1.
+     */
+    public void subdivide(double t, Quadradic q0, Quadradic q1) {
+        Point2D.Double np  = eval(t);
+        Point2D.Double npd = evalDt(t);
+
+        if (q0 != null) {
+            q0.p1.x = p1.x;
+            q0.p1.y = p1.y;
+            q0.p2.x = np.x-(npd.x*t*.5);
+            q0.p2.y = np.y-(npd.y*t*.5);
+            q0.p3.x = np.x;
+            q0.p3.y = np.y;
+        }
+
+        if (q1 != null) {
+            q1.p1.x = np.x;
+            q1.p1.y = np.y;
+            q1.p2.x = np.x+(npd.x*(1-t)*.5);
+            q1.p2.y = np.y+(npd.y*(1-t)*.5);
+            q1.p3.x = p3.x;
+            q1.p3.y = p3.y;
+        }
+    }
+
+    /**
+     * Subdivides this Quadradic curve into two curves at t = 0.5.
+     * can be done with getSegment but this is more efficent.
+     * @param s0 if non-null contains portion of curve from  0->.5
+     * @param s1 if non-null contains portion of curve from .5->1
+     */
+    public void subdivide(Segment s0, Segment s1) {
+        Quadradic q0=null, q1=null;
+        if (s0 instanceof Quadradic) q0 = (Quadradic)s0;
+        if (s1 instanceof Quadradic) q1 = (Quadradic)s1;
+        subdivide(q0, q1);
+    }
+
+    /**
+     * Subdivides this Quadradic curve into two curves at t.
+     * can be done with getSegment but this is more efficent.
+     * @param s0 if non-null contains portion of curve from  0->.5
+     * @param s1 if non-null contains portion of curve from .5->1
+     */
+    public void subdivide(double t, Segment s0, Segment s1) {
+        Quadradic q0=null, q1=null;
+        if (s0 instanceof Quadradic) q0 = (Quadradic)s0;
+        if (s1 instanceof Quadradic) q1 = (Quadradic)s1;
+        subdivide(t, q0, q1);
+    }
+
+    static int count = 0;
+    protected double subLength(double leftLegLen, double rightLegLen,
+                               double maxErr) {
+        count++;
+        double dx, dy;
+        dx = p3.x-p1.x;
+        dy = p3.y-p1.y;
+        double cordLen = Math.sqrt(dx*dx+dy*dy);
+
+        double hullLen = leftLegLen+rightLegLen;
+        if (hullLen < maxErr) return (hullLen+cordLen)*.5;
+
+        double err = (hullLen-cordLen);
+        if (err < maxErr)
+            return (hullLen+cordLen)*.5;
+
+        Quadradic q  = new Quadradic();
+        double x  = (p1.x+2*p2.x+p3.x)*.25;
+        double y  = (p1.y+2*p2.y+p3.y)*.25;
+
+        dx = .25*dx;
+        dy = .25*dy;
+
+        q.p1.x = p1.x;
+        q.p1.y = p1.y;
+        q.p2.x = x-dx;
+        q.p2.y = y-dy;
+        q.p3.x = x;
+        q.p3.y = y;
+
+        double midLen = .25*cordLen;
+        double len = q.subLength(leftLegLen*.5, midLen, maxErr*.5);
+
+        q.p1.x = x;
+        q.p1.y = y;
+        q.p2.x = x+dx;
+        q.p2.y = y+dy;
+        q.p3.x = p3.x;
+        q.p3.y = p3.y;
+
+        len += q.subLength(midLen, rightLegLen*.5, maxErr*.5);
+        return len;
+    }
+
+    public double getLength() {
+        return getLength(0.000001);
+    }
+
+    public double getLength(double maxErr) {
+        double dx, dy;
+        dx = p2.x-p1.x;
+        dy = p2.y-p1.y;
+        double leftLegLen = Math.sqrt(dx*dx+dy*dy);
+        dx = p3.x-p2.x;
+        dy = p3.y-p2.y;
+        double rightLegLen = Math.sqrt(dx*dx+dy*dy);
+
+        double eps = maxErr*(leftLegLen+rightLegLen);
+
+        return subLength(leftLegLen, rightLegLen, eps);
+    }
+
+    public String toString() {
+        return "M" + p1.x + ',' + p1.y +
+               'Q' + p2.x + ',' + p2.y + ' ' +
+                p3.x + ',' + p3.y;
+    }
+
+    /*
+    public static  boolean epsEq(double a, double b) {
+        final double eps = 0.00001;
+        return (((a + eps) > b) && ((a-eps) < b));
+    }
+
+    public static void sub(Quadradic orig, Quadradic curr,
+                           double t, double inc, int lev) {
+        Quadradic left=new Quadradic();
+        Quadradic right=new Quadradic();
+        curr.subdivide(left, right);
+        Point2D.Double ptl = left.eval(.5);
+        Point2D.Double ptr = right.eval(.5);
+        Point2D.Double pt1  = orig.eval(t-inc);
+        Point2D.Double pt2  = orig.eval(t+inc);
+        int steps = 100;
+        Point2D.Double l, r, o;
+        for (int i=0; i<=steps; i++) {
+            l = left.eval(i/(double)steps);
+            o = orig.eval(t-(2*inc)*(1-i/(double)steps));
+            if (!epsEq(l.x, o.x) || !epsEq(l.y, o.y))
+                System.err.println("Lf Pt: ["  + l.x + "," + l.y +
+                                   "] Orig: [" + o.x + "," + o.y +"]");
+            r = right.eval(i/(double)steps);
+            o = orig.eval(t+(2*inc*i/(double)steps));
+            if (!epsEq(r.x, o.x) || !epsEq(r.y, o.y))
+                System.err.println("Rt Pt: ["  + r.x + "," + r.y +
+                                   "] Orig: [" + o.x + "," + o.y +"]");
+        }
+        if (lev != 0) {
+            sub(orig, left,  t-inc, inc/2, lev-1);
+            sub(orig, right, t+inc, inc/2, lev-1);
+        }
+    }
+
+    public static void evalQuad(Quadradic q) {
+
+        int steps = 1000000;
+        Point2D.Double oldP = q.eval(0);
+        Point2D.Double  newP;
+        double len = 0;
+        for (int i=1; i<=steps; i++) {
+            newP = q.eval(i/(double)steps);
+            double dx = newP.x-oldP.x;
+            double dy = newP.y-oldP.y;
+            len += Math.sqrt(dx*dx + dy*dy);
+            oldP = newP;
+        }
+        System.err.println("Length(.1): " + q.getLength(.001) +
+                           " x " + count); count = 0;
+        System.err.println("Length    : " + q.getLength() +
+                           " x " + count); count = 0;
+        System.err.println("D  Len    : " + len);
+    }
+
+    public static void main(String args[]) {
+        Quadradic q;
+
+        q = new Quadradic(0,0,  10,10,  30,0);
+        sub(q, q, .5, .25, 3);
+        evalQuad(q);
+
+        q = new Quadradic(0,0,  1,2,  3,0);
+        sub(q, q, .5, .25, 3);
+        evalQuad(q);
+
+
+    }
+*/
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Quadradic.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/RectListManager.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/RectListManager.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/RectListManager.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/RectListManager.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,1016 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.Rectangle;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ * RectListManager is a class to manage a list of rectangular regions.
+ * This class contains methods to add new rectangles to the List, to
+ * merge rectangles in the list (based on a cost function), and
+ * functions to subract one RectListManager from another.  The main
+ * purpose of this class is to manage dirty regions on a display (for
+ * this reason it uses Rectangle not Rectangle2D).
+ *
+ * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
+ * @version $Id: RectListManager.java 501844 2007-01-31 13:54:05Z dvholten $
+ */
+public class RectListManager implements Collection {
+    Rectangle [] rects = null;
+    int size = 0;
+
+    Rectangle bounds = null;
+
+    public void dump() {
+        System.err.println("RLM: " + this + " Sz: " + size);
+        System.err.println("Bounds: " + getBounds());
+        for (int i=0; i<size; i++) {
+            Rectangle r = rects[i];
+            System.err.println("  [" + r.x + ", " + r.y + ", " +
+                               r.width + ", " + r.height + ']' );
+        }
+    }
+
+    /**
+     * The comparator used to sort the elements of this List.
+     * Sorts on x value of Rectangle.
+     */
+    public static Comparator comparator = new RectXComparator();
+
+    /**
+     * Construct a <tt>RectListManager</tt> from a Collection of Rectangles
+     * @param rects Collection that must only contain rectangles.
+     */
+    public RectListManager(Collection rects) {
+        this.rects = new Rectangle[rects.size()];
+        Iterator i = rects.iterator();
+        int j=0;
+        while (i.hasNext())          // todo can be replaced by rects.toArray()
+            this.rects[j++] = (Rectangle)i.next();
+        this.size  = this.rects.length;
+
+
+        Arrays.sort(this.rects, comparator);
+    }
+
+    /**
+     * Construct a <tt>RectListManager</tt> from an Array of
+     * <tt>Rectangles</tt>
+     * @param rects Array of <tt>Rectangles</tt>, must not contain
+     *              any null entries.
+     */
+    public RectListManager(Rectangle [] rects) {
+        this(rects, 0, rects.length);
+    }
+
+    /**
+     * Construct a <tt>RectListManager</tt> from an Array of
+     * <tt>Rectangles</tt>
+     * @param rects Array of <tt>Rectangles</tt>, must not contain
+     *              any null entries in the range [off, off+sz-1].
+     * @param off   The offset to start copying from in rects.
+     * @param sz    The number of entries to copy from rects.
+     */
+    public RectListManager(Rectangle [] rects, int off, int sz) {
+        this.size  = sz;
+        this.rects = new Rectangle[sz];
+        System.arraycopy(rects, off, this.rects, 0, sz);
+        Arrays.sort(this.rects, comparator);
+    }
+
+    /**
+     * Construct a <tt>RectListManager</tt> from another
+     * <tt>RectListManager</tt> (data is copied).
+     * @param rlm RectListManager to copy.
+     */
+    public RectListManager(RectListManager rlm) {
+        this(rlm.rects);
+    }
+
+    /**
+     * Construct a <tt>RectListManager</tt> with one rectangle
+     * @param rect The rectangle to put in this rlm.
+     */
+    public RectListManager(Rectangle rect) {
+        this();
+        add(rect);
+    }
+
+
+    /**
+     * Construct an initially empty <tt>RectListManager</tt>.
+     */
+    public RectListManager() {
+        this.rects = new Rectangle[10];
+        size = 0;
+    }
+
+    /**
+     * Construct an initially empty <tt>RectListManager</tt>,
+     * with initial <tt>capacity</tt>.
+     * @param capacity The inital capacity for the list.  Setting
+     *                 this appropriately can save reallocations.
+     */
+    public RectListManager(int capacity) {
+        this.rects = new Rectangle[capacity];
+    }
+
+    public Rectangle getBounds() {
+        if (bounds != null )
+            return bounds;
+        if (size == 0) return null;
+        bounds = new Rectangle(rects[0]);
+        for (int i=1; i< size; i++) {
+            Rectangle r = rects[i];
+            if (r.x < bounds.x) {
+                bounds.width = bounds.x+bounds.width-r.x;
+                bounds.x = r.x;
+            }
+            if (r.y < bounds.y) {
+                bounds.height = bounds.y+bounds.height-r.y;
+                bounds.y = r.y;
+            }
+            if (r.x+r.width > bounds.x+bounds.width)
+                bounds.width = r.x+r.width-bounds.x;
+            if (r.y+r.height > bounds.y+bounds.height)
+                bounds.height = r.y+r.height-bounds.y;
+        }
+        return bounds;
+    }
+
+    /**
+     * Standard <tt>Object</tt> clone method.
+     */
+    public Object clone() throws CloneNotSupportedException {
+        return copy();
+    }
+
+    /**
+     * Similar to clone only strongly typed
+     */
+    public RectListManager copy() {
+        return new RectListManager(rects);
+    }
+
+    /**
+     * Returns the number of elements currently stored in this collection.
+     */
+    public int size() { return size; }
+
+
+    /**
+     * Returns true if this collection contains no elements.
+     */
+    public boolean isEmpty() { return (size==0); }
+
+    public void clear() {
+        Arrays.fill( rects, null );
+        size=0;
+        bounds = null;
+    }
+
+    /**
+     * Returns an iterator over the elements in this collection
+     */
+    public Iterator iterator() {
+        return new RLMIterator();
+    }
+
+    /**
+     * Returns a list iterator of the elements in this list
+     * (in proper sequence).
+     */
+    public ListIterator listIterator() {
+        return new RLMIterator();
+    }
+
+    public Object [] toArray() {
+        Object [] ret = new Rectangle[size];
+        System.arraycopy(rects, 0, ret, 0, size);
+        return ret;
+    }
+
+    /**
+     * fill the given array a with values from my internal <code>rects</code>.
+     * when a is not large enough, a new array is allocated, filled and returned.
+     * the method works only, when a is a Object[] or a Rectange[].
+     * When this is not the case, the a[] is just cleared.
+     *
+     * @param a array to fill (must not be null!)
+     * @return the content of rects, either in a[] or a fresh array.
+     */
+    public Object [] toArray(Object[] a) {
+        Class t = a.getClass().getComponentType();
+        if ((t != Object.class) &&
+            (t != Rectangle.class)) {
+            // Nothing here for it...
+            Arrays.fill( a, null );
+            return a;
+        }
+
+        if (a.length < size)
+            a = new Rectangle[size];
+        System.arraycopy(rects, 0, a, 0, size);
+        Arrays.fill( a, size, a.length, null );
+
+        return a;
+    }
+
+    public boolean add(Object o) {
+        add((Rectangle)o);
+        return true;
+    }
+
+    /**
+     * Ensures that this collection contains the specified element
+     * @param rect The rectangle to add
+     */
+    public void add(Rectangle rect) {
+        add(rect, 0, size-1);
+    }
+
+    /**
+     * Ensures that this collection contains the specified element
+     * l is the lower bound index for insertion r is upper
+     * bound index for insertion.
+     * @param rect The rectangle to add
+     * @param l the lowest possible index for a rect with
+     *          greater 'x' coord.
+     * @param r the highest possible index for a rect with
+     *          greater 'x' coord.
+     */
+    protected void add(Rectangle rect, int l, int r) {
+        ensureCapacity(size+1);
+        int idx=l;
+        while (l <= r) {
+            idx = (l+r)/2;
+            while ((rects[idx] == null) && (idx <r)) idx++;
+            if (rects[idx] == null) {
+                // All 'null' from center to r so skip them
+                r = (l+r)/2;
+                idx = (l+r)/2;
+                if (l>r)
+                    idx=l;
+                while ((rects[idx] == null) && (idx > l)) idx--;
+                if (rects[idx] == null) {
+                    rects[idx] = rect;
+                    return;
+                }
+            }
+            if (rect.x == rects[idx].x) break;
+            if (rect.x <  rects[idx].x) {
+                if (idx == 0) break;
+                if ((rects[idx-1] != null) &&
+                    (rect.x >= rects[idx-1].x)) break;
+                r = idx-1;
+            } else {
+                if (idx == size-1)  {idx++; break; }
+                if ((rects[idx+1] != null) &&
+                    (rect.x <= rects[idx+1].x)) { idx++; break;}
+                l = idx+1;
+            }
+        }
+
+        if (idx < size) {
+            System.arraycopy(rects, idx,
+                             rects, idx+1, size-idx);
+        }
+
+        // if (idx!=0) System.out.print(rects[idx-1].x);
+        // else System.out.print("[First]");
+        // System.out.print(" " + rect.x + " ");
+        // if (idx<size) System.out.print(rects[idx+1].x);
+        // else System.out.print("[last]");
+        // System.out.println("");
+
+        rects[idx] = rect;
+        size++;
+        bounds=null;
+    }
+
+    public boolean addAll(Collection c) {
+        if (c instanceof RectListManager) {
+            add((RectListManager)c);
+        } else {
+            add(new RectListManager(c));
+        }
+
+        return (c.size() != 0);
+    }
+
+    public boolean contains(Object o) {
+        Rectangle rect = (Rectangle)o;
+        int l=0, r=size-1, idx=0;
+        while (l <= r) {
+            idx = (l+r) >>> 1;
+            if (rect.x == rects[idx].x) break;
+            if (rect.x <  rects[idx].x) {
+                if (idx == 0) break;
+                if (rect.x >= rects[idx-1].x) break;
+                r = idx-1;
+            } else {
+                if (idx == size-1)  {idx++; break; }
+                if (rect.x <= rects[idx+1].x) { idx++; break;}
+                l = idx+1;
+            }
+        }
+        // Didn't find any rect with the same x value.
+        if (rects[idx].x != rect.x) return false;
+
+        // Search towards 0 from idx for rect that matches
+        for (int i=idx; i>=0; i--){
+            if (rects[idx].equals(rect)) return true;
+            if (rects[idx].x != rect.x)  break;
+        }
+
+        // Search towards size from idx for rect that matches
+        for (int i=idx+1; i<size; i++) {
+            if (rects[idx].equals(rect)) return true;
+            if (rects[idx].x != rect.x)  break;
+        }
+
+        // No match...
+        return false;
+    }
+
+    /**
+     * Returns true if this collection contains all of the elements in
+     * the specified collection.
+     */
+    public boolean containsAll(Collection c) {
+        if (c instanceof RectListManager)
+            return containsAll((RectListManager)c);
+        return containsAll(new RectListManager(c));
+    }
+
+    public boolean containsAll(RectListManager rlm) {
+        int x, xChange = 0;
+        for (int j=0, i=0; j<rlm.size; j++) {
+            i=xChange;
+            while(rects[i].x < rlm.rects[j].x) {
+                i++;
+                if (i == size) return false;
+            }
+            xChange = i;
+            x = rects[i].x;
+            while (!rlm.rects[j].equals(rects[i])) {
+                i++;
+                if (i == size) return false; // out of rects
+                if (x != rects[i].x)
+                    return false; // out of the zone.
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Removes a single instance of the specified element from this
+     * collection, if it is present.
+     * @param o Object to remove an matching instance of.
+     */
+    public boolean remove(Object o) {
+        return remove((Rectangle)o);
+    }
+
+    /**
+     * Removes a single instance of the specified Rectangle from this
+     * collection, if it is present.
+     * @param rect Rectangle to remove an matching instance of.
+     */
+    public boolean remove(Rectangle rect) {
+        int l=0, r=size-1, idx=0;
+        while (l <= r) {
+            idx = (l+r) >>> 1;
+            if (rect.x == rects[idx].x) break;
+            if (rect.x <  rects[idx].x) {
+                if (idx == 0) break;
+                if (rect.x >= rects[idx-1].x) break;
+                r = idx-1;
+            } else {
+                if (idx == size-1)  {idx++; break; }
+                if (rect.x <= rects[idx+1].x) { idx++; break;}
+                l = idx+1;
+            }
+        }
+        // Didn't find any rect with the same x value.
+        if (rects[idx].x != rect.x) return false;
+
+        // Search towards 0 from idx for rect that matches
+        for (int i=idx; i>=0; i--){
+            if (rects[idx].equals(rect)) {
+                System.arraycopy(rects, idx+1, rects, idx, size-idx);
+                size--;
+                bounds = null;
+                return true;
+            }
+            if (rects[idx].x != rect.x)  break;
+        }
+
+        // Search towards size from idx for rect that matches
+        for (int i=idx+1; i<size; i++) {
+            if (rects[idx].equals(rect)) {
+                System.arraycopy(rects, idx+1, rects, idx, size-idx);
+                size--;
+                bounds = null;
+                return true;
+            }
+            if (rects[idx].x != rect.x)  break;
+        }
+
+        // No match...
+        return false;
+    }
+
+    public boolean removeAll(Collection c) {
+        if (c instanceof RectListManager)
+            return removeAll((RectListManager)c);
+        return removeAll(new RectListManager(c));
+    }
+
+    public boolean removeAll(RectListManager rlm) {
+        int x, xChange = 0;
+        boolean ret = false;
+        for (int j=0, i=0; j<rlm.size; j++) {
+            i=xChange;
+            while ((rects[i] == null) ||
+                   (rects[i].x < rlm.rects[j].x)) {
+                i++;
+                if (i == size) break;
+            }
+
+            if (i == size) break;
+
+            xChange = i;
+            x = rects[i].x;
+            while (true) {
+                if (rects[i] == null) {
+                    i++;
+                    if (i == size) break; // out of rects
+                    continue;
+                }
+                if (rlm.rects[j].equals(rects[i])) {
+                    rects[i] = null;
+                    ret = true;
+                }
+                i++;
+                if (i == size)       break; // out of rects
+                if (x != rects[i].x) break; // out of the zone.
+            }
+        }
+
+        // Now we will go through collapsing the nulled entries.
+        if (ret) {
+            int j=0, i=0;
+            while (i<size) {
+                if (rects[i] != null)
+                    rects[j++] = rects[i];
+                i++;
+            }
+            size = j;
+            bounds = null;
+        }
+        return ret;
+    }
+
+    public boolean retainAll(Collection c) {
+        if (c instanceof RectListManager)
+            return retainAll((RectListManager)c);
+        return retainAll(new RectListManager(c));
+    }
+    public boolean retainAll(RectListManager rlm) {
+        int x, xChange = 0;
+        boolean ret = false;
+
+        for (int j=0, i=0; j<size; j++) {
+            i=xChange;
+            while (rlm.rects[i].x < rects[j].x) {
+                i++;
+                if (i == rlm.size) break;
+            }
+            if (i == rlm.size) {
+                ret = true;
+                // No more rects will match anything from rlm
+                // so remove them from this RLM.
+                for (int k=j; k<size; k++)
+                    rects[k] = null;
+                size = j;
+                break;
+            }
+
+            xChange = i;
+            x = rlm.rects[i].x;
+            while (true) {
+                if (rects[j].equals(rlm.rects[i])) break;
+                i++;
+                if ((i == rlm.size) ||
+                    (x != rlm.rects[i].x)) {
+                    // Out of zone or rects
+                    rects[j] = null;
+                    ret = true;
+                    break;
+                }
+            }
+        }
+
+        // Now we will go through collapsing the nulled entries.
+        if (ret) {
+            int j=0, i=0;
+            while (i<size) {
+                if (rects[i] != null)
+                    rects[j++] = rects[i];
+                i++;
+            }
+            size = j;
+            bounds = null;
+        }
+        return ret;
+    }
+
+    /**
+     * Adds the contents of <tt>rlm</tt> to this RectListManager.  No
+     * collapsing of rectangles is done here the contents are simply
+     * added (you should generally call 'mergeRects' some time after
+     * this operation before using the contents of this
+     * RectListManager.
+     * @param rlm The RectListManager to add the contents of.  */
+    public void add(RectListManager rlm) {
+        if (rlm.size == 0)
+            return;
+
+        Rectangle [] dst = rects;
+        if (rects.length < (size+rlm.size)) {
+            dst = new Rectangle[size+rlm.size];
+        }
+
+        if (size == 0) {
+            System.arraycopy(rlm.rects, 0, dst, size, rlm.size);
+            size = rlm.size;
+            bounds = null;
+            return;
+        }
+
+        Rectangle [] src1   = rlm.rects;
+        int          src1Sz = rlm.size;
+        int          src1I  = src1Sz-1;
+
+        Rectangle [] src2   = rects;
+        int          src2Sz = size;
+        int          src2I  = src2Sz-1;
+
+        int dstI = size+rlm.size-1;
+        int x1 = src1[src1I].x;
+        int x2 = src2[src2I].x;
+
+        while (dstI >= 0) {
+            if (x1 <= x2) {
+                dst[dstI] = src2[src2I];
+                if (src2I == 0) {
+                    System.arraycopy(src1, 0, dst, 0, src1I+1);
+                    break;
+                }
+                src2I--;
+                x2 = src2[src2I].x;
+            } else {
+                dst[dstI] = src1[src1I];
+                if (src1I == 0) {
+                    System.arraycopy(src2, 0, dst, 0, src2I+1);
+                    break;
+                }
+                src1I--;
+                x1 = src1[src1I].x;
+            }
+            dstI--;
+        }
+        rects = dst;
+        size += rlm.size;
+        bounds = null;
+    }
+
+    public void mergeRects(int overhead, int lineOverhead) {
+        if (size == 0) return;
+        Rectangle r, cr, mr;
+        int cost1, cost2, cost3;
+        mr = new Rectangle();
+        Rectangle []splits = new Rectangle[4];
+        for (int j, i=0; i<size; i++) {
+            r = rects[i];
+            if (r == null) continue;
+            cost1 = (overhead                 +
+                     (r.height*lineOverhead) +
+                     (r.height*r.width));
+            do {
+                int maxX = r.x+r.width+overhead/r.height;
+                for (j=i+1; j<size; j++) {
+                    cr = rects[j];
+                    if ((cr == null) || (cr == r)) continue;
+                    if (cr.x >= maxX) {
+                        // No more merges can happen.
+                        j = size;
+                        break;
+                    }
+                    cost2 = (overhead                 +
+                             (cr.height*lineOverhead) +
+                             (cr.height*cr.width));
+
+                    mr = r.union(cr);
+                    cost3 = (overhead                 +
+                             (mr.height*lineOverhead) +
+                             (mr.height*mr.width));
+                    if (cost3 <= cost1+cost2) {
+                        r = rects[i] = mr;
+                        rects[j] = null;
+                        cost1 = cost3;
+                        j=-1;
+                        break;
+                    }
+
+                    if (!r.intersects(cr)) continue;
+
+                    splitRect(cr, r, splits);
+                    int splitCost=0;
+                    int l=0;
+                    for (int k=0; k<4; k++) {
+                        if (splits[k] != null) {
+                            Rectangle sr = splits[k];
+                            // Collapse null entries in first three
+                            // (That share common 'x').
+                            if (k<3) splits[l++] = sr;
+                            splitCost += (overhead                 +
+                                          (sr.height*lineOverhead) +
+                                          (sr.height*sr.width));
+                        }
+                    }
+                    if (splitCost >= cost2) continue;
+
+                    // Insert the splits.
+                    if (l == 0) {
+                        // only third split may be left (no common 'x').
+                        rects[j] = null;
+                        if (splits[3] != null)
+                            add(splits[3], j, size-1);
+                        continue;
+                    }
+
+                    rects[j] = splits[0];
+                    if (l > 1)
+                        insertRects(splits, 1, j+1, l-1);
+                    if (splits[3] != null)
+                        add(splits[3], j, size-1);
+                }
+
+                // if we merged it with another rect then
+                // we need to check all the rects up to i again,
+                // against the merged rect.
+            } while (j != size);
+        }
+
+        // Now we will go through collapsing the nulled entries.
+        int j=0, i=0;
+        float area=0;
+        while (i<size) {
+            if (rects[i] != null) {
+                r = rects[i];
+                rects[j++] = r;
+                area += overhead + (r.height*lineOverhead) +
+                    (r.height*r.width);
+            }
+            i++;
+        }
+        size = j;
+        bounds=null;
+        r = getBounds();
+        if (r == null) return;
+        if (overhead + (r.height*lineOverhead) + (r.height*r.width) < area) {
+            rects[0] = r;
+            size=1;
+        }
+    }
+
+    public void subtract(RectListManager rlm, int overhead, int lineOverhead) {
+        Rectangle r, sr;
+        int cost;
+        int jMin=0;
+        Rectangle [] splits = new Rectangle[4];
+
+        for(int i=0; i<size; i++) {
+            r = rects[i]; // Canidate rect...
+            cost = (overhead                +
+                    (r.height*lineOverhead) +
+                    (r.height*r.width));
+            for (int j=jMin; j<rlm.size; j++) {
+                sr = rlm.rects[j]; // subtraction rect.
+
+                // Check if the canidate rect starts after
+                // the end of this rect in 'x' if so
+                // go to the next one.
+                if (sr.x+sr.width < r.x) {
+                    // If this was jMin then increment jMin (no
+                    // future canidate rect will intersect this rect).
+                    if (j == jMin) jMin++;
+                    continue;
+                }
+
+                // Check if the rest of the rects from rlm are past
+                // the end of the canidate rect.  If so we are
+                // done with this canidate rect.
+                if (sr.x > r.x+r.width)
+                    break;
+
+                // If they don't insersect then go to next sub rect.
+                if (!r.intersects(sr))
+                    continue;
+
+                // Now we know they intersect one another lets
+                // figure out how...
+
+                splitRect(r, sr, splits);
+
+                int splitCost=0;
+                Rectangle tmpR;
+                for (int k=0; k<4; k++) {
+                    tmpR = splits[k];
+                    if (tmpR != null)
+                        splitCost += (overhead                   +
+                                      (tmpR.height*lineOverhead) +
+                                      (tmpR.height*tmpR.width));
+                }
+
+                if (splitCost >= cost)
+                    // This isn't ideal as depending on the order
+                    // Stuff is done in we might later kill some of
+                    // these rectangles (hence lowering the cost).
+                    // For this reason it is probably best of the
+                    // subtract list has been merged as this will help
+                    // reduce the instances where this will happen.
+                    continue;
+
+                // Collapse null entries in first three elements
+                // split 0, 1, 2 (entries that share a common 'x').
+                int l = 0;
+                for (int k=0; k<3; k++) {
+                    if (splits[k] != null)
+                        splits[l++] = splits[k];
+                }
+
+                // Fully covered (or only split 3 survived which we
+                // will visit later) this canidate rect goes away.
+                if (l==0) {
+                    rects[i].width = 0;
+                    // Insert the third split (if any) at the
+                    // proper place in rects list.
+                    if (splits[3] != null)
+                        add(splits[3], i, size-1);
+                    break;
+                }
+
+                // Otherwise replace the canidate with the top of
+                // the split, since it only shrunk it didn't grow,
+                // we know that the previous subtract rects don't
+                // intersect it.
+                r        = splits[0];
+                rects[i] = r;
+                cost = (overhead                +
+                        (r.height*lineOverhead) +
+                        (r.height*r.width));
+
+                // Add the remainder of the rects that
+                // share 'r.x' (if any).  Possible
+                // are split 1, and split 2.
+                if (l > 1)
+                    insertRects(splits, 1, i+1, l-1);
+
+                // Insert the third split (if any) at the
+                // proper place in rects list.
+                if (splits[3] != null)
+                    add(splits[3], i+l, size-1);
+            }
+        }
+
+        // Now we will go through collapsing the nulled entries.
+        int j=0, i=0;
+        while (i<size) {
+            if (rects[i].width == 0)
+                rects[i] = null;
+            else
+                rects[j++] = rects[i];
+            i++;
+        }
+        size = j;
+        bounds = null;
+    }
+
+    protected void splitRect(Rectangle r, Rectangle sr,
+                             Rectangle []splits) {
+        // We split the canidate rectrect into four parts.  In
+        // many cases one or more of these will be empty.
+        //
+        //    +-------------------------------------+ ry0
+        //    |                                     |
+        //    |                                     |
+        //    |          Split 0                    |
+        //    |                                     |
+        //    |                                     |
+        // ------------+-----------------+--------------- sry0
+        //    |        |                 |          |
+        //    | Split2 |   subtracted    | Split 3  |
+        //    |        |   rect          |          |
+        //    |        |                 |          |
+        // ------------+-----------------+--------------- sry1
+        //    |       srx0              srx1        |
+        //    |                                     |
+        //    |          Split 1                    |
+        //    |                                     |
+        //    +-------------------------------------+ ry1
+        //   rx0                                   rx1
+
+        int rx0 = r.x;
+        int rx1 = rx0+r.width-1;
+        int ry0 = r.y;
+        int ry1 = ry0+r.height-1;
+
+        int srx0 = sr.x;
+        int srx1 = srx0+sr.width-1;
+        int sry0 = sr.y;
+        int sry1 = sry0+sr.height-1;
+
+        if ((ry0 < sry0) && (ry1 >= sry0)) {
+            splits[0] = new Rectangle(rx0, ry0, r.width, sry0-ry0);
+            ry0 = sry0;
+        } else {
+            splits[0] = null;
+        }
+
+        if ((ry0 <= sry1) && (ry1 > sry1)) {
+            splits[1] = new Rectangle(rx0, sry1+1, r.width, ry1-sry1);
+            ry1 = sry1;
+        } else {
+            splits[1] = null;
+        }
+
+        if ((rx0 < srx0) && (rx1 >= srx0)) {
+            splits[2] = new Rectangle(rx0, ry0, srx0-rx0, ry1-ry0+1);
+        } else {
+            splits[2] = null;
+        }
+
+        if ((rx0 <= srx1) && (rx1 > srx1)) {
+            splits[3]= new Rectangle(srx1+1, ry0, rx1-srx1, ry1-ry0+1);
+        } else {
+            splits[3] = null;
+        }
+    }
+
+    protected void insertRects(Rectangle[] rects, int srcPos,
+                               int dstPos, int len) {
+        if (len == 0) return;
+
+        // Make sure we have room.
+        ensureCapacity(size+len);
+
+        // Move everything after pos up...
+        for (int i=size-1; i>=dstPos; i--)
+            this.rects[i+len] = this.rects[i];
+
+        // Put the new rects in.
+        System.arraycopy( rects, srcPos, this.rects, dstPos, len );
+
+        size += len;
+    }
+
+    public void ensureCapacity(int sz) {
+        if (sz <= rects.length)
+            return;
+        int nSz = rects.length + (rects.length>>1) + 1;
+        while (nSz < sz)
+            nSz+=(nSz>>1)+1;
+
+        Rectangle [] nRects = new Rectangle[nSz];
+        System.arraycopy(rects, 0, nRects, 0, size);
+
+        rects = nRects;
+    }
+
+    /**
+     * Comparator for ordering rects in X.
+     *
+     * Note: this comparator imposes orderings that are inconsistent
+     *       with equals.
+     */
+    private static class RectXComparator implements Comparator, Serializable {
+
+        RectXComparator() { }
+
+        public final int compare(Object o1, Object o2) {
+            return ((Rectangle)o1).x-((Rectangle)o2).x;
+        }
+    }
+
+
+    private class RLMIterator implements ListIterator {
+        int idx = 0;
+        boolean removeOk = false;
+        boolean forward  = true;
+        RLMIterator() { }
+
+        public boolean hasNext() { return idx < size; }
+        public int nextIndex() { return idx; }
+        public Object next() {
+            if (idx >= size)
+                throw new NoSuchElementException("No Next Element");
+            forward = true;
+            removeOk = true;
+            return rects[idx++];
+        }
+
+        public boolean hasPrevious() { return idx > 0; }
+        public int previousIndex() { return idx-1; }
+        public Object previous() {
+            if (idx <= 0)
+                throw new NoSuchElementException("No Previous Element");
+            forward = false;
+            removeOk = true;
+            return rects[--idx];
+        }
+
+        public void remove() {
+            if (!removeOk)
+                throw new IllegalStateException
+                    ("remove can only be called directly after next/previous");
+
+            if (forward) idx--;
+            if (idx != size-1)
+                System.arraycopy(rects, idx+1, rects, idx, size-(idx+1));
+            size--;
+            rects[size] = null;
+            removeOk = false;
+        }
+
+
+        public void set(Object o) {
+            Rectangle r = (Rectangle)o;
+
+            if (!removeOk)
+                throw new IllegalStateException
+                    ("set can only be called directly after next/previous");
+
+            if (forward) idx--;
+
+            if (idx+1<size) {
+                if (rects[idx+1].x < r.x)
+                    throw new UnsupportedOperationException
+                        ("RectListManager entries must be sorted");
+            }
+            if (idx>=0) {
+                if (rects[idx-1].x > r.x)
+                    throw new UnsupportedOperationException
+                        ("RectListManager entries must be sorted");
+            }
+
+            rects[idx] = r;
+            removeOk = false;
+        }
+
+        public void add(Object o) {
+            Rectangle r = (Rectangle)o;
+            if (idx<size) {
+                if (rects[idx].x < r.x)
+                    throw new UnsupportedOperationException
+                        ("RectListManager entries must be sorted");
+            }
+            if (idx!=0) {
+                if (rects[idx-1].x > r.x)
+                    throw new UnsupportedOperationException
+                        ("RectListManager entries must be sorted");
+            }
+            ensureCapacity(size+1);
+            if (idx != size)
+                System.arraycopy(rects, idx, rects, idx+1, size-idx);
+            rects[idx] = r;
+            idx++;
+            removeOk = false;
+        }
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/RectListManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Segment.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Segment.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Segment.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Segment.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,64 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * An interface that path segments must implement.
+ *
+ * @version $Id: Segment.java 478249 2006-11-22 17:29:37Z dvholten $
+ */
+public interface Segment extends Cloneable {
+    double minX();
+    double maxX();
+    double minY();
+    double maxY();
+    Rectangle2D getBounds2D();
+
+    Point2D.Double evalDt(double t);
+    Point2D.Double eval(double t);
+
+    Segment getSegment(double t0, double t1);
+    Segment splitBefore(double t);
+    Segment splitAfter(double t);
+    void    subdivide(Segment s0, Segment s1);
+    void    subdivide(double t, Segment s0, Segment s1);
+    double  getLength();
+    double  getLength(double maxErr);
+
+    SplitResults split(double y);
+
+    class SplitResults {
+        Segment [] above;
+        Segment [] below;
+        SplitResults(Segment []below, Segment []above) {
+            this.below = below;
+            this.above = above;
+        }
+
+        Segment [] getBelow() {
+            return below;
+        }
+        Segment [] getAbove() {
+            return above;
+        }
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/Segment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/SegmentList.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/SegmentList.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/SegmentList.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/SegmentList.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,177 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.Shape;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * A class representing a list of path segments.
+ *
+ * @version $Id: SegmentList.java 522271 2007-03-25 14:42:45Z dvholten $
+ */
+public class SegmentList {
+    List segments = new LinkedList();
+
+    public SegmentList() {
+    }
+
+    public SegmentList(Shape s) {
+        PathIterator pi = s.getPathIterator(null);
+        float[] pts  = new float[6];
+        int type;
+        Point2D.Double loc = null;
+        Point2D.Double openLoc = null;
+        while (!pi.isDone()) {
+            type = pi.currentSegment(pts);
+            switch (type) {
+            case PathIterator.SEG_MOVETO:
+                openLoc = loc = new Point2D.Double(pts[0], pts[1] );
+                break;
+            case PathIterator.SEG_LINETO: {
+                Point2D.Double p0 = new Point2D.Double(pts[0], pts[1] );
+                segments.add(new Linear(loc, p0));
+                loc = p0;
+            }
+                break;
+
+            case PathIterator.SEG_QUADTO: {
+                Point2D.Double p0 = new Point2D.Double(pts[0], pts[1] );
+                Point2D.Double p1 = new Point2D.Double(pts[2], pts[3] );
+                segments.add(new Quadradic(loc, p0, p1));
+                loc = p1;
+            }
+                break;
+
+            case PathIterator.SEG_CUBICTO: {
+                Point2D.Double p0 = new Point2D.Double(pts[0], pts[1] );
+                Point2D.Double p1 = new Point2D.Double(pts[2], pts[3] );
+                Point2D.Double p2 = new Point2D.Double(pts[4], pts[5] );
+                segments.add(new Cubic(loc, p0, p1, p2));
+                loc = p2;
+            }
+                break;
+
+            case PathIterator.SEG_CLOSE:
+                segments.add(new Linear(loc, openLoc));
+                loc = openLoc;
+                break;
+            }
+            pi.next();
+        }
+    }
+
+    public Rectangle2D getBounds2D() {
+        Iterator iter = iterator();
+        if (!iter.hasNext()) return null;
+
+        Rectangle2D ret;
+        ret = (Rectangle2D)((Segment)iter.next()).getBounds2D().clone();
+        while (iter.hasNext()) {
+            Segment seg = (Segment)iter.next();
+            Rectangle2D segB = seg.getBounds2D();
+            Rectangle2D.union(segB, ret, ret);
+        }
+        return ret;
+    }
+
+    public void add(Segment s) {
+        segments.add(s);
+    }
+
+    public Iterator iterator() { return segments.iterator(); }
+
+    public int size() { return segments.size(); }
+
+    public SegmentList.SplitResults split(double y) {
+        Iterator iter = segments.iterator();
+        SegmentList above = new SegmentList();
+        SegmentList below = new SegmentList();
+        while (iter.hasNext()) {
+            Segment seg = (Segment)iter.next();
+            Segment.SplitResults results = seg.split(y);
+            if (results == null) {
+                Rectangle2D bounds = seg.getBounds2D();
+                if (bounds.getY() > y) {
+                    below.add(seg);
+                } else if (bounds.getY() == y) {
+                    if (bounds.getHeight() != 0) {
+                        below.add(seg);
+                    }
+                } else {
+                    above.add(seg);
+                }
+                continue;
+            }
+
+            Segment [] resAbove = results.getAbove();
+            for(int i=0; i<resAbove.length; i++) {
+                above.add(resAbove[i]);
+            }
+
+            Segment [] resBelow = results.getBelow();
+            for(int i=0; i<resBelow.length; i++) {
+                below.add(resBelow[i]);
+            }
+        }
+        return new SegmentList.SplitResults(above, below);
+    }
+
+    /**
+     * read-only helper class to represent a split-result.
+     * So far, used only by FlowRegions.
+     */
+    public static class SplitResults {
+
+        /**
+         * is <code>null</code>, when the list is empty.
+         */
+        final SegmentList above;
+        final SegmentList below;
+
+        public SplitResults(SegmentList above, SegmentList below) {
+
+            if ( above != null && above.size() > 0 ){
+                this.above = above;
+            } else {
+                this.above = null;
+            }
+            if ( below != null && below.size() > 0 ){
+                this.below = below;
+            } else {
+                this.below = null;
+            }
+        }
+
+        /**
+         * @return the list of segments above some split-point - can be null
+         */
+        public SegmentList getAbove() { return above; }
+
+        /**
+         * @return the list of segments below some split-point - can be null
+         */
+        public SegmentList getBelow() { return below; }
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/SegmentList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/ShapeExtender.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/ShapeExtender.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/ShapeExtender.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/ShapeExtender.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,113 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.flex.forks.batik.ext.awt.geom;
+
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * This class wraps a normal path into an extended path.
+ * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
+ * @version $Id: ShapeExtender.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public class ShapeExtender implements ExtendedShape {
+    Shape shape;
+
+    public ShapeExtender(Shape shape) {
+        this.shape = shape;
+    }
+
+    public boolean contains(double x, double y) {
+        return shape.contains(x, y);
+    }
+    public boolean contains(double x, double y, double w, double h) {
+        return shape.contains(x, y, w, h);
+    }
+
+    public boolean contains(Point2D p) {
+        return shape.contains(p);
+    }
+
+    public boolean contains(Rectangle2D r) {
+        return shape.contains(r);
+    }
+
+    public Rectangle getBounds() {
+        return shape.getBounds();
+    }
+
+    public Rectangle2D getBounds2D() {
+        return shape.getBounds2D();
+    }
+
+    public PathIterator getPathIterator(AffineTransform at) {
+        return shape.getPathIterator(at);
+    }
+
+    public PathIterator getPathIterator(AffineTransform at, double flatness) {
+        return shape.getPathIterator(at, flatness);
+    }
+
+    public ExtendedPathIterator getExtendedPathIterator() {
+        return new EPIWrap(shape.getPathIterator(null));
+    }
+
+    public boolean intersects(double x, double y, double w, double h) {
+        return shape.intersects(x, y, w, h);
+    }
+
+    public boolean intersects(Rectangle2D r) {
+        return shape.intersects(r);
+    }
+
+
+    public static class EPIWrap implements ExtendedPathIterator {
+        PathIterator pi = null;
+        public EPIWrap(PathIterator pi) {
+            this.pi = pi;
+        }
+
+        public int currentSegment() {
+            float[] coords = new float[6];
+            return pi.currentSegment(coords);
+        }
+
+        public int currentSegment(double[] coords) { 
+            return pi.currentSegment(coords); }
+
+        public int currentSegment(float[] coords) {
+            return pi.currentSegment(coords); }
+
+        public int getWindingRule() {
+            return pi.getWindingRule();
+        }
+
+        public boolean isDone() {
+            return pi.isDone(); }
+
+        public void next() {
+            pi.next();
+        }
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/ShapeExtender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/package.html
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/package.html?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/package.html (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/package.html Thu Oct 25 19:01:43 2012
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.batik.ext.awt.geom</title>
+  </head>
+
+  <body>
+Contains extensions to the <tt>java.awt.geom</tt> package. This
+package provides new <tt>Shape</tt>s and some utility methods to
+manage geometric objects.
+  </body>
+</html>

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/geom/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ARGBChannel.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ARGBChannel.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ARGBChannel.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ARGBChannel.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,108 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+import java.io.Serializable;
+
+/**
+ * Enumerated type for an ARGB Channel selector.
+ *
+ * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
+ * @version $Id: ARGBChannel.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public final class ARGBChannel implements Serializable{
+    /**
+     * Types.
+     * 
+     */
+    public static final int CHANNEL_A = 3;
+    public static final int CHANNEL_R = 2;
+    public static final int CHANNEL_G = 1;
+    public static final int CHANNEL_B = 0;
+
+    /**
+     * Strings used to get a more readable output when
+     * a value is displayed.
+     */
+    public static final String RED = "Red";
+    public static final String GREEN = "Green";
+    public static final String BLUE = "Blue";
+    public static final String ALPHA = "Alpha";
+
+    /**
+     * Channel values
+     */
+    public static final ARGBChannel R 
+        = new ARGBChannel(CHANNEL_R, RED);
+    public static final ARGBChannel G 
+        = new ARGBChannel(CHANNEL_G, GREEN);
+    public static final ARGBChannel B 
+        = new ARGBChannel(CHANNEL_B, BLUE);
+    public static final ARGBChannel A 
+        = new ARGBChannel(CHANNEL_A, ALPHA);
+
+    private String desc;
+    private int val;
+
+    /** 
+     * Constructor is private so that no instances other than
+     * the ones in the enumeration can be created.
+     * @see #readResolve
+     */
+    private ARGBChannel(int val, String desc){
+        this.desc = desc;
+        this.val = val;
+    }
+    
+    /**
+     * @return description
+     */
+    public String toString(){
+        return desc;
+    }
+
+    /**
+     * Convenience for enumeration switching
+     * @return value
+     */
+    public int toInt(){
+        return val;
+    }
+
+
+    /**
+     * This is called by the serialization code before it returns an unserialized
+     * object. To provide for unicity of instances, the instance that was read
+     * is replaced by its static equivalent
+     */
+    public Object readResolve() {
+        switch(val){
+        case CHANNEL_R:
+            return R;
+        case CHANNEL_G:
+            return G;
+        case CHANNEL_B:
+            return B;
+        case CHANNEL_A:
+            return A;
+        default:
+            throw new Error("Unknown ARGBChannel value");
+        }
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ARGBChannel.java
------------------------------------------------------------------------------
    svn:eol-style = native