# GETPHYSCOORD (W*S)

Graphics Subroutine: Translates viewport coordinates to physical coordinates.

## Module

USE IFQWIN

CALL GETPHYSCOORD (x,y,s)

x,y | (Input) INTEGER(2). Viewport coordinates to be translated to physical coordinates.
s | (Output) Derived type `xycoord`. Physical coordinates of the input viewport position. The `xycoord` derived type is defined in `IFQWIN.F90` as follows:
    TYPE xycoord
      INTEGER(2) xcoord   ! x-coordinate
      INTEGER(2) ycoord   ! y-coordinate
    END TYPE xycoord

Physical coordinates refer to the physical screen. Viewport coordinates refer to an area of the screen defined as the viewport with SETVIEWPORT. Both take integer coordinate values. Window coordinates refer to a window sized with SETWINDOW or SETWSIZEQQ. Window coordinates are floating-point values and allow easy scaling of data to the window area.

## Example

    !  Program to demonstrate GETPHYSCOORD, GETVIEWCOORD,
    !  and GETWINDOWCOORD. Build as QuickWin or Standard
    !  Graphics
    USE IFQWIN
    TYPE (xycoord)  viewxy, physxy
    TYPE (wxycoord) windxy
    CALL SETVIEWPORT(INT2(80), INT2(50), &
                     INT2(240), INT2(150))

    !  Get viewport equivalent of point (100, 90)
    CALL GETVIEWCOORD (INT2(100), INT2(90), viewxy)

    !  Get physical equivalent of viewport coordinates
    CALL GETPHYSCOORD (viewxy%xcoord, viewxy%ycoord, &
                       physxy)

    !  Get physical equivalent of viewport coordinates
    CALL GETWINDOWCOORD (viewxy%xcoord, viewxy%ycoord, &
                         windxy)

    !  Write viewport coordinates
    WRITE (*,*) viewxy%xcoord, viewxy%ycoord
    !  Write physical coordinates
    WRITE (*,*) physxy%xcoord, physxy%ycoord
    !  Write window coordinates
    WRITE (*,*) windxy%wx, windxy%wy
    END

Parent topic: Graphics Library Routines

## See Also

GETVIEWCOORD
GETWINDOWCOORD
SETCLIPRGN
SETVIEWPORT