2005-07-07, 05:10 PM
I think you've got it. But, the screen size is "almost" fixed. If you set the screen size to the same aspect ratio as the image you will keep the aspect ratio correct for zoom operations. You only need calculate it once. So, in your example the screen size is 720 * 480 , the image is 360 * 240 so you use 720 * 480 as the actual screen size - bad example let's try another:
Screen size 720 * 480. image dimensions 340 * 240. You would do the maths once per image and adjust your screen size to 680 * 480. i.e. the maximum screen size that maintains the correct aspect ratio. This will then work for all zoom operations, panning etc. Use this as the "destination" rectangle.
In your previous post you are correct, I did get the wrong params on DrawImage. Use the one you suggest, instead of producing a SourceImage rectangle variable. Essentially it does exactly the same thing.
Does this make sense yet?
Screen size 720 * 480. image dimensions 340 * 240. You would do the maths once per image and adjust your screen size to 680 * 480. i.e. the maximum screen size that maintains the correct aspect ratio. This will then work for all zoom operations, panning etc. Use this as the "destination" rectangle.
In your previous post you are correct, I did get the wrong params on DrawImage. Use the one you suggest, instead of producing a SourceImage rectangle variable. Essentially it does exactly the same thing.
Does this make sense yet?