.\"##
.\" $XConsortium: p276,v 5.2 94/04/17 20:57:37 rws Exp $
.\"##
.\"## 
$XMCOPY
.\"## Copyright (c) 1990, 1991 by Sun Microsystems, Inc. 
.\"## 
.\"##                         All Rights Reserved
.\"## 
.\"## Permission to use, copy, modify, and distribute this software and its 
.\"## documentation for any purpose and without fee is hereby granted, 
.\"## provided that the above copyright notice appear in all copies and that
.\"## both that copyright notice and this permission notice appear in 
.\"## supporting documentation, and that the name of Sun Microsystems,
.\"## not be used in advertising or publicity 
.\"## pertaining to distribution of the software without specific, written 
.\"## prior permission.  
.\"## 
.\"## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
.\"## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
.\"## EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
.\"## CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
.\"## USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
.\"## OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\"## PERFORMANCE OF THIS SOFTWARE.
.TH "SAMPLE STROKE" 3P "29 February 1991"
.SH NAME
SAMPLE STROKE \- sample the current measure of a stroke device
.IX "Stroke Input Devices" "SAMPLE STROKE"
.SH SYNOPSIS
.SS C Syntax
.ft B
.ta 1.25i 3i
.nf
void
psample_stroke ( ws, dev, view_ind, stroke )
Pint	ws;	\fIworkstation identifier\fP
Pint	dev;	\fIstroke device number\fP
Pint	*view_ind	\fI\s-2OUT\s+2 view index\fP
Ppoint_list	*stroke;	\fI\s-2OUT\s+2 locator postion\fP
.fi
.ft R
.SS Required PHIGS Operating States
(PHOP, WSOP, *, *)
.SH DESCRIPTION
.SS Purpose
Use \s-2SAMPLE STROKE\s+2 to sample the current measure of the specified
stroke device without waiting for input from the operator. The device
must be in \s-2SAMPLE\s+2 mode.
See \s-2SET STROKE MODE\s+2 and \s-2INITIALIZE STROKE\s+2 for more
information.
.SS C Input Parameters
.IP \fIws\fP
Workstation identifier. An integer specifying the workstation with which
the specified stroke device is associated.
.IP \fIdev\fP
The device number of the stroke device to be sampled.
See the \fIAvailable Devices\fP section of \s-2INITIALIZE STROKE\s+2
for a description of the available devices.
.SS C Output Parameters
.IP \fIview_ind\fP
The view index used to transform the
Device Coordinate (\s-2DC\s+2) positions
to World Coordinate (\s-2WC\s+2) points.
.IP \fIstroke\fP
Ppoint_list is defined in phigs.h as follows:
.sp .4
.ta .5i +\w'Ppoint     'u +\w'num_points;     'u
.nf
typedef struct {
.sp .2
	Pint	num_points;
	Ppoint	*points;
.sp .2
} Ppoint_list;
.fi
.IP
\fInum_points\fP is the number of points in \fIpoints\fP.
.IP
\fIpoints\fP is the array of Ppoint structures specifying the
points in \s-2WC\s+2.
\fBThis array must be allocated by the calling program
and the array pointer assigned to this field before calling this
function.\fP
The array must be at least as large as the buffer of the
\s-2STROKE\s+2 device.
This buffer size is set when the device is initialized.
Ppoint is defined in phigs.h as follows:
.sp .4
.ta .5i +\w'Pfloat     'u +\w'x;     'u
.nf
typedef struct {
.sp .2
	Pfloat	x;	/* x coordinate */
	Pfloat	y;	/* y coordinate */
.sp .2
} Ppoint;
.fi
.SS Execution
\s-2SAMPLE STROKE\s+2 samples the specified stroke device. The
device must be in \s-2SAMPLE\s+2 mode.
See \s-2SET STROKE MODE\s+2 and \s-2INITIALIZE STROKE\s+2 for more
information.
.LP
When a device is set to \s-2SAMPLE\s+2 mode, a measure process is created
for the device and the device is activated. When \s-2SAMPLE STROKE\s+2 is
called, the current value of the measure process for the specified device
is retrieved without waiting for further input from the operator.
.LP
A \s-2STROKE\s+2 device measure consists of a list of \s-2WC\s+2
\fIpoints\fP and a \fIview index\fP.
The \fIpoints\fP correspond to positions on the workstation selected by the
operator.
The \fIview index\fP is the index of the view used to transform
these positions from \s-2DC\s+2 to \s-2WC\s+2.
See \s-2INITIALIZE STROKE\s+2 and
\s-2SET VIEW TRANSFORMATION INPUT PRIORITY\s+2 for a
description of how this view representation is determined.
The workstation transformation is used to map the \s-2DC\s+2
position to a Normalized Projection Coordinate (\s-2NPC\s+2) position.
.LP
\fBNote:\fP The \s-2\&2D\s+2 and \s-2\&3D\s+2
stroke measure processes are the same except
that the \s-2\&2D\s+2 process discards the \fIz\fP coordinate.
The \s-2\&3D\s+2 version of this
function, \s-2SAMPLE STROKE 3\s+2, can be used if the value of the \fIz\fP
coordinate is needed.
.SH ERRORS
.IP 003
Ignoring function, function requires state (\s-2PHOP, WSOP, *, *\s+2)
.IP 054
Ignoring function, the specified workstation is not open
.IP 061
Ignoring function, specified workstation is neither of category \s-2INPUT\s+2
nor of category \s-2OUTIN\s+2
.IP 250
Ignoring function, the specified device is not available
on the specified workstation
.IP 252
Ignoring function, the function requires the input device to be in \s-2SAMPLE\s+2 mode
.SH SEE ALSO
.nf
.IP
.ta 0.5i
.SM "INITIALIZE STROKE (3P)"
.SM "SET STROKE MODE (3P)"
.SM "REQUEST STROKE 3 (3P)"
.SM "GET STROKE (3P)"
.SM "INQUIRE STROKE DEVICE STATE (3P)"
.SM "SET VIEW TRANSFORMATION INPUT PRIORITY (3P)"
.SM "SAMPLE STROKE 3 (3P)"
.fi
