Java Code Examples for sun.awt.geom.Curve#rectCrossingsForQuad()
The following examples show how to use
sun.awt.geom.Curve#rectCrossingsForQuad() .
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 HtmlUnit-Android with Apache License 2.0 | 4 votes |
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 2
Source File: Path2D.java From HtmlUnit-Android with Apache License 2.0 | 4 votes |
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 3
Source File: Path2D.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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 4
Source File: Path2D.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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 5
Source File: Path2D.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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 6
Source File: Path2D.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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 7
Source File: Path2D.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 8
Source File: Path2D.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 9
Source File: Path2D.java From jdk-1.7-annotated with Apache License 2.0 | 4 votes |
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 10
Source File: Path2D.java From jdk-1.7-annotated with Apache License 2.0 | 4 votes |
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 11
Source File: Path2D.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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 12
Source File: Path2D.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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; }