Path: utzoo!attcan!telly!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!msi.umn.edu!noc.MR.NET!gacvx2.gac.edu!gacvx2.gac.edu!scott From: scott@erick.gac.edu (Scott Hess) Newsgroups: comp.sys.next Subject: Re: Difficulties with Graphics Message-ID: Date: 22 Feb 91 15:58:33 GMT References: <11995@pt.cs.cmu.edu> <1991Feb18.213359.19939@pslu1.psl.wisc.edu> Organization: Gustavus Adolphus College Lines: 53 Nntp-Posting-Host: 138.236.10.8 In-reply-to: gessel@ilium.cs.swarthmore.edu's message of 20 Feb 91 20:43:01 GMTLines: 53 In article gessel@ilium.cs.swarthmore.edu (Daniel Mark Gessel) writes: Plotting a single pixel seems to be a pain. I usually use a rectfill, but that seems horribly inneficient (anyone have a better way?). NXRectFill is very fast for single pixel plots. I just did some testing, and found that if you draw a bunch of pixels, and then stroke them all at once, NXRectFill and PSmoveto( x, y)/PSrlineto( .5, .5) are about equivilant. Doing a stroke on every moveto/rlineto pair makes that method _much_ slower. Of course, using NXRectFillList is even faster, especially for large sets of pixels. I tested once drawing 4096 pixels, and again with 16k pixels. The results (in seconds) were: 4K 16K PS-wrap 6 24 NXRectFill 6 28 NXRectFillList 2 5 Of course, those are all of the same color, etc. You might ask why I did such a thing - boredom. Use PSmoveto(x1,y1); PSlineto(x2,y2); PSstroke(); to draw a line. You may want to use PSsetgray(graylevel); and PSsetlinewidth(width); PSrectfill(x1,y1,x2,y2); is also nice. These are calls to PSwrapped code, so it's still basically postscript. If you are able to limit line drawing to vertical and horizontal lines, NXRectFill and NXRectFillList are big winners, again. With both line and pixel drawing, the main goal is to minimize the data traffic moreso than the actual drawing time. A couple runs through the output of -NXShowPS applied to your app gives a good idea of where you're going wrong (an extra setgray per pixel will really slow things down . . .) PostScript is the way to go, it's also extremely easy to use with PSwrap and IB. Takes about a half an hour to get started, and improves your applications efficiency. It's also great to use YAP to develop your graphics! Knowing PostScript is pretty much a necessity when programming the NeXT. Hey, don't forget the most important part - it's darn fun to play with Postscript . . . Later, -- scott hess scott@gac.edu Independent NeXT Developer GAC Undergrad "Tried anarchy, once. Found it had too many constraints . . ." "Buy `Sweat 'n wit '2 Live Crew'`, a new weight loss program by Richard Simmons . . ." Brought to you by Super Global Mega Corp .com