The '''PMAP''' statement returns the physical or [[WINDOW]] view port coordinates.



{{PageSyntax}}
:: PMAP (''coordinate'', ''function_number%'')


* The ''coordinate'' is the coordinate point to be mapped. 
* The ''function'' can have one of four values:

:: 0 = Maps view port coordinate to physical x screen coordinate
:: 1 = Maps view port coordinate to physical y screen coordinate
:: 2 = Maps physical screen coordinate to view port x coordinate
:: 3 = Maps physical screen coordinate to view port y coordinate

* The four PMAP functions allow the user to find equal point locations between the view coordinates created with the [[WINDOW]] statement and the physical screen coordinates of the viewport as defined by the [[VIEW]] statement.
* Mouse co-ordinates returned by [[_MOUSEX]] and [[_MOUSEY]] are the physical screen co-ordinates.


''Example:'' Use PMAP to convert coordinate values from view to screen coordinates and from screen coordinates to view coordinates.
{{CodeStart}} '' ''
{{Cl|SCREEN (statement)|SCREEN}} 12
 'Coordinates of upper-left corner of the window is defined in following statement are (90,100) 
{{Cl|WINDOW}} {{Cl|SCREEN (statement)|SCREEN}} (90, 100)-(200, 200) 'coordinates of lower-right 'corner are 200, 200.

X = {{Cl|PMAP}}(90, 0)          ' X = 0
{{Cl|PRINT}} X
Y = {{Cl|PMAP}}(100, 1)         ' Y = 0
{{Cl|PRINT}} Y

'These statements return the screen coordinates equal to the view coordinates 200, 200.
X = {{Cl|PMAP}}(200, 0)         ' X = 639
{{Cl|PRINT}} X
Y = {{Cl|PMAP}}(200, 1)         ' Y = 479
{{Cl|PRINT}} Y

'These statements return the view coordinates equal to the screen coordinates 0, 0
X = {{Cl|PMAP}}(0, 0)
{{Cl|PRINT}} X
Y = {{Cl|PMAP}}(0, 0)
{{Cl|PRINT}} Y

'These statements return the view coordinates equal to the screen coordinates 639, 479.
X = {{Cl|PMAP}}(639, 2)         ' X = 200
{{Cl|PRINT}} X
Y = {{Cl|PMAP}}(479, 3)         ' Y = 200
{{Cl|PRINT}} Y

{{Cl|SLEEP}}                    ' pause before clearing view port
{{Cl|CLS}} 1                    ' clear grahic view port
{{Cl|WINDOW}}                   ' end graphic view port
{{Cl|END}} '' ''
{{CodeEnd}}
: ''Note:'' If physical screen coordinates are (0, 0) in the upper-left corner and (639, 479) in the lower-right corner, then the statements return the screen coordinate's equal to the view coordinates 90, 100.


''See also:'' 
* [[WINDOW]], [[VIEW]]
* [[VIEW PRINT]]


{{PageNavigation}}
