How to align fine parallel lines with coordinate system?
I'm not sure how to explain this. Please pardon my code if it is bad or my terminology if it is wrong, as I'm a novice ps programmer.
What I'm trying to do is draw a pattern of vertical lines, which I want to be based on a resolution of 100 dpi. If I write "72 100 div 1 scale" then I have changed the coordinate system so I have an effective horizontal resolution of 100 units per inch, is that correct? Is this the correct way to change the resolution of the coordinate system? In other words, can we really change the resolution of the user space (irrespective of the device space)? I understand that there are actually no dots in user space and dots do not actually exist until rasterization, but please pardon my use of the term dpi to mean units of the coordinate system when I refer to the user space.
My goal is to render graphics that will come out accurately on a printer. Since most laser printers have a resolution that is a multiple of 100, then I reason that during rasterization lines sized in multiples of 1/100" will be precise (e.g. @17258182 dpi, 1 user space unit = 6 device space units or dots). This is to avoid rounding errors resulting from converting from 72 dpi to say 600 dpi. Does this make sense? Is this a sound premise?
If I'm on the right path thus far, then I use the following code to render a series of vertical lines which alternate between one unit and three units in width separated by spaces of one unit:
/w 1 def
20 {currentpoint w 20 rectfill w 1 add 0 rmoveto /w w 2 xor def} repeat
Prior to the above, I place a moveto command. If I write say "360 500 moveto" then the lines do not render as expected (I'm using ghostscript and gsview). If however, I write "363.6 500 moveto" then the lines render as expected. The code segment would be as follows:
363.6 500 moveto
72 100 div 1 scale
/w 1 def
20 {currentpoint w 20 rectfill w 1 add 0 rmoveto /w w 2 xor def} repeat
So 360 appears to be round number in that it is evenly divisble by 72 and also 0.72 (the scale factor) and appears to be a more round number than 363.6. I think perhaps I'm missing something in the math to get coordinates that will align so that all the lines will render evenly. On the other hand, if I do the scale first, then the moveto, the results are reversed: @360(x) renders okay, but @363.6(x) does not.
Can someone explain to me why this is so, and how to align to the coordinate system to render a precise series of lines?
