View Full Version : Magnification to static location...
rysolag
September 8th, 2003, 05:25 PM
I have a problem with implementing a magnification application; I just can't think of how to get it done.
OK. There is a picture on the screen. Where ever you move the mouse a little empty box follows(easy). Below the picture there is an image that displays what is inside the empty box, but it is magnified.
I am thinking that I can have a larger image of the picture out of view and move a large box over that picture that mimics the smaller picture. Then I can "copy and paste" whatever is inside the large box to the magnification stage under the little picture.
Do you guys follow?
Any help would be cool.
Thanks
jingman
September 8th, 2003, 08:03 PM
so, you want a preview box that's the magnified image?
rysolag
September 8th, 2003, 09:18 PM
yeah, it is a box that holds the magnified version of what the user is currently pointing the empty box over.
Scootman
September 8th, 2003, 11:28 PM
ok start out with the little box in the center of the image... and have a larger version of the image masked by the "magnification window" whatever size you want it to be "magnified"... find the ratio of the scale of the smaller one to the bigger one... (xscale ratio would be xscale of larger / xscale of smaller, same for y) and then when you drag your box around the smaller version of the image... whatever you move that box... you move the larger verson the opposite distance * the scale ratio
for example
imagine you have the box over the image
when you move that box left... everything under it appears to move right...
so say your larger image is twice as big as your small one, your scale ratio would be 2
so when you drag your box, every enter frame check its x position compared to it in the previous frame, same for y so you have diffx and diffy (difference in posistion) and then you move the large masked image -diffx*scaleRatio and -diffy*scaleRatio...
i havent tried this but it should work... hope it helps
*edit*
oh yeah to make the mask window the right size relative to the empty box you will be dragging over the image to appear that it is magnifying perfectly the area "of focus" (inside the small box)... make the scale of the mask window the scale of the small box * the scale ratio...
i can probably make a quick example if you really need it... but this hopefully should do it ;)
rysolag
September 9th, 2003, 01:22 AM
This is just the first thing that came to my head after reading your post...is it true that all scale properties are initially 100?Would the ratio always be one?
rysolag
September 9th, 2003, 01:25 AM
I got it. I am just going to use the width and height properties...same thing, right? cool
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.