Previous Next Up Title Contents Index Functions Index Top Library

INITIALIZE STROKE

pinit_stroke3


CALL SEQUENCE

void pinit_stroke3 (ws_id, stroke_dev, init_view_index, init_stroke_pos, pet, echo_volume, stroke_data_rec)

INPUT PARAMETERS

Pint	ws_id,
Pint	stroke_dev,
Pint 	init_view_index,
const Ppoint_list3	*init_stroke_pos,
Pint 	pet,
const Plimit3	*echo_volume,
const Pstroke_data3	*stroke_data_rec

ARGUMENTS

ws_id,
Workstation identifier
stroke_dev,
Stroke device number
init_view_index,
Initial view index
init_stroke_pos,
Initial stroke position
pet,
Prompt and echo type
echo_volume,
Echo volume
stroke_data_rec
Data record

TYPES

typedef struct {
	Pint	num_points;	/* number of Ppoint3s in the list	*/
	Ppoint3	*points;	/* list of points	*/
} Ppoint_list3;

typedef struct {
	Pfloat	x_min;	/* minimum x 	*/
	Pfloat	x_max;	/* maximum x 	*/
	Pfloat	y_min;	/* minimum y 	*/
	Pfloat	y_max;	/* maximum y 	*/
	Pfloat	z_min;	/* minimum z 	*/
	Pfloat	z_max;	/* maximum z 	*/
} Plimit3;
typedef struct {
	Pint			in_buf_size;	/* input buffer size	*/
	Pint			init_pos;	/* initial editing position	*/
	Pfloat		x_interval;	/* x interval	*/
	Pfloat		y_interval;	/* y interval	*/
	Pfloat		z_interval;	/* z interval	*/
	Pfloat		time_interval;	/* time interval	*/
	union 		stroke3_pets {
		struct Pstroke3_pet_r1 {
			int	impl_dep;
		} pet_r1;
		struct Pstroke3_pet_r2 {
			int	impl_dep;
		} pet_r2;
		struct Pstroke3_pet_r3 {
			Pmarker_attrs	marker_attrs;	/* marker attributes */
		} pet_r3;
		struct Pstroke3_pet_r4 {
			Pline_attrs	line_attrs;	/* polyline attributes */
		} pet_r4;
		int	impl_dep;
	} pets;
} Pstroke_data3;

typedef struct {
	Pfloat 	x;	/* x coordinate	*/
	Pfloat 	y;	/* y coordinate	*/
	Pfloat 	z;	/* z coordinate	*/
} Ppoint3;

PHIGS STATE

(PHOP, WSOP, *, *).

EFFECT

This function initializes the STROKE 3 input device (input of a series of points in space) number stroke_dev for the workstation ws_id.

Device number 1 is associated with the mouse.

The following echo types are available:

For all echo types the following fields of a Pstroke_data structure must be initialized:

Pstroke_data stroke_data_rec;

stroke_data_rec.in_buf_size = Maximum number of points that may be returned by the stroke input.

stroke_data_rec.init_pos = initial editing position in the list of initial points.

stroke_data_rec.x_interval = Minimum x interval before automatic validation of a new position.

stroke_data_rec.y_interval = Minimum y interval before automatic validation of a new position.

stroke_data_rec.z_interval = Minimum z interval before automatic validation of a new position.

stroke_data_rec.time_interval = Minimum time interval in seconds before automatic validation of a new position.

NB: A new position will be generated automatically if one or more of the intervals is exceeded.

For echo type 3 the following fields of a Pstroke_data structure must be initialized:

stroke_data_rec.pets.pet_r3.marker_attrs.type_asf = ASF of marker type.

stroke_data_rec.pets.pet_r3.marker_attrs.size_asf = ASF for marker size.

stroke_data_rec.pets.pet_r3.marker_attrs.colr_ind_asf = ASF for marker colour index.

stroke_data_rec.pets.pet_r3.marker_attrs.ind = marker index.

stroke_data_rec.pets.pet_r3.marker_attrs.bundle.type = marker type.

stroke_data_rec.pets.pet_r3.marker_attrs.bundle.size = marker size.

stroke_data_rec.pets.pet_r3.marker_attrs.bundle.colr_ind = marker colour index.

GPHIGS will use marker index to access marker type, marker size or marker colour index if corresponding ASF is set to PASF_BUNDLED. Otherwise the marker type, marker size and marker colour index of the bundle field will be used if corresponding ASF is set to PASF_INDIV. Echo of new positions will appear on the screen with specified attributes.

