Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ olPixConver() — Amiga System V Release 4 Version 2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought



PIXEL CONVERSION ROM
U
I
T
I
S
C
N
.
E
S(
R
3
E
F
W
)
E
RENCE MA
P
I
N
U
X
A
E
L C
P
A
O
G
N
E
V
E
S
RSION ROUTINES(3W) SYNOPSIS #include <Xlib.h> #include <OpenLook.h> Screen *OlDefaultScreen; Display *OlDefaultDisplay; Axis axis; Screen screen; OlMMToPixel(axis, millimeters); OlMMToPixel(axis, millimeters); OlPointToPixel(axis, points); OlPointToPixel(axis, points); OlScreenMMToPixel(axis, millimeters, screen); OlScreenMMToPixel(axis, millimeters, screen); OlScreenPointToPixel(axis, points, screen); OlScreenPointToPixel(axis, points, screen); OlPixelToMM(axis, pixels); OlPixelToMM(axis, pixels); OlPixelToPoint(axis, pixels); OlPixelToPoint(axis, pixels); OlScreenPixelToPoint(axis, pixels, screen); OlScreenPixelToPoint(axis, pixels, screen); OlScreenPixelToMM(axis, pixels, screen); OlScreenPixelToMM(axis, pixels, screen); DESCRIPTION All the X-based OPEN LOOK widgets refer to pixels in coordi- nates and dimensions for compatibility with other X Window System widgets. However, this puts the burden on the appli- cation programmer to convert between externally useful meas- ures, such as points or millimeters, and pixels as applied to the screen at hand. These routines examine the data structures that describe the physical dimensions and the pixel resolution of a screen and convert among millimeters, points, and pixels for that screen. Which Screen? The shorter forms of these routines (the ones without the word Screen in their names) work for the default screen. This is the screen that is active when the X Toolkit Intrinsics are started. The longer forms of these routines take a Screen * type argument that refers to a par- ticular screen. The macros OlDefaultScreen and OlDefault- Display identify the current screen and display being used by the Intrinsics. Although the SYNOPSIS above implies these are variables of type Screen * and Display *, respec- tively, they are really macros that produce values of these types. Note: Use After Toolkit Initialization These routines make use of data structures that are initial- ized when the Toolkit is initialized (see OlInitialize in "Mandatory Routines" earlier in this document). Therefore, using them before Toolkit initilization (for example, as an Amiga Unix Last change: 1


PIXEL CONVERSION ROM
U
I
T
I
S
C
N
.
E
S(
R
3
E
F
W
)
E
RENCE MA
P
I
N
U
X
A
E
L C
P
A
O
G
N
E
V
E
S
RSION ROUTINES(3W) initial value to a statically defined variable) will result in a run time error. Axis Argument The first argument of all the routines is the direction in which the measurement is made. This is neces- sary because not all screens have equivalent resolution in the horizontal and vertical axes. The axis argument can take one of the two values: OLHORIZONTAL or OLVERTICAL. These routines are not directly usable in computing a diago- nal measure. (Find the diagonal with the Pythagorean Theorem: a2 + b2 = c2) Implemented as Macros All these routines are implemented as macros, so they can take any reasonable type value for the millimeters, points, and pixels. The macros cast the values into the proper type needed for the conversion. However, only a single type value can be "returned". The routines without an underscore in their names produce values of type int (the values are rounded to the nearest integer). The routines with an underscore in their names produce values of type double (these values have not been rounded, leaving it up to the application to round up, round down, or truncate as needed). Given the small size of the units involved, the integer returning routines should be sufficient for many applications. Because these routines are implemented as macros, there are no function addresses available. Amiga Unix Last change: 2

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026