如何在Android上执行类似操作AffineTransform.transform? [英] How to perform a similar operation as AffineTransform.transform on Android?
问题描述
公开的Point2D变换(的Point2D的ptSrc,的Point2D ptDst中)
变换指定的ptSrc并将结果存储在ptDst。如果
ptDst为null,则新的Point2D对象分配,然后将结果
改造中存储该对象。在这两种情况下,ptDst中,
其中包含变换点,则返回方便。如果
ptSrc并将ptDst是同一个对象,输入点是正确
覆盖的变换点。
块引用>如何执行在Android类似的操作?任何指针将大大AP preciated。谢谢你。
解决方案您可以使用
Matrix.mapPoints
类此。例如:矩阵M =新的Matrix(原稿);
米preSCALE(秤,秤)。
m.postTranslate(X,Y);浮动[] SRC = {0.5,0.3};
浮动[] = DST新的浮动[2];
m.mapPoints(DST,SRC);
// ...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.
How do I perform a similar operation on Android? Any pointers will be greatly appreciated. Thanks.
解决方案You can use the
Matrix.mapPoints
class for this. For example: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上执行类似操作AffineTransform.transform?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!