For echo type 4,10 and 11 the following fields of a Pstroke_data structure must be initialized:

stroke_data_rec.pets.pet_r4.line_attrs.type_asf = ASF of line style.

stroke_data_rec.pets.pet_r4.line_attrs.width_asf = ASF for line width.

stroke_data_rec.pets.pet_r4.line_attrs.colr_ind_asf = ASF for line colour index.

stroke_data_rec.pets.pet_r4.line_attrs.ind = line index.

stroke_data_rec.pets.pet_r4.line_attrs.bundle.type = line style.

stroke_data_rec.pets.pet_r4.line_attrs.bundle.width = line width.

stroke_data_rec.pets.pet_r4.line_attrs.bundle.colr_ind = line colour index.

GPHIGS will use line index to access line style, line width or line colour index if corresponding ASF is set to PASF_BUNDLED. Otherwise the line style, line width and line colour index of the bundle field will be used if corresponding ASF is set to PASF_INDIV. Echo of new positions will appear on the screen with specified attributes.

Example:

/* Stroke sample program */
#include <phigs.h>

main()
{
	Pstroke_data  stroke_data;
	Plimit echo_area,req_win,cur_win,req_view;
	Pupd_st update_state;
	Ppoint_list list_points;
	Ppoint initial_points[3];
	Pint error,ws_id,stroke_dev,init_view_index,pet;

/* Open PHIGS session */
	popen_phigs(PDEF_ERR_FILE,PDEF_MEM_SIZE);

/* Open workstation */
	ws_id = 1;
	popen_ws(ws_id,"/dev/tty",8887);

/* Get back device coordinates of the workstation */
	pinq_ws_tran(ws_id,&error,&update_state,&req_win,
			&cur_win,&req_view,&echo_area);
/* Initialize stroke with 3 initial points using echo number 11, echoing is done using a dashed blue polyline of width 3. */
	stroke_data.in_buf_size = 3;
	stroke_data.init_pos = 1;
	stroke_data.x_interval = 10;
	stroke_data.y_interval = 10;
	stroke_data.time_interval = 10000;
	stroke_data.pets.pet_r4.line_attrs.type_asf = PASF_INDIV;
	stroke_data.pets.pet_r4.line_attrs.width_asf = PASF_INDIV;
	stroke_data.pets.pet_r4.line_attrs.colr_ind_asf = PASF_INDIV;
	stroke_data.pets.pet_r4.line_attrs.bundle.type = 2;
	stroke_data.pets.pet_r4.line_attrs.bundle.width = 3.;
	stroke_data.pets.pet_r4.line_attrs.bundle.colr_ind = 4;
	pet = 11;
	stroke_dev = 1;
	init_view_index = 0;
	initial_points[0].x = .1; initial_points[0].y = .1;
	initial_points[1].x = .3; initial_points[0].y = .5;
	initial_points[2].x = .6; initial_points[0].y = .2;
	list_points.num_points = 3;
	list_points.points = initial_points;
	pinit_stroke(ws_id,stroke_dev,init_view_index,
			&list_points,pet,&echo_area,&stroke_data);

/* Close workstation */
	pclose_ws(ws_id);

/* Close PHIGS */
	pclose_phigs();
}

ERRORS

3
Ignoring function, function requires state (PHOP, WSOP,*,*)
54
Ignoring function, the specified workstation is not open
61
Ignoring function, specified workstation is neither of category INPUT nor of category OUTIN
250
Ignoring function, the specified device is not available on the specified workstation
251
Ignoring function, the function requires the input device to be in REQUEST mode
254
Ignoring function, invalid echo area volume: XMIN>>=XMAX, YMIN>>=YMAX or ZMIN>>ZMAX
255
Ignoring function, one of the echo area volume boundary points is outside the range of the device
253
Ignoring function, the specified prompt echo type is not available on the specified workstation
260
Ignoring function, one of the fields within the input device data record is in error
261
Ignoring function, initial value is invalid
262
Ignoring function, number of points in the initial stroke is greater than the buffer size
114
Ignoring function, the view index value is less than zero

SEE ALSO

initialize stroke, set stroke mode, request stroke 3, sample stroke 3, get stroke 3, inquire stroke device state 3, inquire default stroke device state 3, inquire number of available logical input devices


Previous Next Up Title Contents Index Functions Index Top Library