void pinit_stroke3 (ws_id, stroke_dev, init_view_index, init_stroke_pos, pet, echo_volume, stroke_data_rec)
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
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;
Device number 1 is associated with the mouse.
The following echo types are available:
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();
}