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

The following examples show how to use sun.awt.geom.Curve#pointCrossingsForPath() . 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 openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 2
Source File: Path2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 3
Source File: Path2D.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 4
Source File: Path2D.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 5
Source File: Path2D.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 6
Source File: Path2D.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 7
Source File: Path2D.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 8
Source File: Path2D.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 9
Source File: Path2D.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 10
Source File: Path2D.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 11
Source File: Path2D.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 12
Source File: Path2D.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 13
Source File: Path2D.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 14
Source File: Path2D.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 15
Source File: Path2D.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 16
Source File: Path2D.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 17
Source File: Path2D.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 18
Source File: Path2D.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}
 
Example 19
Source File: Path2D.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests if the specified coordinates are inside the closed
 * boundary of the specified {@link PathIterator}.
 * <p>
 * This method provides a basic facility for implementors of
 * the {@link Shape} interface to implement support for the
 * {@link Shape#contains(double, double)} method.
 *
 * @param pi the specified {@code PathIterator}
 * @param x the specified X coordinate
 * @param y the specified Y coordinate
 * @return {@code true} if the specified coordinates are inside the
 *         specified {@code PathIterator}; {@code false} otherwise
 * @since 1.6
 */
public static boolean contains(PathIterator pi, double x, double y) {
    if (x * 0.0 + y * 0.0 == 0.0) {
        /* N * 0.0 is 0.0 only if N is finite.
         * Here we know that both x and y are finite.
         */
        int mask = (pi.getWindingRule() == WIND_NON_ZERO ? -1 : 1);
        int cross = Curve.pointCrossingsForPath(pi, x, y);
        return ((cross & mask) != 0);
    } else {
        /* Either x or y was infinite or NaN.
         * A NaN always produces a negative response to any test
         * and Infinity values cannot be "inside" any path so
         * they should return false as well.
         */
        return false;
    }
}