sun.awt.geom.AreaOp Java Examples

The following examples show how to use sun.awt.geom.AreaOp. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Area.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #2
Source File: Area.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #3
Source File: Area.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #4
Source File: Area.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #5
Source File: Area.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #6
Source File: Area.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #7
Source File: Area.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #8
Source File: Area.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #9
Source File: Area.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two {@code Area} objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the {@code Area} to be compared to this
 *          {@code Area}
 * @return  {@code true} if the two geometries are equal;
 *          {@code false} otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector<Curve> c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #10
Source File: Area.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #11
Source File: Area.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #12
Source File: Area.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two {@code Area} objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the {@code Area} to be compared to this
 *          {@code Area}
 * @return  {@code true} if the two geometries are equal;
 *          {@code false} otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector<Curve> c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #13
Source File: Area.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #14
Source File: Area.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests whether the geometries of the two <code>Area</code> objects
 * are equal.
 * This method will return false if the argument is null.
 * @param   other  the <code>Area</code> to be compared to this
 *          <code>Area</code>
 * @return  <code>true</code> if the two geometries are equal;
 *          <code>false</code> otherwise.
 * @since 1.2
 */
public boolean equals(Area other) {
    // REMIND: A *much* simpler operation should be possible...
    // Should be able to do a curve-wise comparison since all Areas
    // should evaluate their curves in the same top-down order.
    if (other == this) {
        return true;
    }
    if (other == null) {
        return false;
    }
    Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
    return c.isEmpty();
}
 
Example #15
Source File: Area.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #16
Source File: Area.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #17
Source File: Area.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private static Vector<Curve> pathToCurves(PathIterator pi) {
    Vector<Curve> curves = new Vector<>();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double[] coords = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #18
Source File: Area.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #19
Source File: Area.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #20
Source File: Area.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #21
Source File: Area.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #22
Source File: Area.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #23
Source File: Area.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static Vector<Curve> pathToCurves(PathIterator pi) {
    Vector<Curve> curves = new Vector<>();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #24
Source File: Area.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #25
Source File: Area.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #26
Source File: Area.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #27
Source File: Area.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #28
Source File: Area.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #29
Source File: Area.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static Vector pathToCurves(PathIterator pi) {
    Vector curves = new Vector();
    int windingRule = pi.getWindingRule();
    // coords array is big enough for holding:
    //     coordinates returned from currentSegment (6)
    //     OR
    //         two subdivided quadratic curves (2+4+4=10)
    //         AND
    //             0-1 horizontal splitting parameters
    //             OR
    //             2 parametric equation derivative coefficients
    //     OR
    //         three subdivided cubic curves (2+6+6+6=20)
    //         AND
    //             0-2 horizontal splitting parameters
    //             OR
    //             3 parametric equation derivative coefficients
    double coords[] = new double[23];
    double movx = 0, movy = 0;
    double curx = 0, cury = 0;
    double newx, newy;
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx = coords[0];
            cury = movy = coords[1];
            Curve.insertMove(curves, movx, movy);
            break;
        case PathIterator.SEG_LINETO:
            newx = coords[0];
            newy = coords[1];
            Curve.insertLine(curves, curx, cury, newx, newy);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_QUADTO:
            newx = coords[2];
            newy = coords[3];
            Curve.insertQuad(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CUBICTO:
            newx = coords[4];
            newy = coords[5];
            Curve.insertCubic(curves, curx, cury, coords);
            curx = newx;
            cury = newy;
            break;
        case PathIterator.SEG_CLOSE:
            Curve.insertLine(curves, curx, cury, movx, movy);
            curx = movx;
            cury = movy;
            break;
        }
        pi.next();
    }
    Curve.insertLine(curves, curx, cury, movx, movy);
    AreaOp operator;
    if (windingRule == PathIterator.WIND_EVEN_ODD) {
        operator = new AreaOp.EOWindOp();
    } else {
        operator = new AreaOp.NZWindOp();
    }
    return operator.calculate(curves, EmptyCurves);
}
 
Example #30
Source File: Area.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the shape of this <code>Area</code> to the intersection of
 * its current shape and the shape of the specified <code>Area</code>.
 * The resulting shape of this <code>Area</code> will include
 * only areas that were contained in both this <code>Area</code>
 * and also in the specified <code>Area</code>.
 * <pre>
 *     // Example:
 *     Area a1 = new Area([triangle 0,0 =&gt; 8,0 =&gt; 0,8]);
 *     Area a2 = new Area([triangle 0,0 =&gt; 8,0 =&gt; 8,8]);
 *     a1.intersect(a2);
 *
 *      a1(before)   intersect     a2         =     a1(after)
 *
 *     ################     ################     ################
 *     ##############         ##############       ############
 *     ############             ############         ########
 *     ##########                 ##########           ####
 *     ########                     ########
 *     ######                         ######
 *     ####                             ####
 *     ##                                 ##
 * </pre>
 * @param   rhs  the <code>Area</code> to be intersected with this
 *          <code>Area</code>
 * @throws NullPointerException if <code>rhs</code> is null
 * @since 1.2
 */
public void intersect(Area rhs) {
    curves = new AreaOp.IntOp().calculate(this.curves, rhs.curves);
    invalidateBounds();
}