aspose file tools*
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "AffineTransform inaccuracy or developer innaccuracy" Watch "AffineTransform inaccuracy or developer innaccuracy" New topic
Author

AffineTransform inaccuracy or developer innaccuracy

marcus g.
Greenhorn

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();
t.scale(xxx);
t.rotate(xxx);
t.translate(xx);
image=op.filter(t,null);

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

scale.concatenate(rotate);
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: http://aspose.com/file-tools
 
subject: AffineTransform inaccuracy or developer innaccuracy