CONVERT
Given the coordinates of a point in one coordinate system, CONVERT
returns the corresponding coordinates for the point in another
coordinate system. The converted coordinates are returned using the
"to_x_integer" and "to_y_integer" parameters.
Syntax
CONVERT ({DECW_ROOT_WINDOW | SCREEN | window},
{CHARACTERS | COORDINATES},
from_x_integer, from_y_integer,
{DECW_ROOT_WINDOW | SCREEN | window},
{CHARACTERS | COORDINATES},
to_x_integer, to_y_integer)
Parameters
DECW_ROOT_WINDOW Specifies the coordinate system being used by the
root window of the screen on which DECTPU is
running.
SCREEN Specifies the coordinate system being used by the
DECwindows window associated with DECTPU's
top-level widget.
window Specifies the coordinate system being used by the
DECTPU window.
CHARACTERS Specifies a character-cell system for measuring
screen distance. In a character-based system, the
point in the top row and the left-most column has
the coordinate (1,1).
COORDINATES Specifies a DECwindows-style coordinate system in
which coordinate units correspond to pixels. The
pixel in the top row and the leftmost column has
the coordinates (0,0).
from_x_integer and from_y_integer Specify a a point in the coordinate
system and units specified by the
first two parameters.
to_x_integer and to_y_integer Receive the two integers specifying
a point in the coordinate system
and units specified by the fifth
and sixth parameter. The point
specified by these integers
corresponds to the point specified
by the first four parameters.
Example
The following procedure converts a point's location from the current
window's coordinate system (with the origin in the upper left-hand
corner of the window) to the DECTPU screen's coordinate system (with
the origin in the upper left-hand corner of the DECTPU screen). If the
current window is not the top window, CONVERT changes the value of the
y-coordinate to reflect the difference in the DECTPU screen's
coordinate system.
PROCEDURE user_convert
LOCAL source_x,
source_y,
dest_x,
dest_y;
source_x := 1;
source_y := 1;
dest_x := 0;
dest_y := 0;
CONVERT (CURRENT_WINDOW, COORDINATES, source_x, source_y, SCREEN,
COORDINATES, dest_x, dest_y);
ENDPROCEDURE;