Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!apple!sun-barr!newstop!sun!imagen!isaak From: isaak@imagen.UUCP (Mark Isaak) Newsgroups: comp.lang.postscript Subject: Re: Thin line woes Message-ID: <15253@imagen.UUCP> Date: 15 Aug 90 19:39:34 GMT References: <10244@pt.cs.cmu.edu> Organization: Imagen Corp., Santa Clara CA Lines: 39 in article <10244@pt.cs.cmu.edu>, tgl@zog.cs.cmu.edu (Tom Lane) says: > > 1. Line width variation occurs even with "0.12 setlinewidth". On a > 300dpi printer this width is exactly half a pixel. I don't understand > how this could be translated into a two-pixel-wide line, no matter where > the endpoint positions fall. If anyone can explain the exact algorithm > for deciding which pixels get blackened, I would be grateful. Adobe's painting algorithm says to blacken every pixel which is touched by the shape, no matter how little of the pixel falls inside. This has the effect of making the line you asked to be n pixels wide appear to be n+1 pixels wide instead. The situation is complicated by diagonal lines, which you generally don't _want_ the same width. Depending on their width, slope, and positioning, the lines can appear one pixel wider along some patches than others. You can eliminate this artifact by correcting the width, but the corrections are different for different slopes. QMS/Imagen's UltraScript does this correction automatically for thin lines, and Display PostScript and PostScript Level 2 have a "setstrokeadjust" operator which will do it. The simplest solution otherwise is to specify "0 setlinewidth", which will give a nice-looking one-pixel-wide line at all angles. For slightly wider diagonals, some combination of endpoint rounding and/or width correction may be desirable. > 2. In the book "Real World PostScript" (Roth, ed.), Michael Fryd > recommends rounding endpoint coordinates to nearest-integer-plus-0.25 > in device space, whereas the green book just shows rounding to nearest > integer. Which of these is better, and why? For horizontal and vertical lines, it shouldn't matter in theory, although adding +0.25 might avoid some obscure round-off errors in practice (That last part is just a guess). I'm not sure how the difference would affect diagonal lines. -- Mark Isaak {decwrl,sun}!imagen!isaak or imagen!isaak@decwrl.dec.com "Convictions are more dangerous enemies of truth than lies." - Nietzsche