哪位用过 Matrix的 setPolyToPoly (float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)方法做过图形变换 ? 参数如何设置 
在apiDemo中有从图形1到图形4的变化,可还是没搞懂它是怎么设置参数的。

解决方案 »

  1.   

    public boolean setPolyToPoly (float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)
    Since: API Level 1Set the matrix such that the specified src points would map to the specified dst points. The "points" are represented as an array of floats, order [x0, y0, x1, y1, ...], where each "point" is 2 float values.
    Parameters
    src  The array of src [x,y] pairs (points)
    srcIndex  Index of the first pair of src values
    dst  The array of dst [x,y] pairs (points)
    dstIndex  Index of the first pair of dst values
    pointCount  The number of pairs/points to be used. Must be [0..4]
    Returns    true if the matrix was set to the specified transformation Hope this could give you some help
      

  2.   

    This is a examplepublic void testSetPolyToPoly() {
        507         float[] src = new float[9];
        508         src[0] = 100f;
        509         float[] dst = new float[9];
        510         dst[0] = 200f;
        511         dst[1] = 300f;
        512         assertTrue(mMatrix.setPolyToPoly(src, 0, dst, 0, 1));
        513         String expect = "[1.0, 0.0, 100.0][0.0, 1.0, 300.0][0.0, 0.0, 1.0]";
        514         assertEquals(expect, mMatrix.toShortString());
        515         try {
        516             mMatrix.setPolyToPoly(src, 0, dst, 0, 5);
        517             fail("should throw exception");
        518         } catch (Exception e) {
        519         }
        520     }