Revision [14193]

This is an old revision of KeyPgViewgraphics made by LaananFisher on 2009-07-06 20:27:06.

 

VIEW (GRAPHICS)


Sets new physical coordinate mapping and clipping region

Syntax:
View
View ( x1, y1 )-( x2, y2 ) [ [, fill_color ] [, border_color ] ]
View Screen ( x1, y1 )-( x2, y2 ) [ [, fill_color ] [, border_color ] ]

Parameters:
x1 KeyPgAs as KeyPgInteger Integer, y1 KeyPgAs as KeyPgInteger Integer
The horizontal and vertical offsets, in pixels, of the top-left corner of the viewport relative to the top-left corner of the screen.
x2 KeyPgAs as KeyPgInteger Integer, y2 KeyPgAs as KeyPgInteger Integer
The horizontal and vertical offsets, in pixels, of the bottom-right corner of the viewport relative to the top-left corner of the screen.
fill_color KeyPgAs as KeyPgUinteger UInteger
The color to fill the new viewport.
border_color KeyPgAs as KeyPgUinteger UInteger
The color of the border to draw around the new viewport.

Description:
The viewport, or clipping region, is a rectangular area of the graphics screen, outside of which no drawing will be done. That is, only drawing done within this area will be shown. A graphics screen must be created with KeyPgScreengraphics Screen or KeyPgScreenres ScreenRes before calling View or View Screen.
The first statement sets the viewport to encompass the entire screen, which is the default viewport for a new graphics screen.
The second and third statements both allow a new viewport to be defined. The corners of the viewport are specified by the x1, y1, x2 and y2 parameters. fill_color and border_color are both in the format accepted by KeyPgColor Color. The indicated effects for each parameter only occur if that parameter is specified.
The second statement modifies the co-ordinate mapping of the graphics screen such that co-ordinates specified for drawing statements and procedures are relative to the top-left corner of the viewport.
The third statement modifies the co-ordinate mapping of the graphics screen such that co-ordinates specified for drawing statements and procedures are relative to the top-left corner of the screen.

Examples:
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:
Back to Screen Functions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode