Reputation: 19723
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.
Upvotes: 2
Views: 1888
Reputation: 43504
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);
//...
Upvotes: 6