On Sep 3, 9:34*am, Peter May <peter....@poczta.fmwrote:
Quote:
Hi.
>
I know the dimensions area visible on the screen and I would like to
picture that there put dynamically, match its size to the window, while
retaining the proportions of course.
>
For example:
>
Screen area visible: * *1280x589
The picture size: * * * 3008x2000
>
What use a mathematical formula to convert the size of the image, which
adjust it to a visible area on the screen?
>
--
Peter
Is not it obvious? All you have to do is to think about it...
1) Calculate scaling scaleRatio = MIN((scrHeight / imageHeight),
(scrWidth / imageWidth));
You will probably want to do following two steps ONLY when scaleRatio
< 1 i.e. image was too big, you will NOT want to show the image BIGGER
than the original because of loss of quality...
2) Calculate new image width = imageWidth * scaleRatio ;
3) Calculate new image height = imageHeight * scaleRatio ;