File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes AffineTransform inaccuracy or developer innaccuracy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "AffineTransform inaccuracy or developer innaccuracy" Watch "AffineTransform inaccuracy or developer innaccuracy" New topic

AffineTransform inaccuracy or developer innaccuracy

marcus g.

Joined: Nov 10, 2003
Posts: 9
Concerning AffineTransforms. I understand that the order of operations matters on the AffineTransform itself such that matriceA * matriceB is not necessarily the same as matriceB * matriceA.

The problem comes when concatenating two transforms.

Method 1)
AffineTransform t = new AffineTransform();

which *I think* should behave the same as
Method 2)
AffineTransform scale = AffineTransform.getScaledInstance(xxx);
AffineTransform rotate= AffineTransform.getRotateInstance(xxx);

image =op.filter(scale,null);

Method 3) is to run op.filter after each transform using Method 2) only without concatenating the transforms. This is the only way I can be accurate.

Method 2) will usually put me off 100pixels without specifically trying to keep the aspect ratio.

Method 1) puts me way off.. In addition Method 1) and Method 2) leave a black box no matter which image height i use. I understand that when its rotated it should be rotate for a different image width and height after scaling.

Any ideas on this?
I agree. Here's the link:
subject: AffineTransform inaccuracy or developer innaccuracy
It's not a secret anymore!