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

The following examples show how to use sun.awt.geom.Curve#rectCrossingsForCubic() . 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: CubicCurve2D.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 2
Source File: CubicCurve2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 3
Source File: CubicCurve2D.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 4
Source File: CubicCurve2D.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 5
Source File: CubicCurve2D.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 6
Source File: CubicCurve2D.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 7
Source File: CubicCurve2D.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 8
Source File: CubicCurve2D.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 9
Source File: CubicCurve2D.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 10
Source File: CubicCurve2D.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private int rectCrossings(double x, double y, double w, double h) {
    int crossings = 0;
    if (!(getX1() == getX2() && getY1() == getY2())) {
        crossings = Curve.rectCrossingsForLine(crossings,
                                               x, y,
                                               x+w, y+h,
                                               getX1(), getY1(),
                                               getX2(), getY2());
        if (crossings == Curve.RECT_INTERSECTS) {
            return crossings;
        }
    }
    // we call this with the curve's direction reversed, because we wanted
    // to call rectCrossingsForLine first, because it's cheaper.
    return Curve.rectCrossingsForCubic(crossings,
                                       x, y,
                                       x+w, y+h,
                                       getX2(), getY2(),
                                       getCtrlX2(), getCtrlY2(),
                                       getCtrlX1(), getCtrlY1(),
                                       getX1(), getY1(), 0);
}
 
Example 11
Source File: Path2D.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    double coords[] = doubleCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            endx = coords[ci++];
            endy = coords[ci++];
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx, endy);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 12
Source File: Path2D.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 13
Source File: Path2D.java    From HtmlUnit-Android with Apache License 2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    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 rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 15
Source File: Path2D.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 16
Source File: Path2D.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    double coords[] = doubleCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            endx = coords[ci++];
            endy = coords[ci++];
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx, endy);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 17
Source File: Path2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    double coords[] = doubleCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            endx = coords[ci++];
            endy = coords[ci++];
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx, endy);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 18
Source File: Path2D.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 19
Source File: Path2D.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    double coords[] = doubleCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            endx = coords[ci++];
            endy = coords[ci++];
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx, endy);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}
 
Example 20
Source File: Path2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
int rectCrossings(double rxmin, double rymin,
                  double rxmax, double rymax)
{
    float coords[] = floatCoords;
    double curx, cury, movx, movy, endx, endy;
    curx = movx = coords[0];
    cury = movy = coords[1];
    int crossings = 0;
    int ci = 2;
    for (int i = 1;
         crossings != Curve.RECT_INTERSECTS && i < numTypes;
         i++)
    {
        switch (pointTypes[i]) {
        case PathIterator.SEG_MOVETO:
            if (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            movx = curx = coords[ci++];
            movy = cury = coords[ci++];
            break;
        case PathIterator.SEG_LINETO:
            crossings =
                Curve.rectCrossingsForLine(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           endx = coords[ci++],
                                           endy = coords[ci++]);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_QUADTO:
            crossings =
                Curve.rectCrossingsForQuad(crossings,
                                           rxmin, rymin,
                                           rxmax, rymax,
                                           curx, cury,
                                           coords[ci++],
                                           coords[ci++],
                                           endx = coords[ci++],
                                           endy = coords[ci++],
                                           0);
            curx = endx;
            cury = endy;
            break;
        case PathIterator.SEG_CUBICTO:
            crossings =
                Curve.rectCrossingsForCubic(crossings,
                                            rxmin, rymin,
                                            rxmax, rymax,
                                            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 (curx != movx || cury != movy) {
                crossings =
                    Curve.rectCrossingsForLine(crossings,
                                               rxmin, rymin,
                                               rxmax, rymax,
                                               curx, cury,
                                               movx, movy);
            }
            curx = movx;
            cury = movy;
            // Count should always be a multiple of 2 here.
            // assert((crossings & 1) != 0);
            break;
        }
    }
    if (crossings != Curve.RECT_INTERSECTS &&
        (curx != movx || cury != movy))
    {
        crossings =
            Curve.rectCrossingsForLine(crossings,
                                       rxmin, rymin,
                                       rxmax, rymax,
                                       curx, cury,
                                       movx, movy);
    }
    // Count should always be a multiple of 2 here.
    // assert((crossings & 1) != 0);
    return crossings;
}