Hi Vincent,

"V. de Weger" <[EMAIL PROTECTED]> wrote on 02/05/2007 09:39:19 AM:

> Just my luck: I have to rotate!
> 
> I've got the save part working, but how do I zoom/pan/rotate after 
loading
> the saved viewport?

   There are a large number of approaches to solve this problem.  My
suggestion would be to map three of your points through the 'current'
ScreenCTM.  This will give you three points in screen space s0,s1,s2. 
Now what you want to do is calculate the Affine Matrix that will map 
those three points (say top-left, bottom-left, top-right) to the 
windows corners w0, w1, w2.  Now an affine matrix has six values, 
and with three points you have six equations (x & y for each).  Now 
it's just a matter of doing a little algebra.

   s0.x*sx  + s0.y*shy + tx = w0.x
   s0.x*shy + s0.y*sy  + ty = w0.y
[...]

   When you calculate that transform then just preConcatenate
it with the current Rendering Transform and set the result as the
new rendering transform.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to