jdk/src/java.desktop/share/classes/java/awt/Shape.java
author serb
Fri, 29 Apr 2016 15:44:04 +0300
changeset 38388 84ab1f133f16
parent 35667 ed476aba94de
child 45025 9ad3afa82b5e
permissions -rw-r--r--
8143346: Broken link in java.beans.XMLEncoder Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21278
diff changeset
     2
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.geom.AffineTransform;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.geom.PathIterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.geom.Point2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.geom.Rectangle2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    34
 * The {@code Shape} interface provides definitions for objects
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    35
 * that represent some form of geometric shape.  The {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * is described by a {@link PathIterator} object, which can express the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    37
 * outline of the {@code Shape} as well as a rule for determining
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * how the outline divides the 2D plane into interior and exterior
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    39
 * points.  Each {@code Shape} object provides callbacks to get the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * bounding box of the geometry, determine whether points or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * rectangles lie partly or entirely within the interior
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    42
 * of the {@code Shape}, and retrieve a {@code PathIterator}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    43
 * object that describes the trajectory path of the {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * outline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <p>
8942
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    46
 * <a name="def_insideness"><b>Definition of insideness:</b></a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * A point is considered to lie inside a
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    48
 * {@code Shape} if and only if:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <li> it lies completely
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    51
 * inside the {@code Shape} boundary <i>or</i>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <li>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    53
 * it lies exactly on the {@code Shape} boundary <i>and</i> the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * space immediately adjacent to the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    55
 * point in the increasing {@code X} direction is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * entirely inside the boundary <i>or</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * it lies exactly on a horizontal boundary segment <b>and</b> the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * space immediately adjacent to the point in the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    60
 * increasing {@code Y} direction is inside the boundary.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * </ul>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    62
 * <p>The {@code contains} and {@code intersects} methods
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    63
 * consider the interior of a {@code Shape} to be the area it
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * encloses as if it were filled.  This means that these methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * consider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * unclosed shapes to be implicitly closed for the purpose of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * determining if a shape contains or intersects a rectangle or if a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * shape contains a point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * @see java.awt.geom.PathIterator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * @see java.awt.geom.AffineTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * @see java.awt.geom.FlatteningPathIterator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * @see java.awt.geom.GeneralPath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * @author Jim Graham
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
public interface Shape {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * Returns an integer {@link Rectangle} that completely encloses the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    81
     * {@code Shape}.  Note that there is no guarantee that the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    82
     * returned {@code Rectangle} is the smallest bounding box that
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    83
     * encloses the {@code Shape}, only that the {@code Shape}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    84
     * lies entirely within the indicated  {@code Rectangle}.  The
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    85
     * returned {@code Rectangle} might also fail to completely
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    86
     * enclose the {@code Shape} if the {@code Shape} overflows
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * the limited range of the integer data type.  The
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    88
     * {@code getBounds2D} method generally returns a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * tighter bounding box due to its greater flexibility in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * representation.
8942
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    91
     *
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    92
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    93
     * Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    94
     * definition of insideness</a> can lead to situations where points
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    95
     * on the defining outline of the {@code shape} may not be considered
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    96
     * contained in the returned {@code bounds} object, but only in cases
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    97
     * where those points are also not considered contained in the original
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    98
     * {@code shape}.
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
    99
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   100
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   101
     * If a {@code point} is inside the {@code shape} according to the
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   102
     * {@link #contains(double x, double y) contains(point)} method, then
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   103
     * it must be inside the returned {@code Rectangle} bounds object
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   104
     * according to the {@link #contains(double x, double y) contains(point)}
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   105
     * method of the {@code bounds}. Specifically:
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   106
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   107
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   108
     *  {@code shape.contains(x,y)} requires {@code bounds.contains(x,y)}
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   109
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   110
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   111
     * If a {@code point} is not inside the {@code shape}, then it might
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   112
     * still be contained in the {@code bounds} object:
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   113
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   114
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   115
     *  {@code bounds.contains(x,y)} does not imply {@code shape.contains(x,y)}
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   116
     * </p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   117
     * @return an integer {@code Rectangle} that completely encloses
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   118
     *                 the {@code Shape}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @see #getBounds2D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public Rectangle getBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Returns a high precision and more accurate bounding box of
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   126
     * the {@code Shape} than the {@code getBounds} method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Note that there is no guarantee that the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * {@link Rectangle2D} is the smallest bounding box that encloses
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   129
     * the {@code Shape}, only that the {@code Shape} lies
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   130
     * entirely within the indicated {@code Rectangle2D}.  The
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * bounding box returned by this method is usually tighter than that
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   132
     * returned by the {@code getBounds} method and never fails due
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * to overflow problems since the return value can be an instance of
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   134
     * the {@code Rectangle2D} that uses double precision values to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * store the dimensions.
8942
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   136
     *
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   137
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   138
     * Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   139
     * definition of insideness</a> can lead to situations where points
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   140
     * on the defining outline of the {@code shape} may not be considered
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   141
     * contained in the returned {@code bounds} object, but only in cases
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   142
     * where those points are also not considered contained in the original
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   143
     * {@code shape}.
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   144
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   145
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   146
     * If a {@code point} is inside the {@code shape} according to the
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   147
     * {@link #contains(Point2D p) contains(point)} method, then it must
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   148
     * be inside the returned {@code Rectangle2D} bounds object according
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   149
     * to the {@link #contains(Point2D p) contains(point)} method of the
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   150
     * {@code bounds}. Specifically:
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   151
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   152
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   153
     *  {@code shape.contains(p)} requires {@code bounds.contains(p)}
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   154
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   155
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   156
     * If a {@code point} is not inside the {@code shape}, then it might
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   157
     * still be contained in the {@code bounds} object:
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   158
     * </p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   159
     * <p>
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   160
     *  {@code bounds.contains(p)} does not imply {@code shape.contains(p)}
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   161
     * </p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   162
     * @return an instance of {@code Rectangle2D} that is a
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   163
     *                 high-precision bounding box of the {@code Shape}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @see #getBounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public Rectangle2D getBounds2D();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * Tests if the specified coordinates are inside the boundary of the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   171
     * {@code Shape}, as described by the
8942
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   172
     * <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   173
     * definition of insideness</a>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param x the specified X coordinate to be tested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @param y the specified Y coordinate to be tested
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   176
     * @return {@code true} if the specified coordinates are inside
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   177
     *         the {@code Shape} boundary; {@code false}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *         otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public boolean contains(double x, double y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Tests if a specified {@link Point2D} is inside the boundary
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   185
     * of the {@code Shape}, as described by the
8942
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   186
     * <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
81db50f6cdfc 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec
bae
parents: 5506
diff changeset
   187
     * definition of insideness</a>.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   188
     * @param p the specified {@code Point2D} to be tested
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   189
     * @return {@code true} if the specified {@code Point2D} is
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   190
     *          inside the boundary of the {@code Shape};
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   191
     *          {@code false} otherwise.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public boolean contains(Point2D p);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   197
     * Tests if the interior of the {@code Shape} intersects the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * interior of a specified rectangular area.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   199
     * The rectangular area is considered to intersect the {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * if any point is contained in both the interior of the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   201
     * {@code Shape} and the specified rectangular area.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * The {@code Shape.intersects()} method allows a {@code Shape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * implementation to conservatively return {@code true} when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * there is a high probability that the rectangular area and the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   208
     * {@code Shape} intersect, but
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * the calculations to accurately determine this intersection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * are prohibitively expensive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * This means that for some {@code Shapes} this method might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * return {@code true} even though the rectangular area does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * intersect the {@code Shape}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * The {@link java.awt.geom.Area Area} class performs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * more accurate computations of geometric intersection than most
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * {@code Shape} objects and therefore can be used if a more precise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * answer is required.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @param x the X coordinate of the upper-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *          of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @param y the Y coordinate of the upper-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *          of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @param w the width of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * @param h the height of the specified rectangular area
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   227
     * @return {@code true} if the interior of the {@code Shape} and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *          the interior of the rectangular area intersect, or are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *          both highly likely to intersect and intersection calculations
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   230
     *          would be too expensive to perform; {@code false} otherwise.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @see java.awt.geom.Area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public boolean intersects(double x, double y, double w, double h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   237
     * Tests if the interior of the {@code Shape} intersects the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   238
     * interior of a specified {@code Rectangle2D}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * The {@code Shape.intersects()} method allows a {@code Shape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * implementation to conservatively return {@code true} when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * <li>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   243
     * there is a high probability that the {@code Rectangle2D} and the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   244
     * {@code Shape} intersect, but
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * the calculations to accurately determine this intersection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * are prohibitively expensive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * This means that for some {@code Shapes} this method might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * return {@code true} even though the {@code Rectangle2D} does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * intersect the {@code Shape}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * The {@link java.awt.geom.Area Area} class performs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * more accurate computations of geometric intersection than most
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * {@code Shape} objects and therefore can be used if a more precise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * answer is required.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   257
     * @param r the specified {@code Rectangle2D}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   258
     * @return {@code true} if the interior of the {@code Shape} and
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   259
     *          the interior of the specified {@code Rectangle2D}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *          intersect, or are both highly likely to intersect and intersection
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   261
     *          calculations would be too expensive to perform; {@code false}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *          otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @see #intersects(double, double, double, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    public boolean intersects(Rectangle2D r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   269
     * Tests if the interior of the {@code Shape} entirely contains
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * the specified rectangular area.  All coordinates that lie inside
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   271
     * the rectangular area must lie within the {@code Shape} for the
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 8942
diff changeset
   272
     * entire rectangular area to be considered contained within the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   273
     * {@code Shape}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * The {@code Shape.contains()} method allows a {@code Shape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * implementation to conservatively return {@code false} when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * <li>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   279
     * the {@code intersect} method returns {@code true} and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * the calculations to determine whether or not the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   282
     * {@code Shape} entirely contains the rectangular area are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * prohibitively expensive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * This means that for some {@code Shapes} this method might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * return {@code false} even though the {@code Shape} contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * the rectangular area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * The {@link java.awt.geom.Area Area} class performs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * more accurate geometric computations than most
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * {@code Shape} objects and therefore can be used if a more precise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * answer is required.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @param x the X coordinate of the upper-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *          of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @param y the Y coordinate of the upper-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *          of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @param w the width of the specified rectangular area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @param h the height of the specified rectangular area
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   299
     * @return {@code true} if the interior of the {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     *          entirely contains the specified rectangular area;
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   301
     *          {@code false} otherwise or, if the {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *          contains the rectangular area and the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   303
     *          {@code intersects} method returns {@code true}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *          and the containment calculations would be too expensive to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *          perform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @see java.awt.geom.Area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @see #intersects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    public boolean contains(double x, double y, double w, double h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   313
     * Tests if the interior of the {@code Shape} entirely contains the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   314
     * specified {@code Rectangle2D}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * The {@code Shape.contains()} method allows a {@code Shape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * implementation to conservatively return {@code false} when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * <li>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   319
     * the {@code intersect} method returns {@code true} and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * the calculations to determine whether or not the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   322
     * {@code Shape} entirely contains the {@code Rectangle2D}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * are prohibitively expensive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * This means that for some {@code Shapes} this method might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * return {@code false} even though the {@code Shape} contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * the {@code Rectangle2D}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * The {@link java.awt.geom.Area Area} class performs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * more accurate geometric computations than most
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * {@code Shape} objects and therefore can be used if a more precise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * answer is required.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   333
     * @param r The specified {@code Rectangle2D}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   334
     * @return {@code true} if the interior of the {@code Shape}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   335
     *          entirely contains the {@code Rectangle2D};
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   336
     *          {@code false} otherwise or, if the {@code Shape}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   337
     *          contains the {@code Rectangle2D} and the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   338
     *          {@code intersects} method returns {@code true}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *          and the containment calculations would be too expensive to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *          perform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @see #contains(double, double, double, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public boolean contains(Rectangle2D r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Returns an iterator object that iterates along the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   348
     * {@code Shape} boundary and provides access to the geometry of the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   349
     * {@code Shape} outline.  If an optional {@link AffineTransform}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * is specified, the coordinates returned in the iteration are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * transformed accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * <p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   353
     * Each call to this method returns a fresh {@code PathIterator}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   354
     * object that traverses the geometry of the {@code Shape} object
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   355
     * independently from any other {@code PathIterator} objects in use
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * at the same time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * It is recommended, but not guaranteed, that objects
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   359
     * implementing the {@code Shape} interface isolate iterations
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * that are in process from any changes that might occur to the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * object's geometry during such iterations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   363
     * @param at an optional {@code AffineTransform} to be applied to the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *          coordinates as they are returned in the iteration, or
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   365
     *          {@code null} if untransformed coordinates are desired
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   366
     * @return a new {@code PathIterator} object, which independently
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   367
     *          traverses the geometry of the {@code Shape}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    public PathIterator getPathIterator(AffineTransform at);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   373
     * Returns an iterator object that iterates along the {@code Shape}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * boundary and provides access to a flattened view of the
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   375
     * {@code Shape} outline geometry.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * returned by the iterator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * <p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   380
     * If an optional {@code AffineTransform} is specified,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * the coordinates returned in the iteration are transformed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * The amount of subdivision of the curved segments is controlled
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   385
     * by the {@code flatness} parameter, which specifies the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * maximum distance that any point on the unflattened transformed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * curve can deviate from the returned flattened path segments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * Note that a limit on the accuracy of the flattened path might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * silently imposed, causing very small flattening parameters to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * treated as larger values.  This limit, if there is one, is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * defined by the particular implementation that is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * <p>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   393
     * Each call to this method returns a fresh {@code PathIterator}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   394
     * object that traverses the {@code Shape} object geometry
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   395
     * independently from any other {@code PathIterator} objects in use at
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * the same time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * It is recommended, but not guaranteed, that objects
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   399
     * implementing the {@code Shape} interface isolate iterations
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * that are in process from any changes that might occur to the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * object's geometry during such iterations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   403
     * @param at an optional {@code AffineTransform} to be applied to the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     *          coordinates as they are returned in the iteration, or
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   405
     *          {@code null} if untransformed coordinates are desired
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @param flatness the maximum distance that the line segments used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *          approximate the curved segments are allowed to deviate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *          from any point on the original curve
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   409
     * @return a new {@code PathIterator} that independently traverses
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   410
     *         a flattened view of the geometry of the  {@code Shape}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    public PathIterator getPathIterator(AffineTransform at, double flatness);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
}