Click here to Skip to main content
15,915,501 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello everyone,
I have a problem.
I have an image that comes from a camera.
I stretch the image inside a Viewbox which is 877*877 px big.
The camera image can have a resolution fromm 100*100 px to 3000*3000 px.
Right now the complete image is stretched inside the ViewBox with the help of Windows.ScaleTransform.
I also have a zoom function in the software which works correctly. It also works with Windows.ScaleTransform.
It looks like this:
http://i.stack.imgur.com/tZJGI.png[^]

Now to my problem: The zoom factor has to be 100% (1) when the camera is image is 877*877, but it is always 100% when the zoom is not working.
When the Viewbox show's a stretched 3000x3000 px image the zoom should be 29% and not 100%.
Any idea how I can manage this?

I am looking forward to an answer.
Greetings
Richard

What I have tried:

I tried to calculate the resolution difference between the Image and the Viewbox
And
I tried to calculate the zoom factor
Posted
Updated 20-Jun-16 3:11am
Comments
Richard MacCutchan 16-Jun-16 10:45am    
I tried to calculate
Exactly how, and what were the problems? Please show your code and explain where it goes wrong. Also, what is the problem with Windows.ScaleTransform?

1 solution

I found the solution. It was a mistake in my thoughts. I thought that the before the Scale were done with the ScaleFactor i had to work with the Stretch. So my "formula" was easy:
Viewboxsize/Imagesize*100*ScaleFactor
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900