I suspect that a few s/def/bind def/ on that prologue might improve things a bit.
The ps R creates freely switches between the sRGB ABC space and setgray. That is a good thing; it helps ensure that black will be just black when sent to a CMYK device. Without that you can get CMY black from some devices. But it does complicate things. (CMYK devices often use CMY black rather than K black when the source is RGB black because it is better when printing contone images, such as photographs. But it just wastes ink and toner when printing charts and similar graphics.) The best improvement would be to have R keep track of the last colorspace and only run the srgb procedure when switching from DeviceGray, rather than every time it changes the RGB colour. The SetColor() function in R/src/library/grDevices/src/devPS.c looks to be the place to do that. The Invalidate() function and the PostScriptDesc struct there also need to track any such changes. -JimC -- James Cloos <cl...@jhcloos.com> OpenPGP: 1024D/ED7DAEA6 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.