Java Code Examples for sun.awt.geom.Curve#pointCrossingsForQuad()

The following examples show how to use sun.awt.geom.Curve#pointCrossingsForQuad() . 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: Path2D.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 2
Source File: Path2D.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 3
Source File: Path2D.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 4
Source File: Path2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double[] coords = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 5
Source File: Path2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float[] coords = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 6
Source File: Path2D.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 7
Source File: Path2D.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 8
Source File: Path2D.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 9
Source File: Path2D.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 10
Source File: Path2D.java    From HtmlUnit-Android with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 11
Source File: Path2D.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 12
Source File: Path2D.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 13
Source File: Path2D.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 14
Source File: Path2D.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 15
Source File: Path2D.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 16
Source File: Path2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 17
Source File: Path2D.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 18
Source File: Path2D.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 19
Source File: Path2D.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    float coords[] = floatCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}
 
Example 20
Source File: Path2D.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
int pointCrossings(double px, double py) {
    if (numTypes == 0) {
        return 0;
    }
    double movx, movy, curx, cury, endx, endy;
    double coords[] = doubleCoords;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1; i < numTypes; i++) {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings +=
                Curve.pointCrossingsForLine(px, py,
                                            curx, cury,
                                            endx = coords[ci++],
                                            endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings +=
                Curve.pointCrossingsForQuad(px, py,
                                            curx, cury,
                                            coords[ci++],
                                            coords[ci++],
                                            endx = coords[ci++],
                                            endy = coords[ci++],
                                            0);
            curx = endx;
            cury = endy;
            break;
    case PathIterator.SEG_CUBICTO:
            crossings +=
                Curve.pointCrossingsForCubic(px, py,
                                             curx, cury,
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             coords[ci++],
                                             endx = coords[ci++],
                                             endy = coords[ci++],
                                             0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CLOSE:
            if (cury != movy) {
                crossings +=
                    Curve.pointCrossingsForLine(px, py,
                                                curx, cury,
                                                movx, movy);
            }
            curx = movx;
            cury = movy;
            break;
        }
    }
    if (cury != movy) {
        crossings +=
            Curve.pointCrossingsForLine(px, py,
                                        curx, cury,
                                        movx, movy);
    }
    return crossings;
}