12-02-2024, 02:32 PM
I use a different solution. If the screen resolution is, for example, 800x600 and the displayed object has coordinates 9000, 320, then it does not meet the conditions and is not displayed. Anything that is in the range 0 - 800 and 0 - 600 meets them and is therefore visible.
Here is an example. Let's say you need to display a higher resolution image on an 800x600 screen. Just use what _PutImage can do by itself and take advantage of the fact that things outside the visible area are not rendered.
In the program, use the left, right, up, down arrows and the mouse wheel to zoom.
Also try inserting any other image instead of _ScreenImage. It will work the same.
Here is an example. Let's say you need to display a higher resolution image on an 800x600 screen. Just use what _PutImage can do by itself and take advantage of the fact that things outside the visible area are not rendered.
In the program, use the left, right, up, down arrows and the mouse wheel to zoom.
Also try inserting any other image instead of _ScreenImage. It will work the same.
Code: (Select All)
Dim As Long MX, MY, LB, RB, Imag
Imag = _ScreenImage
Screen _NewImage(800, 600, 32)
Z = 799
RatioY = _Height / _Width
Do Until k& = 27
k& = _KeyHit
GetMouse MX, MY, LB, RB, MWH
Select Case k&
Case 18432: Y = Y - 10
Case 20480: Y = Y + 10
Case 19200: X = X - 10
Case 19712: X = X + 10
End Select
Z = Z + MWH
Cls
_PutImage (0, 0)-(799, 599), Imag, 0, (X, Y)-(X + Z, Y + Z * RatioY)
_Display
_Limit 30
Loop
Sub GetMouse (MX As Long, MY As Long, LB As Long, RB As Long, MWH As Single)
omwh = MWH
Do While _MouseInput
MWH = MWH + 10 * _MouseWheel
Loop
If omwh - MWH = 0 Then MWH = 0
MX = _MouseX
MY = _MouseY
LB = _MouseButton(1)
RB = _MouseButton(2)
End Sub