View Single Post
Old 27th May 2008, 22:27   #57  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by mikeytown2 View Post
My guess on why it isn't working is that you are using Avisynth 2.57.
Yes, you are correct.

Quote:
zoomFactor is very useful when using align. If it wasn't for align, zoomFactor is quite useless. In the end ZB() will either take x1,y1,x2,y2 or Align. When only using Align, it would be impossible to zoom in/out to your desired level.
Yes, I see, but I was looking for a more exact specification, explaining how align interacts with zoom (I guess the alignment point is the zoom center?) and what it means to say zoomFactor=x when the input and output clips are in the ratio y.
Quote:
Thank you for pointing that x2 and y2 are calculated using the already changed values of x1 and y1. I didn't see it! The 2.4 was originally 2, but through trial and error, 2.4 gave better results then 2.
That's probably because of the error I pointed out.
Quote:
I'm looking on the web for code on how to do the zoom. Right now mine is linear, which is why it messes up when zooming in too much. I think it needs to be shaped like a Logarithm, thus 100*.01=1, and it can never reach 0 when zooming out. I just need to figure out how to limit the zooming in so that the zoom point doesn't cross it's self. I'll post some new code in an hr or 2... but if you can point me to some code where zoom of 100% is unchanged and 200% is twice as much, ect... i would appreciate it.
I think a simple linear approach is easier to understand. The basis would be that to scale by a factor k about the point (x0, y0), the point (x, y) is mapped to the point (x0+k*(x-x0), y0+k*(y-y0). (If I understood exactly how you meant zoom to operate, I'd write the code for you).

For limiting, you just have to add a validation check that the requested zoom (scale) factor is > 0.
Gavino is offline   Reply With Quote