GETPHYSCOORD

Graphics Subroutine: Translates viewport coordinates to physical coordinates.

Module: USE DFLIB

Syntax

CALL GETPHYSCOORD (x, y, t)

x, y
(Input) INTEGER(2). Viewport coordinates to be translated to physical coordinates.


t
(Output) Derived Type xycoord. Physical coordinates of the input viewport position. The xycoord derived type is defined in DFLIB.F90 (in the \DF98\INCLUDE subdirectory) 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. For a more complete discussion of coordinate systems, see Understanding Coordinate Systems in the Programmer's Guide.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also: GETVIEWCOORD, GETWINDOWCOORD, SETCLIPRGN, SETVIEWPORT

Example

!  Program to demonstrate GETPHYSCOORD, GETVIEWCOORD
!  and GETWINDOWCOORD. Build as QuickWin or Standard
!  Graphics
USE DFLIB
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