android - 如何在 Android 上执行类似 AffineTransform.transform 的操作?

标签 android matrix android-canvas

public Point2D transform(Point2D ptSrc, Point2D ptDst)

Transforms the specified ptSrc and stores the result in ptDst. If ptDst is null, a new Point2D object is allocated and then the result of the transformation is stored in this object. In either case, ptDst, which contains the transformed point, is returned for convenience. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point.

如何在 Android 上执行类似的操作?任何指针将不胜感激。谢谢。

最佳答案

您可以使用 Matrix.mapPoints为此上课。例如:

Matrix m = new Matrix(orig);
m.preScale(scale, scale);
m.postTranslate(x, y);

float[] src = { 0.5, 0.3 };
float[] dst = new float[2];
m.mapPoints(dst, src);
//...

关于android - 如何在 Android 上执行类似 AffineTransform.transform 的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9019469/

相关文章:

游戏 Ruzzle 中使用的算法

algorithm - 稀疏矩阵乘法复杂度

Android,从主要 Activity 中绘制

android - Canvas 停止识别跟踪 Android

java - 在另一个 View 上绘制外部 Canvas

android - 获取错误 : external allocation too large for this process

android - 在主屏幕小部件上使用 Canvas 绘制

java - Android Studio 2.2,Gradle 构建失败,出现 java.lang.OutOfMemoryError : unable to create new native thread

android - startActivityForResult 一位联系人的所有电话号码

python - 这种一次性矢量转换是如何工作的?