Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pixelconversion(3w) — OpenWindows V3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

pixelconversion(3w)  —  OLIT Widget Set

NAME

OlMMToPixel, Ol_MMToPixel, OlPointToPixel, Ol_PointToPixel, OlScreenMMToPixel, Ol_ScreenMMToPixel, OlScreenPointToPixel, Ol_ScreenPointToPixel, OlPixelToMM, Ol_PixelToMM, OlPixelToPoint, Ol_PixelToPoint, OlScreenPixelToPoint, Ol_ScreenPixelToPoint, OlScreenPixelToMM, Ol_ScreenPixelToMM − routines to examine data structures describing physical dimensions and pixel resolution of a screen

SYNOPSIS

#include <Xlib.h>
#include <OpenLook.h>

Screen ∗OlDefaultScreen;
Display ∗OlDefaultDisplay;

Axis axis;
Screen screen;

OlMMToPixel(axis, millimeters);
Ol_MMToPixel(axis, millimeters);

OlPointToPixel(axis, points);
Ol_PointToPixel(axis, points);

OlScreenMMToPixel(axis, millimeters, screen);
Ol_ScreenMMToPixel(axis, millimeters, screen);

OlScreenPointToPixel(axis, points, screen);
Ol_ScreenPointToPixel(axis, points, screen);

OlPixelToMM(axis, pixels);
Ol_PixelToMM(axis, pixels);

OlPixelToPoint(axis, pixels);
Ol_PixelToPoint(axis, pixels);

OlScreenPixelToPoint(axis, pixels, screen);
Ol_ScreenPixelToPoint(axis, pixels, screen);

OlScreenPixelToMM(axis, pixels, screen);
Ol_ScreenPixelToMM(axis, pixels, screen);

DESCRIPTION

All the X-based OPEN LOOK widgets refer to pixels in coordinates and dimensions for compatibility with other X~Window System widgets. 

This puts the burden on the application programmer to convert between externally useful measures, 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 particular screen. 

The macros OlDefaultScreen and OlDefaultDisplay identify the current screen and display being used by the Intrinsics.  Although the SYNOPSIS above implies these are variables of type Screen ∗ and Display ∗, respectively, they are really macros that produce values of these types. 

Note:

Use After Toolkit Initialization
These routines make use of data structures that are initialized when the Toolkit is initialized (see initialization(3w)).  Therefore, using them before toolkit initialization (for example, as an 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 necessary because not all screens have equivalent resolution in the horizontal and vertical axes.  The axis argument can take one of the two values: OL_HORIZONTAL or OL_VERTICAL.  These routines are not directly usable in computing a diagonal 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, points1, 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. 

Version 3.0  —  Last change: 19 July 91  —  Last change: 19 July 91

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