## Pen for OS/2 Device Driver Reference

[prev][next][parent][TOC]

### Coordinate Adjustments

     [Artwork not shown]

This figure shows a typical digitizer system. The inner rectangle represents the liquid crystal display (LCD) surrounded by its display bezel . The digitizer extends beyond the LCD on all sides and is shown by the outer rectangle. The finger in the center of the screen and the dotted slide region are discussed in Finger Offset.

This model assumes that the LCD has fixed dimensions and that the digitizer has a fixed resolution that is constant and uniform. Therefore, the device extents can be calculated. For example, if an LCD dimension is 10 inches and the digitizer has a resolution of 100 units per inch, then the device extents are 1000. Points are reported with values ranging from 0 to 999. The device extents, as reported in locator capabilities, must not be updated from their initial values set during registration other than to adjust for video mode changes as discussed in Video Mode Changes.

The diagram shows the raw device coordinate system and the normalized device coordinate system. The raw device coordinate system can have its origin at any corner and report sample points relative to that point over the entire active region of the digitizer. Typically, the origin is at the upper-left corner. The normalized coordinate system must have its origin at the upper-left corner of the LCD and range from 0 to the reported extents less one.

The locator event packet reports the normalized coordinates to the Pen for OS/2 Device Driver Services. The Pen for OS/2 Device Driver Services convert the normalized coordinates to PM screen coordinates. PM screen coordinates for video graphics array (VGA) are 640 x 480 pixels. Pen-aware applications have access to the PM screen coordinates, the more granular normalized coordinates, and standard coordinates based on a standard digitizer resolution of 1000 points per inch.

The calibration process determines the location of the LCD relative to the digitizer by collecting the raw device coordinates of the LCD corners. In the sample calibration program provided in the Pen for OS/2 Developer's Toolkit, the measured extents are found by calculating the corners of the LCD, as shown by the large arrows in the previous figure. (See Calibration Program for a description of the sample calibration program provided in the Pen for OS/2 Developer's Toolkit.)

Raw device coordinates must be transformed to the normalized coordinate system. First, raw device points must be translated from the raw origin to the normalized origin by adding an origin adjustment offset. Next, the value must be scaled in case the measured extent, as determined by the calibration points, does not exactly match the expected fixed device extent . This is done by multiplying the value by the fixed extent, dividing by the measured extent, and rounding up. Round off this value to ensure that it does not exceed the fixed device extent less one. Finally, the value might need to be inverted if the origin of the raw device coordinates is at a corner other than the upper left.

    --------------------------------------------------------------------------

    Xnorm = (Xraw+Xxadj) (Xextent / Xmeasured)

    Ynorm = (Yraw+Yyadj) (Yextent / Ymeasured)

    --------------------------------------------------------------------------

Pen for OS/2 Device Driver Services normalize z-coordinates to range from 0 to -4KB (KB equals approximately 1000 bytes) for pressure and 0 to 4KB for height.

     [Artwork not shown]

Digitizers located below the LCD exhibit parallax as illustrated in this figure. Parallax is a condition that occurs when a gap exists between the locator position and the displayed ink. When the pen is at position A, the locator position and displayed ink at AL match. When the locator is at position B, the ink appears at BL. A gap exists between the locator position and the ink. The ink would appear at position BL*.

The distance between the display surface and the LCD cell is often about 3. 0 millimeters. In this case, where the eye angle is at 45 degrees, the gap is 3.0 millimeters.

The parallax differs in both the horizontal and vertical views by how a user looks at the display. This makes software correction for parallax unreliable. Parallax can result in a difference between the expected device extents and the measured device extents.