Java Code Examples for sun.awt.geom.AreaOp#calculate()

The following examples show how to use sun.awt.geom.AreaOp#calculate() . 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 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 2
Source File: Area.java    From jdk8u-dev-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 3
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 4
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 5
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 6
Source File: Area.java    From openjdk-8 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 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
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 15
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 16
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 17
Source File: Area.java    From TencentKona-8 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 18
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);
}