Skip to content

PMAP ​


Maps coordinates between view and physical mapping.

Syntax ​

` declare function PMap ( byval coord as single, byval func as long ) as single

`

Usage ​

` result = PMap( coord, func )

`

Parameters ​

coord

An expression indicating the coordinate to be mapped.

func

The mapping function number to be applied to given coordinate.

Return Value ​

The mapped coordinate value.

Description ​

This function converts a coordinate between view (as defined by the Window statement) and physical (as set by the View (Graphics) statement) mappings. Depending on the value of func, expr is used to compute a different mapping to be returned by PMap:

func value:return value:
0Treats expr as x view coordinate and returns corresponding x physical coordinate.
1Treats expr as y view coordinate and returns corresponding y physical coordinate.
2Treats expr as x physical coordinate and returns corresponding x view coordinate.
3Treats expr as y physical coordinate and returns corresponding y view coordinate.

Examples ​

start GeSHi

vb
ScreenRes 640, 480
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

end GeSHi

Differences from QB ​

  • None

See also ​

  • Window
  • View (Graphics)

Back to DocToc

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft