Matrix的 setPolyToPoly

yuanzi 2011-07-18 04:22:57
哪位用过 Matrix的 setPolyToPoly (float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)方法做过图形变换 ? 参数如何设置
在apiDemo中有从图形1到图形4的变化,可还是没搞懂它是怎么设置参数的。
...全文
302 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fishmen26 2011-07-20
  • 打赏
  • 举报
回复
This is a example

public 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 }

fishmen26 2011-07-20
  • 打赏
  • 举报
回复
public boolean setPolyToPoly (float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)
Since: API Level 1

Set 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

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