2 #include <Xw_Extension.h>
4 /* ifdef then trace on */
10 STATUS Xw_def_type (atypemap,index,length,desc):
11 XW_EXT_TYPEMAP *atypemap
12 int index Line type index
13 int length Descriptor length
14 float *desc Type Descriptor
16 Update Line Type Extended typemap index with the specified TYPE values . Descriptor is an array of float.Each value give the subline length
17 in MM .First subline is the draw part,Second the hidden part,
18 Thirst the drawn part ...
19 NOTE than type index 0 is the Default Type (SOLID)
20 and cann't be REDEFINED
22 Returns ERROR if BadType Index
23 Returns SUCCESS if Successful
28 XW_STATUS Xw_def_type (void* atypemap,
29 int index,int length,float* desc)
31 XW_STATUS Xw_def_type (atypemap,index,length,desc)
36 #endif /*XW_PROTOTYPE*/
38 XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap ;
40 unsigned char *pdesc ;
43 if ( !Xw_isdefine_typeindex(ptypemap,index) ) {
45 Xw_set_error(18,"Xw_def_type",&index) ;
49 if( !desc || length < 0 ) {
50 /*Bad Type descriptor data*/
51 Xw_set_error(19,"Xw_def_type",&index) ;
55 if( ptypemap->types[index] ) Xw_free(ptypemap->types[index]) ;
56 ptypemap->types[index] = NULL ;
59 ptypemap->types[index] = pdesc = (unsigned char*) Xw_malloc(length+1) ;
61 screen = ScreenOfDisplay(_TDISPLAY,DefaultScreen(_TDISPLAY)) ;
63 for( i=0 ; i<length ; i++ ) {
65 ptype = (int) (0.5 + (desc[i] * (float)WidthOfScreen(screen)/
66 (float)WidthMMOfScreen(screen))) ;
67 if( desc[i] == 0. || ptype < 0 || ptype > 255 ) {
68 /*Bad Type descriptor data*/
69 Xw_set_error(19,"Xw_def_type",&index) ;
71 pdesc[i] = (unsigned char) (ptype) ? ptype : 1 ;
78 if( Xw_get_trace() ) {
79 printf (" Xw_def_type(%lx,%d,%d,{",(long ) ptypemap,index,length);
80 for ( i=0 ; i<length-1 ; i++ ) printf("%f,",desc[i]) ;
81 printf("%f})\n",desc[length-1]) ;