Hello,
I am working on an image viewer that allows the user to pan, rotate, and
zoom.
I store the pan-rotate-zoom state in an AffineTransform.
In my paintComponent() method, before drawing the image, I retrieve the
current transform and do
g2.transform(currentTransform); // technique 1
If I change the call above to
g2.setTransform(currentTransform); // technique 2
it seems to work equally as well.
However, if I hide my image viewer behind another application window, and
then uncover it again, only technique 1 works, i.e. with technique 2 the
repaint of the covered/exposed area is incorrect.
If I print out the value of the transform using AffineTransform.toString(),
I note that the value of the transform is the same whether I use
setTransform() or transform(). That is
System.out.println("ct = " + currentTransform.toString());
g2.transform(currentTransform);
System.out.println("t1 = " + g2.getTransform().toString());
g2.setTransform(currentTransform);
System.out.println("t2 = " + g2.getTransform().toString());
in either case, the value of g2.getTransform( ) is the same as the value of
currentTransform.
Based on all this, I have two questions:
1. If the value of g2's transform is the same in both cases, why do I get
different behavior when covering/uncovering the image? (I suspect it has
something to do with the clipRect, but the documentation doesn't touch on
this, and the source code is not available.)
2. The documentation for transform( ) says that it 'composes' the argument
with the current transform. The documentation for setTransform( ) says that
it replaces the current transform. So why are the values the same? I would
have expected them to be different.
I'm working with JKD 1.3.1 on NT 4.
Any insights would be appreciated,
Thank you,
Ted Hill
Software Engineer
www.tomotherapy.com
[EMAIL PROTECTED]
Tomotherapy
2228 Evergreen Road
Middleton, WI 53562-4241
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".