www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

dotgrid.ps (774B)


      1 %!PS
      2 % Adjust these to suit your needs, units specified in "points" (1/72 inch)
      3 /w 612 def /h 792 def      % US Letter paper
      4 /sp 5 72 mul 25.4 div def  % Grid spacing (5 mm here)
      5 /st 1.5 72 mul 300 div def % Dot radius (1 'dots' in a 300 dpi resolution)
      6 /co 0.0 def                % Gray-level of the line (0 = black, 1 = white)
      7 
      8 % Remainder function (`mod` doesn't take floating point values)
      9 /r {dup 3 1 roll div dup floor sub mul} def
     10 % Return the starting offset that centers the grid
     11 /o {r 2 div} def
     12 % Draw a dot (x y -- )
     13 /dot {st 0 360 arc closepath fill} def
     14 
     15 % Page and line setup
     16 << /PageSize [w h] >> setpagedevice
     17 co setgray
     18 h sp o
     19 sp h
     20 {
     21     w sp o
     22     sp w
     23     {
     24         1 index     % (y x -- y x y)
     25         dot         % (y x y -- y)
     26     } for
     27     pop
     28 } for