affinetransform.html

来自「API資料大全」· HTML 代码 · 共 1,328 行 · 第 1/5 页

HTML
1,328
字号
AffineTransform</H3><PRE>public <B>AffineTransform</B>(double[]&nbsp;flatmatrix)</PRE><DL><DD>Constructs a new <code>AffineTransform</code> from an array of double precision values representing either the 4 non-translation entries or the 6 specifiable entries of the 3x3 transformation matrix. The values are retrieved from the array as  {&nbsp;m00&nbsp;m10&nbsp;m01&nbsp;m11&nbsp;[m02&nbsp;m12]}.<DD><DL><DT><B>Parameters:</B><DD><CODE>flatmatrix</CODE> - the double array containing the values to be set in the new <code>AffineTransform</code> object. The length of the array is assumed to be at least 4. If the length of the array is  less than 6, only the first 4 values are taken. If the length of the array is greater than 6, the first 6 values are taken.</DL></DD></DL><!-- ============ 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="getTranslateInstance(double, double)"><!-- --></A><H3>getTranslateInstance</H3><PRE>public static <A HREF="../../../java/awt/geom/AffineTransform.html">AffineTransform</A> <B>getTranslateInstance</B>(double&nbsp;tx,                                                   double&nbsp;ty)</PRE><DL><DD>Returns a transform representing a translation transformation. The matrix representing the returned transform is: <pre>		[   1    0    tx  ]		[   0    1    ty  ]		[   0    0    1   ] </pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>tx</CODE> - the distance by which coordinates are translated in the X axis direction<DD><CODE>ty</CODE> - the distance by which coordinates are translated in the Y axis direction<DT><B>Returns:</B><DD>an <code>AffineTransform</code> object that represents a 	translation transformation, created with the specified vector.</DL></DD></DL><HR><A NAME="getRotateInstance(double)"><!-- --></A><H3>getRotateInstance</H3><PRE>public static <A HREF="../../../java/awt/geom/AffineTransform.html">AffineTransform</A> <B>getRotateInstance</B>(double&nbsp;theta)</PRE><DL><DD>Returns a transform representing a rotation transformation. The matrix representing the returned transform is: <pre>		[   cos(theta)    -sin(theta)    0   ]		[   sin(theta)     cos(theta)    0   ]		[       0              0         1   ] </pre> Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>theta</CODE> - the angle of rotation in radians<DT><B>Returns:</B><DD>an <code>AffineTransform</code> object that is a rotation	transformation, created with the specified angle of rotation.</DL></DD></DL><HR><A NAME="getRotateInstance(double, double, double)"><!-- --></A><H3>getRotateInstance</H3><PRE>public static <A HREF="../../../java/awt/geom/AffineTransform.html">AffineTransform</A> <B>getRotateInstance</B>(double&nbsp;theta,                                                double&nbsp;x,                                                double&nbsp;y)</PRE><DL><DD>Returns a transform that rotates coordinates around an anchor point. This operation is equivalent to translating the coordinates so that the anchor point is at the origin (S1), then rotating them about the new origin (S2), and finally translating so that the intermediate origin is restored to the coordinates of the original anchor point (S3). <p> This operation is equivalent to the following sequence of calls: <pre>	    AffineTransform Tx = new AffineTransform();	    Tx.setToTranslation(x, y);	// S3: final translation	    Tx.rotate(theta);		// S2: rotate around anchor	    Tx.translate(-x, -y);	// S1: translate anchor to origin </pre> The matrix representing the returned transform is: <pre>		[   cos(theta)    -sin(theta)    x-x*cos+y*sin  ]		[   sin(theta)     cos(theta)    y-x*sin-y*cos  ]		[       0              0               1        ] </pre> Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>theta</CODE> - the angle of rotation in radians<DD><CODE>x,&nbsp;y</CODE> - the coordinates of the anchor point of the rotation<DT><B>Returns:</B><DD>an <code>AffineTransform</code> object that rotates 	coordinates around the specified point by the specified angle of	rotation.</DL></DD></DL><HR><A NAME="getScaleInstance(double, double)"><!-- --></A><H3>getScaleInstance</H3><PRE>public static <A HREF="../../../java/awt/geom/AffineTransform.html">AffineTransform</A> <B>getScaleInstance</B>(double&nbsp;sx,                                               double&nbsp;sy)</PRE><DL><DD>Returns a transform representing a scaling transformation. The matrix representing the returned transform is: <pre>		[   sx   0    0   ]		[   0    sy   0   ]		[   0    0    1   ] </pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>sx</CODE> - the factor by which coordinates are scaled along the X axis direction<DD><CODE>sy</CODE> - the factor by which coordinates are scaled along the Y axis direction<DT><B>Returns:</B><DD>an <code>AffineTransform</code> object that scales 	coordinates by the specified factors.</DL></DD></DL><HR><A NAME="getShearInstance(double, double)"><!-- --></A><H3>getShearInstance</H3><PRE>public static <A HREF="../../../java/awt/geom/AffineTransform.html">AffineTransform</A> <B>getShearInstance</B>(double&nbsp;shx,                                               double&nbsp;shy)</PRE><DL><DD>Returns a transform representing a shearing transformation. The matrix representing the returned transform is: <pre>		[   1   shx   0   ]		[  shy   1    0   ]		[   0    0    1   ] </pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>shx</CODE> - the multiplier by which coordinates are shifted in the direction of the positive X axis as a factor of their Y coordinate<DD><CODE>shy</CODE> - the multiplier by which coordinates are shifted in the direction of the positive Y axis as a factor of their X coordinate<DT><B>Returns:</B><DD>an <code>AffineTransform</code> object that shears 	coordinates by the specified multipliers.</DL></DD></DL><HR><A NAME="getType()"><!-- --></A><H3>getType</H3><PRE>public int <B>getType</B>()</PRE><DL><DD>Retrieves the flag bits describing the conversion properties of this transform. The return value is either one of the constants TYPE_IDENTITY or TYPE_GENERAL_TRANSFORM, or a combination of the appriopriate flag bits. A valid combination of flag bits is an exclusive OR operation that can combine the TYPE_TRANSLATION flag bit in addition to either of the TYPE_UNIFORM_SCALE or TYPE_GENERAL_SCALE flag bits as well as either of the TYPE_QUADRANT_ROTATION or TYPE_GENERAL_ROTATION flag bits.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the OR combination of any of the indicated flags that apply to this transform<DT><B>See Also: </B><DD><A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_IDENTITY"><CODE>TYPE_IDENTITY</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_TRANSLATION"><CODE>TYPE_TRANSLATION</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_UNIFORM_SCALE"><CODE>TYPE_UNIFORM_SCALE</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_GENERAL_SCALE"><CODE>TYPE_GENERAL_SCALE</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_QUADRANT_ROTATION"><CODE>TYPE_QUADRANT_ROTATION</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_GENERAL_ROTATION"><CODE>TYPE_GENERAL_ROTATION</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_GENERAL_TRANSFORM"><CODE>TYPE_GENERAL_TRANSFORM</CODE></A></DL></DD></DL><HR><A NAME="getDeterminant()"><!-- --></A><H3>getDeterminant</H3><PRE>public double <B>getDeterminant</B>()</PRE><DL><DD>Returns the determinant of the matrix representation of the transform. The determinant is useful both to determine if the transform can be inverted and to get a single value representing the combined X and Y scaling of the transform. <p> If the determinant is non-zero, then this transform is invertible and the various methods that depend on the inverse transform do not need to throw a <A HREF="../../../java/awt/geom/NoninvertibleTransformException.html"><CODE>NoninvertibleTransformException</CODE></A>. If the determinant is zero then this transform can not be inverted since the transform maps all input coordinates onto a line or a point. If the determinant is near enough to zero then inverse transform operations might not carry enough precision to produce meaningful results. <p> If this transform represents a uniform scale, as indicated by the <code>getType</code> method then the determinant also represents the square of the uniform scale factor by which all of the points are expanded from or contracted towards the origin. If this transform represents a non-uniform scale or more general transform then the determinant is not likely to represent a value useful for any purpose other than determining if inverse transforms are possible. <p> Mathematically, the determinant is calculated using the formula: <pre>		|  m00  m01  m02  |		|  m10  m11  m12  |  =  m00 * m11 - m01 * m10		|   0    0    1   | </pre><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the determinant of the matrix used to transform the coordinates.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/geom/AffineTransform.html#getType()"><CODE>getType()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#createInverse()"><CODE>createInverse()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#inverseTransform(java.awt.geom.Point2D, java.awt.geom.Point2D)"><CODE>inverseTransform(java.awt.geom.Point2D, java.awt.geom.Point2D)</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#TYPE_UNIFORM_SCALE"><CODE>TYPE_UNIFORM_SCALE</CODE></A></DL></DD></DL><HR><A NAME="getMatrix(double[])"><!-- --></A><H3>getMatrix</H3><PRE>public void <B>getMatrix</B>(double[]&nbsp;flatmatrix)</PRE><DL><DD>Retrieves the 6 specifiable values in the 3x3 affine transformation matrix and places them into an array of double precisions values. The values are stored in the array as  {&nbsp;m00&nbsp;m10&nbsp;m01&nbsp;m11&nbsp;m02&nbsp;m12&nbsp;}. An array of 4 doubles can also be specified, in which case only the first four elements representing the non-transform parts of the array are retrieved and the values are stored into  the array as {&nbsp;m00&nbsp;m10&nbsp;m01&nbsp;m11&nbsp;}<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>flatmatrix</CODE> - the double array used to store the returned values.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/geom/AffineTransform.html#getScaleX()"><CODE>getScaleX()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#getScaleY()"><CODE>getScaleY()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#getShearX()"><CODE>getShearX()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#getShearY()"><CODE>getShearY()</CODE></A>, <A HREF="../../../java/awt/geom/AffineTransform.html#getTranslateX()"><CODE>getTranslateX()</CODE>

⌨️ 快捷键说明

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