shape.html

来自「API資料大全」· HTML 代码 · 共 582 行 · 第 1/2 页

HTML
582
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:32:13 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface  Shape</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Shape.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/awt/PrintGraphics.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/awt/Stroke.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Shape.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.awt</FONT><BR>Interface  Shape</H2><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../java/awt/Polygon.html">Polygon</A>, <A HREF="../../java/awt/geom/RectangularShape.html">RectangularShape</A>, <A HREF="../../java/awt/Rectangle.html">Rectangle</A>, <A HREF="../../java/awt/geom/Area.html">Area</A>, <A HREF="../../java/awt/geom/Line2D.html">Line2D</A>, <A HREF="../../java/awt/geom/GeneralPath.html">GeneralPath</A>, <A HREF="../../java/awt/geom/QuadCurve2D.html">QuadCurve2D</A>, <A HREF="../../java/awt/geom/CubicCurve2D.html">CubicCurve2D</A></DD></DL><HR><DL><DT>public interface <B>Shape</B></DL><P>The <code>Shape</code> interface provides definitions for objects  that represent some form of geometric shape.  The <code>Shape</code> is described by a <A HREF="../../java/awt/geom/PathIterator.html"><CODE>PathIterator</CODE></A> object, which can express the  outline of the <code>Shape</code> as well as a rule for determining  how the outline divides the 2D plane into interior and exterior  points.  Each <code>Shape</code> object provides callbacks to get the  bounding box of the geometry, determine whether points or  rectangles lie partly or entirely within the interior of the <code>Shape</code>, and retrieve a <code>PathIterator</code> object that describes the trajectory path of the <code>Shape</code> outline. <p> <b>Definition of insideness:</b> A point is considered to lie inside a  <code>Shape</code> if and only if: <ul> <li> it lies completely inside the<code>Shape</code> boundary <i>or</i>  <li> it lies exactly on the <code>Shape</code> boundary <i>and</i> the  space immediately adjacent to the point in the increasing <code>X</code> direction is  entirely inside the boundary <i>or</i> <li> it lies exactly on a horizontal boundary segment <b>and</b> the space immediately adjacent to the point in the  increasing <code>Y</code> direction is inside the boundary. </ul><P><DL><DT><B>See Also: </B><DD><A HREF="../../java/awt/geom/PathIterator.html"><CODE>PathIterator</CODE></A>, <A HREF="../../java/awt/geom/AffineTransform.html"><CODE>AffineTransform</CODE></A>, <A HREF="../../java/awt/geom/FlatteningPathIterator.html"><CODE>FlatteningPathIterator</CODE></A>, <A HREF="../../java/awt/geom/GeneralPath.html"><CODE>GeneralPath</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#contains(double, double)">contains</A></B>(double&nbsp;x,         double&nbsp;y)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if the specified coordinates are inside the boundary of the  <code>Shape</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#contains(double, double, double, double)">contains</A></B>(double&nbsp;x,         double&nbsp;y,         double&nbsp;w,         double&nbsp;h)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if the interior of the <code>Shape</code> entirely contains  the specified rectangular area.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#contains(java.awt.geom.Point2D)">contains</A></B>(<A HREF="../../java/awt/geom/Point2D.html">Point2D</A>&nbsp;p)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if a specified <A HREF="../../java/awt/geom/Point2D.html"><CODE>Point2D</CODE></A> is inside the boundary of the <code>Shape</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#contains(java.awt.geom.Rectangle2D)">contains</A></B>(<A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A>&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if the interior of the <code>Shape</code> entirely contains the  specified <code>Rectangle2D</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/Rectangle.html">Rectangle</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#getBounds()">getBounds</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an integer <A HREF="../../java/awt/Rectangle.html"><CODE>Rectangle</CODE></A> that completely encloses the <code>Shape</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#getBounds2D()">getBounds2D</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a high precision and more accurate bounding box of the <code>Shape</code> than the <code>getBounds</code> method.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/geom/PathIterator.html">PathIterator</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../java/awt/geom/AffineTransform.html">AffineTransform</A>&nbsp;at)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the  <code>Shape</code> boundary and provides access to the geometry of the  <code>Shape</code> outline.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/geom/PathIterator.html">PathIterator</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../java/awt/geom/AffineTransform.html">AffineTransform</A>&nbsp;at,                double&nbsp;flatness)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the <code>Shape</code> boundary and provides access to a flattened view of the <code>Shape</code> outline geometry.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#intersects(double, double, double, double)">intersects</A></B>(double&nbsp;x,           double&nbsp;y,           double&nbsp;w,           double&nbsp;h)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if the interior of the <code>Shape</code> intersects the  interior of a specified rectangular area.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Shape.html#intersects(java.awt.geom.Rectangle2D)">intersects</A></B>(<A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A>&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if the interior of the <code>Shape</code> intersects the  interior of a specified <code>Rectangle2D</code>.</TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getBounds()"><!-- --></A><H3>getBounds</H3><PRE>public <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>getBounds</B>()</PRE><DL><DD>Returns an integer <A HREF="../../java/awt/Rectangle.html"><CODE>Rectangle</CODE></A> that completely encloses the <code>Shape</code>.  Note that there is no guarantee that the returned <code>Rectangle</code> is the smallest bounding box that encloses the <code>Shape</code>, only that the <code>Shape</code> lies entirely within the indicated  <code>Rectangle</code>.  The returned <code>Rectangle</code> might also fail to completely enclose the <code>Shape</code> if the <code>Shape</code> overflows the limited range of the integer data type.  The  <code>getBounds2D</code> method generally returns a tighter bounding box due to its greater flexibility in representation.<DD><DL><DT><B>Returns:</B><DD>an integer <code>Rectangle</code> that completely encloses                 the <code>Shape</code>.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Shape.html#getBounds2D()"><CODE>getBounds2D()</CODE></A></DL></DD></DL><HR><A NAME="getBounds2D()"><!-- --></A><H3>getBounds2D</H3><PRE>public <A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A> <B>getBounds2D</B>()</PRE><DL><DD>Returns a high precision and more accurate bounding box of the <code>Shape</code> than the <code>getBounds</code> method. Note that there is no guarantee that the returned  <A HREF="../../java/awt/geom/Rectangle2D.html"><CODE>Rectangle2D</CODE></A> is the smallest bounding box that encloses  the <code>Shape</code>, only that the <code>Shape</code> lies  entirely within the indicated <code>Rectangle2D</code>.  The  bounding box returned by this method is usually tighter than that  returned by the <code>getBounds</code> method and never fails due  to overflow problems since the return value can be an instance of  the <code>Rectangle2D</code> that uses double precision values to  store the dimensions.<DD><DL><DT><B>Returns:</B><DD>an instance of <code>Rectangle2D</code> that is a                 high-precision bounding box of the <code>Shape</code>.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Shape.html#getBounds()"><CODE>getBounds()</CODE></A></DL></DD></DL><HR><A NAME="contains(double, double)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(double&nbsp;x,                        double&nbsp;y)</PRE>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?