diff -urN gnuplot-3.7.1.orig/bitmap.c gnuplot-3.7.1/bitmap.c --- gnuplot-3.7.1.orig/bitmap.c Mon Oct 11 18:10:54 1999 +++ gnuplot-3.7.1/bitmap.c Thu Mar 30 21:49:13 2000 @@ -75,6 +75,7 @@ unsigned int b_psize; /* size of each plane */ unsigned int b_rastermode; /* raster mode rotates -90deg */ unsigned int b_linemask = 0xffff; /* 16 bit mask for dotted lines */ +unsigned int b_masksize = 16; /* number of bits in linemask */ unsigned int b_value = 1; /* colour of lines */ unsigned int b_hchar; /* width of characters */ unsigned int b_hbits; /* actual bits in char horizontally */ @@ -954,7 +955,7 @@ if ((b_linemask >> b_maskcount) & (unsigned int) (1)) { b_setpixel(x, y, value); } - b_maskcount = (b_maskcount + 1) % 16; + b_maskcount = (b_maskcount + 1) % b_masksize; b_lastx = x; /* last pixel set with mask */ b_lasty = y; } @@ -1120,9 +1121,76 @@ if (linetype >= 7) linetype %= 7; b_linemask = b_pattern[linetype + 2]; + b_masksize = 16; /* all of the default patterns are 16 bits */ b_maskcount = 0; } +/* + * set b_linemask and b_masksize to custom values + */ +void b_setlinemask(linemask,masksize) +unsigned int linemask; +int masksize; +{ + b_linemask = linemask; + b_masksize = masksize; +} + +/* + * Cruft alert! The postscript and X11 terminal drivers use a nice big + * character array to store dash patterns. In this bitmap code, we use a + * single int. Rather than expand the bitmap code to use the larger + * dash form, lets patch on a quick layer of cruft to squeeze the characters + * into the int. + */ +void b_setdashtype(dashtype) +char *dashtype; +{ + unsigned int linemask; + int i,count,maxcount; + float scale; + + if (!dashtype||!dashtype[0]||!(dashtype[0]-'0')) { + /* just use a solid line if we didn't get anything */ + b_linemask=0xffff; + b_masksize=16; + return; + } + + for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) { + count+=dashtype[i]-'0'; + } + + maxcount=sizeof(unsigned int)*(8 /* bits per byte */); + + if (count>maxcount) { + /* Oh no! They asked for a bit pattern longer than we can + * represent. We'll have to scale it down and live with it. + * + * Anybody want to code up antialiasing support? + */ + + /* This isn't the best way to do this, but I don't have enough + * caffeine right now to think of a better way. + */ + scale=(float)maxcount/(float)count; + b_linemask=0; + for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) { + if ((i+1)%2) + b_linemask|=((1<<(int)((dashtype[i]-'0')*scale+0.5))-1)<maxcount)?maxcount:count; /* allow for rounding error */ + } else { + b_masksize=count; + b_linemask=0; + for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) { + if ((i+1)%2) + b_linemask|=((1<<(dashtype[i]-'0'))-1)<pointflag = allow_points; @@ -3128,6 +3130,7 @@ arg->p_type = pt; arg->l_width = lw; arg->p_size = ps; + strncpy(arg->l_dash,dt,sizeof(arg->l_dash)); } static void reset_lp_properties(arg) @@ -3136,6 +3139,7 @@ /* See plot.h for struct lp_style_type */ arg->pointflag = arg->l_type = arg->p_type = 0; arg->l_width = arg->p_size = 1.0; + arg->l_dash[0]='\0'; } static void set_locale(lcl) diff -urN gnuplot-3.7.1.orig/term/pbm.trm gnuplot-3.7.1/term/pbm.trm --- gnuplot-3.7.1.orig/term/pbm.trm Tue Dec 15 20:21:52 1998 +++ gnuplot-3.7.1/term/pbm.trm Thu Mar 30 21:49:13 2000 @@ -364,6 +364,12 @@ } } +TERM_PUBLIC void PBMdashtype(dashtype) +char * dashtype; +{ + b_setdashtype(dashtype); +} + TERM_PUBLIC void PBMpoint(x, y, point) unsigned int x, y; int point; @@ -392,7 +398,10 @@ PBMput_text, PBMtext_angle, null_justify_text, PBMpoint, do_arrow, set_font_null, 0, /* pointsize */ - TERM_CAN_MULTIPLOT | TERM_BINARY + TERM_CAN_MULTIPLOT | TERM_BINARY, + 0 /* suspend */, 0 /* resume */, + 0 /* fillbox */, 0 /* linewidth */, + PBMdashtype TERM_TABLE_END(pbm_driver) #undef LAST_TERM diff -urN gnuplot-3.7.1.orig/term/post.trm gnuplot-3.7.1/term/post.trm --- gnuplot-3.7.1.orig/term/post.trm Thu Aug 19 15:16:33 1999 +++ gnuplot-3.7.1/term/post.trm Thu Mar 30 21:48:36 2000 @@ -82,6 +82,7 @@ TERM_PUBLIC int ENHPS_set_font __PROTO((char * font)); TERM_PUBLIC void PS_fillbox __PROTO((int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height)); TERM_PUBLIC void PS_linewidth __PROTO((double linewidth)); /* JFi [linewidth] */ +TERM_PUBLIC void PS_dashtype __PROTO((char * dashtype)); /* JFi [dashtype] */ TERM_PUBLIC void PS_pointsize __PROTO((double ptsize)); /* JFi [pointsize] */ #define PS_POINT_TYPES 8 @@ -159,8 +160,10 @@ "/UP { dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def\n", " /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def } def\n", /* Dash or Color Line */ -"/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }\n", -" {pop pop pop Solid {pop []} if 0 setdash} ifelse } def\n", +"/DL { Color {setrgbcolor UserDash {pop userdashtype} {Solid {pop []} if}\n", +" ifelse 0 setdash }\n", +" {pop pop pop UserDash {pop userdashtype} {Solid {pop []} if} ifelse\n", +" 0 setdash} ifelse } def\n", /* Border Lines */ "/BL { stroke userlinewidth 2 mul setlinewidth } def\n", /* Axes Lines */ @@ -168,6 +171,9 @@ /* set user defined linewidth */ "/UL { dup gnulinewidth mul /userlinewidth exch def\n", " 10 mul /udl exch def } def\n", +/* set user defined dashtype */ +"/UD { /userdashtype exch def\n", +" } def\n", /* Plot Lines */ "/PL { stroke userlinewidth setlinewidth } def\n", /* Line Types */ @@ -664,6 +670,7 @@ /gnudict 256 dict def\ngnudict begin\n\ /Color %s def\n\ /Solid %s def\n\ +/UserDash false def\n\ /gnulinewidth %.3f def\n\ /userlinewidth gnulinewidth def\n\ /vshift %d def\n\ @@ -1038,6 +1045,40 @@ } +TERM_PUBLIC void PS_dashtype (dashtype) +char * dashtype; +{ + fprintf(gpoutfile,"/UserDash %s def\n",(*dashtype)&&(*dashtype-'0')?"true":"false"); + fprintf(gpoutfile,"["); + while (*dashtype) { + fprintf(gpoutfile,"%c dl ",*(dashtype++)); + } + fprintf(gpoutfile,"] UD\n"); + +/* + Documentation of the 'change dashtype' strategy of the postscript terminal: + + 1. define a new postscript variable with a default value: + /userdashtype gnudashtype def + + 2. define a new postscript command to change the contents of that variable: + /UD { gnudashtype /userdashtype exch def } def + usage: multiplication_factor UL + + 3. modify the already known postscript command /DL for the plot lines: + /PL { stroke userlinewidth setlinewidth } def + + 4. issue the new command before every change of the plot linestyle: + example: + 4.0 UL + LT0 + result: + Linetype 0 is drawn four times as thick as defined by the contents + of the postscript variable 'gnulinewidth'. +*/ +} + + TERM_PUBLIC void PS_pointsize (ptsize) double ptsize; { @@ -1650,7 +1691,8 @@ PS_text, null_scale, PS_graphics, PS_move, PS_vector, PS_linetype, PS_put_text, PS_text_angle, PS_justify_text, PS_point, do_arrow, PS_set_font, PS_pointsize, - 0 /*flags*/, 0 /*suspend*/, 0 /*resume*/, PS_fillbox, PS_linewidth + 0 /*flags*/, 0 /*suspend*/, 0 /*resume*/, PS_fillbox, PS_linewidth, + PS_dashtype TERM_TABLE_END(post_driver) diff -urN gnuplot-3.7.1.orig/term/x11.trm gnuplot-3.7.1/term/x11.trm --- gnuplot-3.7.1.orig/term/x11.trm Wed Aug 25 17:16:40 1999 +++ gnuplot-3.7.1/term/x11.trm Thu Mar 30 21:48:36 2000 @@ -53,6 +53,7 @@ TERM_PUBLIC void X11_move __PROTO((unsigned int x, unsigned int y)); TERM_PUBLIC void X11_vector __PROTO((unsigned int x, unsigned int y)); TERM_PUBLIC void X11_linewidth __PROTO((double lw)); +TERM_PUBLIC void X11_dashtype __PROTO((char * lw)); TERM_PUBLIC void X11_pointsize __PROTO((double ps)); TERM_PUBLIC void X11_linetype __PROTO((int lt)); TERM_PUBLIC void X11_put_text __PROTO((unsigned int x, unsigned int y, char str[])); @@ -584,6 +585,13 @@ } TERM_PUBLIC void +X11_dashtype(dt) +char *dt; +{ + PRINT1("D%s\n", dt); +} + +TERM_PUBLIC void X11_linetype(lt) int lt; { @@ -641,7 +649,7 @@ X11_justify_text, X11_point, do_arrow, set_font_null, X11_pointsize, TERM_CAN_MULTIPLOT, X11_text /* suspend can use same routine */ , 0 /* resume */ , - X11_fillbox, X11_linewidth + X11_fillbox, X11_linewidth, X11_dashtype TERM_TABLE_END(x11_driver) #undef LAST_TERM @@ -656,7 +664,7 @@ X11_justify_text, X11_point, do_arrow, set_font_null, X11_pointsize, TERM_CAN_MULTIPLOT, X11_text /* suspend can use same routine */ , 0 /* resume */ , - X11_fillbox, X11_linewidth + X11_fillbox, X11_linewidth, X11_dashtype TERM_TABLE_END(X11_driver) #undef LAST_TERM diff -urN gnuplot-3.7.1.orig/term.c gnuplot-3.7.1/term.c --- gnuplot-3.7.1.orig/term.c Fri Oct 1 11:37:23 1999 +++ gnuplot-3.7.1/term.c Thu Mar 30 21:48:36 2000 @@ -439,6 +439,7 @@ * The linetype might depend on the linewidth in some terminals. */ (*term->linewidth) (lp->l_width); + (*term->dashtype) (lp->l_dash); (*term->linetype) (lp->l_type); }