| 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.geom.AffineTransform
public class AffineTransform
AffineTransform 类表示 2D 仿射变换,它执行从 2D 坐标到其他 2D 坐标的线性映射,保留了线的“直线性”和“平行性”。可以使用一系列平移、缩放、翻转、旋转和剪切来构造仿射变换。
 
这样的坐标变换可以使用一个 3 行乘 3 列的矩阵来表示,最后一行默认为 [ 0 0 1 ]。此矩阵将源坐标 (x, y) 变换为目标坐标 (x', y'),方法是将坐标视为列向量,并用矩阵乘以坐标向量,步骤如下:
 
        [ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
        [ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
        [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
 
| 字段摘要 | |
|---|---|
static int | 
TYPE_FLIP
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还执行关于某个坐标轴的镜像翻转操作,此操作将常见的右旋坐标系更改为左旋坐标系。  | 
static int | 
TYPE_GENERAL_ROTATION
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还执行任意角度的旋转操作。  | 
static int | 
TYPE_GENERAL_SCALE
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还执行常规缩放操作。  | 
static int | 
TYPE_GENERAL_TRANSFORM
此常量指示此对象定义的变换执行输入坐标的任意转换操作。  | 
static int | 
TYPE_IDENTITY
此常量指示此对象定义的变换是恒等变换。  | 
static int | 
TYPE_MASK_ROTATION
此常量是所有旋转标志位的位掩码。  | 
static int | 
TYPE_MASK_SCALE
此常量是所有缩放标志位的位掩码。  | 
static int | 
TYPE_QUADRANT_ROTATION
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还通过乘以 90 度的某个倍数执行象限旋转操作。  | 
static int | 
TYPE_TRANSLATION
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还执行平移操作。  | 
static int | 
TYPE_UNIFORM_SCALE
此标志位指示此对象定义的变换除了执行其他标志位指定的变换外,还执行统一缩放操作。  | 
| 构造方法摘要 | |
|---|---|
AffineTransform()
构造一个表示 Identity 变换的新 AffineTransform。 | 
|
AffineTransform(AffineTransform Tx)
构造一个新 AffineTransform,让它作为指定的 AffineTransform 对象的副本。 | 
|
AffineTransform(double[] flatmatrix)
根据 double 精度值数组构造一个新 AffineTransform,该数组要么表示 3x3 变换矩阵的 4 非平移条目,要么表示它的 6 可指定条目。 | 
|
AffineTransform(double m00,
                double m10,
                double m01,
                double m11,
                double m02,
                double m12)
根据表示 3x3 变换矩阵 6 个可指定条目的 6 个 double 精度值构造一个新 AffineTransform。 | 
|
AffineTransform(float[] flatmatrix)
根据一个浮点值数组构造一个新 AffineTransform,该数组要么表示 3x3 变换矩阵的 4 个非平移条目,要么表示其 6 个可指定条目。 | 
|
AffineTransform(float m00,
                float m10,
                float m01,
                float m11,
                float m02,
                float m12)
根据表示 6 个 3x3 变换矩阵可指定条目的 6 个浮点值构造一个新 AffineTransform。 | 
|
| 方法摘要 | |
|---|---|
 Object | 
clone()
返回此 AffineTransform 对象的副本。 | 
 void | 
concatenate(AffineTransform Tx)
以最常用的方式将 AffineTransform Tx 连接到此 AffineTransform Cx,以提供由 Tx 映射到以前用户空间的新用户空间。 | 
 AffineTransform | 
createInverse()
返回表示逆向变换的 AffineTransform 对象。 | 
 Shape | 
createTransformedShape(Shape pSrc)
返回新的 Shape 对象,它由此变换变换的指定 Shape 的几何形状定义。 | 
 void | 
deltaTransform(double[] srcPts,
               int srcOff,
               double[] dstPts,
               int dstOff,
               int numPts)
通过此变换变换相对距离向量数组。  | 
 Point2D | 
deltaTransform(Point2D ptSrc,
               Point2D ptDst)
变换由 ptSrc 指定的相对距离向量并将结果存储在 ptDst。 | 
 boolean | 
equals(Object obj)
如果此 AffineTransform 与指定的参数表示相同的仿射坐标变换,则返回 true。 | 
 double | 
getDeterminant()
返回变换的矩阵表示形式的决定因子。  | 
 void | 
getMatrix(double[] flatmatrix)
在 3x3 仿射变换矩阵中检索 6 个可指定值,并将其置于 double 精度值的数组中。  | 
static AffineTransform | 
getRotateInstance(double theta)
返回表示旋转变换的变换。  | 
static AffineTransform | 
getRotateInstance(double theta,
                  double x,
                  double y)
返回绕锚点旋转坐标的变换。  | 
static AffineTransform | 
getScaleInstance(double sx,
                 double sy)
返回表示缩放变换的变换。  | 
 double | 
getScaleX()
返回 3x3 仿射变换矩阵缩放元素 (m00) 的 X 坐标。  | 
 double | 
getScaleY()
返回 3x3 仿射变换矩阵缩放元素 (m11) 的 Y 坐标。  | 
static AffineTransform | 
getShearInstance(double shx,
                 double shy)
返回表示剪切变换的变换。  | 
 double | 
getShearX()
返回 3x3 仿射变换矩阵剪切元素 (m01) 的 X 坐标。  | 
 double | 
getShearY()
返回 3x3 仿射变换矩阵剪切元素 (m10) 的 Y 坐标。  | 
static AffineTransform | 
getTranslateInstance(double tx,
                     double ty)
返回表示平移变换的变换。  | 
 double | 
getTranslateX()
返回 3x3 仿射变换矩阵平移元素 (m02) 的 X 坐标。  | 
 double | 
getTranslateY()
返回 3x3 仿射变换矩阵平移元素 (m12) 的 Y 坐标。  | 
 int | 
getType()
检索描述此变换的转换属性的标志位。  | 
 int | 
hashCode()
返回此变换的哈希码。  | 
 void | 
inverseTransform(double[] srcPts,
                 int srcOff,
                 double[] dstPts,
                 int dstOff,
                 int numPts)
通过此变换逆向变换 double 精度坐标数组。  | 
 Point2D | 
inverseTransform(Point2D ptSrc,
                 Point2D ptDst)
逆向变换指定的 ptSrc 并将结果存储在 ptDst 中。 | 
 boolean | 
isIdentity()
如果此 AffineTransform 是恒等变换,则返回 true。 | 
 void | 
preConcatenate(AffineTransform Tx)
以不常用的方式将 AffineTransform Tx 连接到此 AffineTransform Cx,从而 Tx 相对于绝对像素空间(而非相对于现有用户空间)修改坐标变换。 | 
 void | 
rotate(double theta)
连接此变换与旋转变换。  | 
 void | 
rotate(double theta,
       double x,
       double y)
连接此变换与绕锚点旋转坐标的变换。  | 
 void | 
scale(double sx,
      double sy)
连接此变换与缩放变换。  | 
 void | 
setToIdentity()
将此变换重置为 Identity 变换。  | 
 void | 
setToRotation(double theta)
将此变换设置为旋转变换。  | 
 void | 
setToRotation(double theta,
              double x,
              double y)
将此变换设置为平移的旋转变换。  | 
 void | 
setToScale(double sx,
           double sy)
将此变换设置为缩放变换。  | 
 void | 
setToShear(double shx,
           double shy)
将此变换设置为剪切变换。  | 
 void | 
setToTranslation(double tx,
                 double ty)
将此变换设置为平移变换。  | 
 void | 
setTransform(AffineTransform Tx)
将此变换设置为指定 AffineTransform 对象中变换的副本。 | 
 void | 
setTransform(double m00,
             double m10,
             double m01,
             double m11,
             double m02,
             double m12)
将此变换设置为 6 个 double 精度值指定的矩阵。  | 
 void | 
shear(double shx,
      double shy)
连接此变换与剪切变换。  | 
 String | 
toString()
返回表示此 Object 值的 String。 | 
 void | 
transform(double[] srcPts,
          int srcOff,
          double[] dstPts,
          int dstOff,
          int numPts)
通过此变换变换 double 精度坐标数组。  | 
 void | 
transform(double[] srcPts,
          int srcOff,
          float[] dstPts,
          int dstOff,
          int numPts)
通过此变换变换 double 精度坐标数组并将结果存储在 float 数组中。  | 
 void | 
transform(float[] srcPts,
          int srcOff,
          double[] dstPts,
          int dstOff,
          int numPts)
通过此变换变换浮点坐标数组并将结果存储在 double 数组中。  | 
 void | 
transform(float[] srcPts,
          int srcOff,
          float[] dstPts,
          int dstOff,
          int numPts)
通过此变换变换浮点坐标数组。  | 
 void | 
transform(Point2D[] ptSrc,
          int srcOff,
          Point2D[] ptDst,
          int dstOff,
          int numPts)
通过此变换变换点对象数组。  | 
 Point2D | 
transform(Point2D ptSrc,
          Point2D ptDst)
变换指定的 ptSrc 并将结果存储在 ptDst 中。 | 
 void | 
translate(double tx,
          double ty)
连接此变换与平移变换。  | 
| 从类 java.lang.Object 继承的方法 | 
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait | 
| 字段详细信息 | 
|---|
public static final int TYPE_IDENTITY
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_TRANSLATION
TYPE_IDENTITY, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_UNIFORM_SCALE
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_GENERAL_SCALE
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_MASK_SCALE
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
常量字段值public static final int TYPE_FLIP
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_QUADRANT_ROTATION
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_GENERAL_ROTATION
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_TRANSFORM, 
getType(), 
常量字段值public static final int TYPE_MASK_ROTATION
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
常量字段值public static final int TYPE_GENERAL_TRANSFORM
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_FLIP, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
getType(), 
常量字段值| 构造方法详细信息 | 
|---|
public AffineTransform()
AffineTransform。
public AffineTransform(AffineTransform Tx)
AffineTransform,让它作为指定的 AffineTransform 对象的副本。
Tx - 要复制的 AffineTransform 对象
public AffineTransform(float m00,
                       float m10,
                       float m01,
                       float m11,
                       float m02,
                       float m12)
AffineTransform。
m00, m01, m02, m10, m11, m12 - 组成 3x3 变换矩阵的 6 个浮点值public AffineTransform(float[] flatmatrix)
AffineTransform,该数组要么表示 3x3 变换矩阵的 4 个非平移条目,要么表示其 6 个可指定条目。从该数组中检索到的值为 { m00 m10 m01 m11 [m02 m12]}。
flatmatrix - 包含要在新 AffineTransform 对象中设置的值的 float 数组。假定数组的长度至少为 4。如果数组的长度小于 6,则仅采用前 4 个值。如果数组的长度大于 6,则采用前 6 个值。
public AffineTransform(double m00,
                       double m10,
                       double m01,
                       double m11,
                       double m02,
                       double m12)
AffineTransform。
m00, m01, m02, m10, m11, m12 - 组成 3x3 变换矩阵的 6 个浮点值public AffineTransform(double[] flatmatrix)
AffineTransform,该数组要么表示 3x3 变换矩阵的 4 非平移条目,要么表示它的 6 可指定条目。从该数组中检索到的值为 { m00 m10 m01 m11 [m02 m12]}。
flatmatrix - 包含要在新 AffineTransform 对象中设置的值的 double 数组。假定数组的长度至少为 4。如果数组的长度小于 6,则仅采用前 4 个值。如果数组的长度大于 6,则采用前 6 个值。| 方法详细信息 | 
|---|
public static AffineTransform getTranslateInstance(double tx,
                                                   double ty)
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
tx - 坐标在 X 轴方向上平移的距离ty - 坐标在 Y 轴方向上平移的距离
AffineTransform 对象,该对象是利用指定向量创建的。public static AffineTransform getRotateInstance(double theta)
                [   cos(theta)    -sin(theta)    0   ]
                [   sin(theta)     cos(theta)    0   ]
                [       0              0         1   ]
 
使用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度
AffineTransform 对象。
public static AffineTransform getRotateInstance(double theta,
                                                double x,
                                                double y)
此操作等效于以下调用序列:
            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
 
表示返回变换的矩阵是:
 
                [   cos(theta)    -sin(theta)    x-x*cos+y*sin  ]
                [   sin(theta)     cos(theta)    y-x*sin-y*cos  ]
                [       0              0               1        ]
 
用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度x, y - 旋转的锚点坐标
AffineTransform 对象。
public static AffineTransform getScaleInstance(double sx,
                                               double sy)
                [   sx   0    0   ]
                [   0    sy   0   ]
                [   0    0    1   ]
 
sx - 坐标沿 X 轴方向缩放的因子sy - 坐标沿 Y 轴方向缩放的因子
AffineTransform 对象。
public static AffineTransform getShearInstance(double shx,
                                               double shy)
                [   1   shx   0   ]
                [  shy   1    0   ]
                [   0    0    1   ]
 
shx - 坐标在 X 正半轴方向上进行位移的乘数,与其 Y 坐标的因子一样shy - 坐标在 Y 正半轴方向上进行位移的乘数,与其 X 坐标的因子一样
AffineTransform 对象。public int getType()
TYPE_IDENTITY, 
TYPE_TRANSLATION, 
TYPE_UNIFORM_SCALE, 
TYPE_GENERAL_SCALE, 
TYPE_QUADRANT_ROTATION, 
TYPE_GENERAL_ROTATION, 
TYPE_GENERAL_TRANSFORMpublic double getDeterminant()
如果决定因子为非零,则此变换是可逆的,依赖于此逆向变换的各种方法均无需抛出 NoninvertibleTransformException。如果决定因子为零,则此变换是不可逆的,因为变换将所有输入坐标映射到线或点上。如果决定因子很接近零,则生成有意义结果的逆向变换操作可能不够精确。
 
如果 getType 方法指示此变换表示统一缩放,则决定因子还表示所有点都用于从原点展开或向原点收缩的统一缩放因子的平方。如果此变换表示非统一缩放或较普遍的变换,则决定因子只表示确定逆向变换是否可能,而不表示除此之外任何有用值。
 
在数学上,使用以下公式计算决定因子:
                |  m00  m01  m02  |
                |  m10  m11  m12  |  =  m00 * m11 - m01 * m10
                |   0    0    1   |
 
getType(), 
createInverse(), 
inverseTransform(java.awt.geom.Point2D, java.awt.geom.Point2D), 
TYPE_UNIFORM_SCALEpublic void getMatrix(double[] flatmatrix)
flatmatrix - 用于存储返回值的 double 数组。getScaleX(), 
getScaleY(), 
getShearX(), 
getShearY(), 
getTranslateX(), 
getTranslateY()public double getScaleX()
getMatrix(double[])public double getScaleY()
getMatrix(double[])public double getShearX()
getMatrix(double[])public double getShearY()
getMatrix(double[])public double getTranslateX()
getMatrix(double[])public double getTranslateY()
getMatrix(double[])
public void translate(double tx,
                      double ty)
AffineTransform,由以下矩阵表示:
 
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
tx - 坐标在 X 轴方向上平移的距离ty - 坐标在 Y 轴方向上平移的距离public void rotate(double theta)
AffineTransform,由以下矩阵表示:
 
                [   cos(theta)    -sin(theta)    0   ]
                [   sin(theta)     cos(theta)    0   ]
                [       0              0         1   ]
 
使用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度
public void rotate(double theta,
                   double x,
                   double y)
此操作等效于以下调用序列:
                translate(x, y);        // S3: final translation
                rotate(theta);          // S2: rotate around anchor
                translate(-x, -y);      // S1: translate anchor to origin
 
使用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度x, y - 旋转的锚点坐标
public void scale(double sx,
                  double sy)
AffineTransform,由以下矩阵表示:
 
                [   sx   0    0   ]
                [   0    sy   0   ]
                [   0    0    1   ]
 
sx - 坐标沿 X 轴方向缩放的因子sy - 坐标沿 Y 轴方向缩放的因子
public void shear(double shx,
                  double shy)
AffineTransform,由以下矩阵表示:
 
                [   1   shx   0   ]
                [  shy   1    0   ]
                [   0    0    1   ]
 
shx - 坐标在 X 正半轴方向上进行位移的乘数,与其 Y 坐标的因子一样shy - 坐标在 Y 正半轴方向上进行位移的乘数,与其 X 坐标的因子一样public void setToIdentity()
public void setToTranslation(double tx,
                             double ty)
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
tx - 坐标在 X 轴方向上平移的距离ty - 坐标在 Y 轴方向上平移的距离public void setToRotation(double theta)
                [   cos(theta)    -sin(theta)    0   ]
                [   sin(theta)     cos(theta)    0   ]
                [       0              0         1   ]
 
使用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度
public void setToRotation(double theta,
                          double x,
                          double y)
此操作等效于以下调用序列:
            setToTranslation(x, y);     // S3: final translation
            rotate(theta);              // S2: rotate around anchor
            translate(-x, -y);          // S1: translate anchor to origin
 
表示此变换的矩阵将变成:
 
                [   cos(theta)    -sin(theta)    x-x*cos+y*sin  ]
                [   sin(theta)     cos(theta)    y-x*sin-y*cos  ]
                [       0              0               1        ]
 
使用正角度 theta 进行的旋转将 X 正半轴上的点向 Y 正半轴旋转。
theta - 用弧度表示的旋转角度x, y - 旋转的锚点坐标
public void setToScale(double sx,
                       double sy)
                [   sx   0    0   ]
                [   0    sy   0   ]
                [   0    0    1   ]
 
sx - 坐标沿 X 轴方向缩放的因子sy - 坐标沿 Y 轴方向缩放的因子
public void setToShear(double shx,
                       double shy)
                [   1   shx   0   ]
                [  shy   1    0   ]
                [   0    0    1   ]
 
shx - 坐标在正 X 轴方向上进行位移的乘数,与其 Y 坐标的因子一样shy - 坐标在正 Y 轴方向上进行位移的乘数,与其 X 坐标的因子一样public void setTransform(AffineTransform Tx)
AffineTransform 对象中变换的副本。
Tx - 从中复制变换的 AffineTransform 对象
public void setTransform(double m00,
                         double m10,
                         double m01,
                         double m11,
                         double m02,
                         double m12)
m00, m01, m02, m10, m11, m12 - 组成 3x3 变换矩阵的 6 个浮点值public void concatenate(AffineTransform Tx)
AffineTransform Tx 连接到此 AffineTransform Cx,以提供由 Tx 映射到以前用户空间的新用户空间。更新 Cx 以执行组合变换。通过更新变换 Cx' 变换点 p 等效于首先通过 Tx 变换 p,然后通过初始变换 Cx 变换所得结果,如下所示:Cx'(p) = Cx(Tx(p))。在矩阵符号中,如果此变换 Cx 由矩阵 [this] 表示,Tx 由矩阵 [Tx] 表示,则此方法执行以下操作:
 
                [this] = [this] x [Tx]
 
Tx - 要与此 AffineTransform 对象相连接的 AffineTransform 对象。preConcatenate(java.awt.geom.AffineTransform)public void preConcatenate(AffineTransform Tx)
AffineTransform Tx 连接到此 AffineTransform Cx,从而 Tx 相对于绝对像素空间(而非相对于现有用户空间)修改坐标变换。更新 Cx 以执行组合变换。通过更新变换 Cx' 变换点 p 等效于首先通过初始变换 Cx 变换 p,然后通过 Tx 变换所得结果,如下所示:Cx'(p) = Tx(Cx(p))。在矩阵符号中,如果此变换 Cx 由矩阵 [this] 表示并且 Tx 由矩阵 [Tx] 表示,则此方法执行以下操作:
 
                [this] = [Tx] x [this]
 
Tx - 要与此 AffineTransform 对象相连接的 AffineTransform 对象。concatenate(java.awt.geom.AffineTransform)
public AffineTransform createInverse()
                              throws NoninvertibleTransformException
AffineTransform 对象。此变换 Tx 的逆向变换 Tx' 将由 Tx 变换的坐标映射回其初始坐标。换句话说,Tx'(Tx(p)) = p = Tx(Tx'(p))。
 
如果此变换将所有坐标映射到点或线上,那么它将不能进行逆向变换,因为不依赖于目标点或线的坐标没有逆向映射。getDeterminant 方法可用于确定是否此变换不可逆,若不可逆,则调用 createInverse 方法时将抛出异常。
AffineTransform 对象。
NoninvertibleTransformException - 如果矩阵不可逆。getDeterminant()
public Point2D transform(Point2D ptSrc,
                         Point2D ptDst)
ptSrc 并将结果存储在 ptDst 中。如果 ptDst 为 null,则分配一个新的 Point2D 对象,然后将变换的结果存储在此对象中。在任何一种情况下,为方便起见,都将返回包含变换点的 ptDst。如果 ptSrc 和 ptDst 是同一个对象,则用变换点正确地改写输入点。
ptSrc - 要变换的指定 Point2DptDst - 存储变换 ptSrc 结果的指定 Point2D
ptSrc 后的 ptDst,结果已被存储在 ptDst 中。
public void transform(Point2D[] ptSrc,
                      int srcOff,
                      Point2D[] ptDst,
                      int dstOff,
                      int numPts)
ptDst 数组的任何元素为 null,那么在存储变换结果前将在该元素中分配并存储新的 Point2D 对象。
 
注意,此方法没有针对如何避免将结果存储到 Point2D 对象(这些对象将用作源数组后面某些计算的源)时产生的问题采取任何预防措施。此方法可保证,如果指定的 Point2D 对象是同一个单点变换操作的源和目标,则在计算完成之前不存储结果,从而避免将结果存储在该操作数上。但是,如果一个操作的目标 Point2D 对象与源数组后面的另一个操作的源 Point2D 对象相同,那么在转换该点初始坐标之前,这些坐标都将被改写。
ptSrc - 包含源点对象的数组ptDst - 在其中返回变换点对象的数组srcOff - 源数组中要变换的第一个点对象的偏移量dstOff - 目标数组中存储的第一个变换点对象的位置的偏移量numPts - 要变换的点对象数
public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
[x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源点坐标的数组。每个点都存储为一对 x、y 坐标。dstPts - 在其中返回变换点坐标的数组。每个点都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个点的偏移量dstOff - 目标数组中存储的第一个变换点的位置的偏移量numPts - 要变换的点数
public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
[x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源点坐标的数组。每个点都存储为一对 x、y 坐标。dstPts - 在其中返回变换点坐标的数组。每个点都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个点的偏移量dstOff - 目标数组中存储的第一个变换点位置的偏移量numPts - 要变换的点对象数
public void transform(float[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
[x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源点坐标的数组。每个点都存储为一对 x、y 坐标。dstPts - 在其中返回变换点坐标的数组。每个点都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个点的偏移量dstOff - 目标数组中存储的第一个变换点位置的偏移量numPts - 要变换的点数
public void transform(double[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
[x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源点坐标的数组。每个点都存储为一对 x、y 坐标。dstPts - 在其中返回变换点坐标的数组。每个点都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个点的偏移量dstOff - 目标数组中存储的第一个变换点位置的偏移量numPts - 要变换的点对象数
public Point2D inverseTransform(Point2D ptSrc,
                                Point2D ptDst)
                         throws NoninvertibleTransformException
ptSrc 并将结果存储在 ptDst 中。如果 ptDst 为 null,则分配一个新的 Point2D 对象,然后将变换的结果存储在此对象中。在任何一种情况下,为方便起见,都将返回包含变换点的 ptDst。如果 ptSrc 和 ptDst 是同一个对象,则变换点将正确地改写输入点。
ptSrc - 要逆向变换的点ptDst - 得到的变换点
ptDst,它包含逆向变换的结果。
NoninvertibleTransformException - 如果矩阵不可逆。
public void inverseTransform(double[] srcPts,
                             int srcOff,
                             double[] dstPts,
                             int dstOff,
                             int numPts)
                      throws NoninvertibleTransformException
[x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源点坐标的数组。每个点都存储为一对 x、y 坐标。dstPts - 在其中返回变换点坐标的数组。每个点都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个点的偏移量dstOff - 目标数组中存储的第一个变换点位置的偏移量numPts - 要变换的点对象数
NoninvertibleTransformException - 如果矩阵不可逆。
public Point2D deltaTransform(Point2D ptSrc,
                              Point2D ptDst)
ptSrc 指定的相对距离向量并将结果存储在 ptDst。使用以下方程式变换相对距离向量,不应用仿射变换矩阵的平移分量:
 
        [  x' ]   [  m00  m01 (m02) ] [  x  ]   [ m00x + m01y ]
        [  y' ] = [  m10  m11 (m12) ] [  y  ] = [ m10x + m11y ]
        [ (1) ]   [  (0)  (0) ( 1 ) ] [ (1) ]   [     (1)     ]
 
如果 ptDst 为 null,则分配一个新的 Point2D 对象,然后将变换的结果存储在此对象中。在任何一种情况下,为方便起见,都将返回包含变换点的 ptDst。如果 ptSrc 和 ptDst 是同一个对象,则变换点将正确地改写输入点。
ptSrc - 要进行 delta 变换的距离向量ptDst - 得到的变换距离向量
ptDst,它包含变换的结果。
public void deltaTransform(double[] srcPts,
                           int srcOff,
                           double[] dstPts,
                           int dstOff,
                           int numPts)
        [  x' ]   [  m00  m01 (m02) ] [  x  ]   [ m00x + m01y ]
        [  y' ] = [  m10  m11 (m12) ] [  y  ] = [ m10x + m11y ]
        [ (1) ]   [  (0)  (0) ( 1 ) ] [ (1) ]   [     (1)     ]
 
两个坐标数组部分可以完全相同,也可以是同一数组的重叠部分,这对结果的有效性都没有影响。此方法可确保在变换源坐标之前,它们不会被以前的操作改写。这些坐标从指示偏移量开始按照 [x0, y0, x1, y1, ..., xn, yn] 的顺序存储在数组中。
srcPts - 包含源距离向量的数组。每个向量都存储为一对 x、y 坐标。dstPts - 在其中返回变换距离向量的数组。每个向量都存储为一对 x、y 坐标。srcOff - 源数组中要变换的第一个向量的偏移量dstOff - 目标数组中存储的第一个变换向量位置的偏移量numPts - 要变换的向量坐标对的数量public Shape createTransformedShape(Shape pSrc)
Shape 对象,它由此变换变换的指定 Shape 的几何形状定义。
pSrc - 要由此变换变换的指定 Shape 对象。
Shape 的几何形状所定义的新 Shape 对象。public String toString()
Object 值的 String。
Object 中的 toStringObject 值的 String。public boolean isIdentity()
AffineTransform 是恒等变换,则返回 true。
AffineTransform 是恒等变换,则返回 true;否则返回 false。public Object clone()
AffineTransform 对象的副本。
Object 中的 cloneAffineTransform 对象副本的 Object。Cloneablepublic int hashCode()
Object 中的 hashCodeObject.equals(java.lang.Object), 
Hashtablepublic boolean equals(Object obj)
AffineTransform 与指定的参数表示相同的仿射坐标变换,则返回 true。
Object 中的 equalsobj - 要测试与此 AffineTransform 相等性的 Object
obj 等于此 AffineTransform 对象,则返回 true;否则返回 false。Object.hashCode(), 
Hashtable
  | 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。