WacomDevice.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Kenneth A. Pier, January 10, 1992 11:04 am PST
Contents: Routines for creating instances of the Wacom pressure-sensitive tablet and representing the state of such a device.
DIRECTORY
DeviceClassTypes, DeviceTypes, Rope;
WacomDevice:
CEDAR
DEFINITIONS =
BEGIN
Device: TYPE = DeviceTypes.Device;
DeviceClass: TYPE = DeviceClassTypes.DeviceClass;
DeviceState: TYPE = DeviceTypes.DeviceState;
DeviceStateChange: TYPE = DeviceTypes.DeviceStateChange;
Class Routines
CreateWacom:
PROC [name: Rope.
ROPE]
RETURNS [device: Device];
Create a data structure representing a particular physical Wacom. Calls class.create[class].
AllocateState:
PROC [device: Device]
RETURNS [deviceState: DeviceState];
Allocates storage representing the state of this device at [0, 0] with minimum pressure. Each DeviceState is immutable, so they may be freely stored in long-term storage.
Representing Wacom State Changes
PenXChange: PROC [x: INTEGER] RETURNS [change: DeviceStateChange];
PenYChange: PROC [y: INTEGER] RETURNS [change: DeviceStateChange];
PressureChange: PROC [p: INTEGER] RETURNS [change: DeviceStateChange];
StateAfterChange: PROC [deviceState: DeviceState, change: DeviceStateChange] RETURNS [newDeviceState: DeviceState];
ChangeKind: TYPE = {penX, penY, pressure};
ExpandedChange:
TYPE =
RECORD [
contents:
SELECT kind: ChangeKind
FROM
penX => [x: INTEGER],
penY => [y: INTEGER],
pressure => [p: INTEGER]
ENDCASE
];
UnpackChange: PROC [change: DeviceStateChange] RETURNS [expanded: ExpandedChange];
Convenience State Changes
PenNewState: PROC [deviceState: DeviceState, x, y, p: INTEGER] RETURNS [newDeviceState: DeviceState];
GetPen: PROC [deviceState: DeviceState] RETURNS [x, y, p: INTEGER];
IsComplete:
PROC [deviceState: DeviceState]
RETURNS [
BOOL];
returns TRUE if both x and y coordinates in this state are valid coordinates
END.