{{fbdoc item="title" value="PMAP"}}----
Maps coordinates between view and physical mapping.

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare declare]] [[KeyPgFunction function]] **PMap** ( [[KeyPgByval byval]] //coord// [[KeyPgAs as]] [[KeyPgSingle single]], [[KeyPgByval byval]] //func// [[KeyPgAs as]] [[KeyPgLong long]] ) [[KeyPgAs as]] [[KeyPgSingle single]]
##
{{fbdoc item="usage"}}##
	//result// = **PMap**( //coord//, //func// )
##
{{fbdoc item="param"}}
	##//coord//##
		An expression indicating the coordinate to be mapped.
	##//func//##
		The mapping function number to be applied to given coordinate.

{{fbdoc item="ret"}}
	The mapped coordinate value.

{{fbdoc item="desc"}}
	This function converts a coordinate between view (as defined by the ##[[KeyPgWindow Window]]## statement) and physical (as set by the ##[[KeyPgViewgraphics View (Graphics)]]## statement) mappings. Depending on the value of ##//func//##, ##//expr//## is used to compute a different mapping to be returned by ##**PMap**##:

		{{table columns="2" cellpadding="1" cells="func value:;return value:;0;Treats expr as x view coordinate and returns corresponding x physical coordinate.;1;Treats expr as y view coordinate and returns corresponding y physical coordinate.;2;Treats expr as x physical coordinate and returns corresponding x view coordinate.;3;Treats expr as y physical coordinate and returns corresponding y view coordinate."}}

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/gfx/pmap.bas"}}%%(freebasic)
screen 12
window screen (0, 0)-(100, 100)
print "Logical x=50, Physical x="; pmap(50, 0)   '' 320
print "Logical y=50, Physical y="; pmap(50, 1)   '' 240
print "Physical x=160, Logical x="; pmap(160, 2) '' 25
print "Physical y=60, Logical y="; pmap(60, 3)   '' 12.5
sleep
%%

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##[[KeyPgWindow Window]]##
	- ##[[KeyPgViewgraphics View (Graphics)]]##

{{fbdoc item="back" value="CatPgGfxScreen|Screen Functions"}}