R-alpha: more on line types

Ben Bolker ben@eno.Princeton.EDU
Wed, 30 Jul 1997 10:50:05 -0400 (EDT)


   forgot to fix psx11.c and devPicTeX.c while I was at it (devPicTeX.c
doesn't seem to change the color).  Should psx11.c be devpsx11.c?  Diffs:

*** psx11.c.orig	Wed Jul 30 10:08:48 1997
--- psx11.c	Wed Jul 30 10:09:10 1997
***************
*** 293,298 ****
--- 293,299 ----
  	}
  	if(fg != NA_INTEGER) {
  		psx11_SetColor(fg);
+ 		psx11_SetLinetype(GP->lty);
  		PostScriptOpenRectangle(psfp,
  			xoffset + xscale * x0,
  			yoffset + yscale * y0,
*** devPicTeX.c.orig	Wed Jul 30 10:16:33 1997
--- devPicTeX.c	Wed Jul 30 10:11:24 1997
***************
*** 446,451 ****
--- 446,452 ----
  /* Possibly Filled Rectangle */
  static void PicTeX_Rect(double x0, double y0, double x1, double y1, int bg, int fg)
  {
+         SetLinetype(GP->lty);
  	PicTeX_MoveTo(x0, y0);
  	PicTeX_LineTo(x1, y0);
  	PicTeX_LineTo(x1, y1);

   A less trivial question about setting line widths: in X, the same call
(XSetLineAttributes) sets both line type and line width.  In PostScript
there are two separate calls.

  The following quick hack to SetLinetype() appears to work pretty well
for X11, although there may be a better way to do it (logically,
SetLinetype ought to take both lty and lwd as arguments, or there should
be a separate SetLinewidth -- however, if there were two functions each
would have to look at least briefly at the current settings so as not to
screw them up):

  Before doing this in PostScript (where the width and type are set in
separate calls), I'd like advice.
  Also, is there a particular reason that default line width in PostScript
is 0.75 and not 1.0?

*** devX11.c.orig	Tue Jul 29 16:44:19 1997
--- devX11.c	Wed Jul 30 10:21:43 1997
***************
*** 389,395 ****
  
  	if(newlty != lty) {
  		if(newlty == 0) {
! 			XSetLineAttributes(display, wgc, 1, LineSolid, CapRound, JoinRound);
  			lty = newlty;
  		}
  		else {
--- 389,395 ----
  
  	if(newlty != lty) {
  		if(newlty == 0) {
! 			XSetLineAttributes(display, wgc, GP->lwd, LineSolid, CapRound, JoinRound);
  			lty = newlty;
  		}
  		else {
***************
*** 400,406 ****
  				newlty = newlty>>4;
  			}
  			XSetDashes(display, wgc, 0, dashlist, ndash);
! 			XSetLineAttributes(display, wgc, 1,
  				LineOnOffDash, CapButt, JoinRound);
  		}
  	}
--- 400,406 ----
  				newlty = newlty>>4;
  			}
  			XSetDashes(display, wgc, 0, dashlist, ndash);
! 			XSetLineAttributes(display, wgc, GP->lwd,
  				LineOnOffDash, CapButt, JoinRound);
  		}
  	}





Benjamin Bolker          Dep't of Ecology and Evolutionary Biology,
ben@eno.princeton.edu    Princeton University
tel: (609) 258-6886,     fax: (609) 258-1334

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-