Sets new physical coordinate mapping and clipping region
Syntax
View [SCREEN] ( x1, y1 )-( x2, y2 )[, [ color ] [, border ]]]
Parameters
SCREEN
When specified, any x,y coordinate will be relative to the top-left corner of the screen, and not to the left-top corner of the viewport.
( x1, y1 )-( x2, y2 )
Coordinates of the top-left and bottom-right corners of the new viewport in screen pixels.
color
Color with which to clear the new viewport; if omitted, the viewport will not be cleared.
border
Color of the border box surrounding the new viewport. If omitted, no border box will be drawn.
Description
Use this statement to set a new clipping region, also known as viewport. The new viewport will override the previous one, if any; if the
SCREEN argument is omitted, all future coordinates specifications will be relative to the top-left corner of the new viewport, instead of relative to the top-left corner of the screen. Any graphical primitive will be affected by the new viewport, and drawing outside specified region will produce no effect. If
color is specified, in the same format as the one supported by
Color, the new viewport is cleared with it; if
border is specified, also in
Color format, a box using
border as color will be drawn surrounding given region. If all arguments are omitted, the viewport is reset to the screen mode size.
Example
Screen 12
Dim ip As Integer Ptr
Dim As Integer i, j, k
'simple sprite
For i=0 To 63: For j=0 To 63:PSet (i,j), (i\4) Xor (j\4):Next j,i
ip=ImageCreate(64,64)
Get (0,0)-(63,63),ip
Cls
'viewport
Line (215,135)-(425,345),1,bf
View (220,140)-(420,340)
k=0
'move sprite
Do
i=100*Sin(k*.02)+50: j=100* Sin(k*.027)+50
ScreenSync
ScreenLock
Cls 1: Put (i,j),ip ,PSet
ScreenUnlock
k=k+1
Loop Until Len(Inkey)
ImageDestroy(ip)
Differences from QB
See also