Let’s say I have a 640x480 window and a 1280x960 image.
If I write this code in Paint,
g.drawImage(destImage, 0, 0, getWidth(), getHeight(), (int)XOffset, (int)YOffset, (int)(getWidth() / zoomFactor), (int)(getHeight() / zoomFactor), false);
with XOffset and YOffset modified in mouseDrag simply by adding +1, -1
and zoomFactor a float value (usually 1.0f).
this works when zoomFactor is 1.0f (as expected) and draw a 640x480 image from a 640x480 window of the destImage with (XOffset, YOffset) origin.
However, if the zoomFactor become 2.0f (for example), I would expect the drawImage to still draw a 640x480 window from a 320x240 window of the destImage with (XOffset, YOffset) origin.
With the current code, all I have is a shifted (translated) and zoomed picture, not a zoomed picture.