1

I have some code written for the awt library. I want to port that to Android. But I'm not really sure hot to port a few methods.

Here is what I have so far. The part that is commented out is the original awt code. The part that is not commented out, is my new Android code.

I'm not sure if I can translate awt's t.translate() to Androids t.postTranslate(), along with some other lines of code. And I also don't know how to transport some other awt methods at all.

So I'm looking for an answer how to port the below code to Android equivalent functionality.

//AffineTransform t = new AffineTransform();
//Point2D.Float p = new Point2D.Float();
Matrix t = new Matrix();
PointF p = new PointF();


//t.setToIdentity();
//t.translate( cx+f*translateX, cy+f*translateY );

t.No Idea How To Set to Identity();
t.postTranslate(cx+f*translateX, cy+f*translateY);


//t.scale( s, s );
t.postScale( s, s );

//t.rotate( -rotation*f );
t.postRotate(-rotation*f);


//t.translate( -cx, -cy );
t.postTranslate(-cx, -cy);


//t.transform( p, p );
//t.mapPoints(p);
t.No Idea How TO Transform();
t.no Idea how to Map Pounts?();
Vivendi
  • 20,047
  • 25
  • 121
  • 196
  • check http://stackoverflow.com/q/5783624/2982225 – Infinite Recursion Jun 09 '14 at 09:35
  • @Payeli I dont want to port the entire awt lib to android or anything. I just want to know how to set a `Matrix` to an `identity` matrix for example. In awt I can do `.setToIdentity()`. But Android doesn't have to method on a `Matrix` object. So there must be some other way to do it. Since settings matrices to an identity matrix isn't uncommon at all. – Vivendi Jun 09 '14 at 09:59
  • @Vivendi I have a similar problem. Have you solved it? If yes, how? – dritan Sep 01 '14 at 14:09
  • @dritan I haven't solved it. I later moved on to an OpenGL solution. – Vivendi Sep 01 '14 at 15:19
  • @Vivendi I just found this link on the internet. https://android.googlesource.com/platform/frameworks/base/+/9066cfe9886ac131c34d59ed0e2d287b0e3c0087/awt/java/awt/geom/AffineTransform.java But I cant't tell if it does the work. – dritan Sep 01 '14 at 16:04
  • I just realized that the link I posted above, is from a very old Android version. Apparently removed Google this package entirely in newer version of Android – dritan Sep 01 '14 at 17:03

0 Answers0