lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lout debugging


From: mzukowski
Subject: Re: Lout debugging
Date: Thu, 16 Sep 1999 16:18:39 -0700

Following Uwe's suggestion, I came up with these definitions to help me
debug and would like to share them with the list.  The first one will print
a blue quarter inch grid behind the object.  The second one draws a red
outline around the object.  It may not be the best PostScript code, I stole
it from the PostScript blue book and the expert guide, but it works.  I
couldn't figure any way to pass in a parameter such as the outline color or
grid spacing, but it's easy enough to twiddle as you need it.

def @GridBackground right obj {
{
0 0.25 in xsize
"{" 0 moveto
  0 ysize rlineto "}" for

0 0.25 in ysize
"{" 0 exch moveto
  xsize 0 rlineto "}" for
0 setlinewidth 
0.0 0.0 1.0 setrgbcolor 
stroke
}       
        @Graphic obj
} 

def @ObjectOutline right obj {
{
0 0 moveto
0 ysize lineto
xsize ysize lineto
xsize 0 lineto
closepath 
1.0 0.0 0.0 setrgbcolor 
0 setlinewidth 
stroke
}       
        @Graphic obj
} 


Actually I figured out how to pass in spacing but couldn't figure out how to
let people pass in "yellow" instead of an RGB triple, as below:

def @GridBackground 
import @LengthUnits named spacing {0.25i}
named color { 0.0 0.0 1.0 }
right obj {
{
" 0 " spacing " xsize { 0 moveto  0 ysize rlineto } for 0 " spacing 
" ysize { 0 exch moveto  xsize 0 rlineto } for 0 setlinewidth"
 color setrgbcolor "stroke"
}       
        @Graphic obj
} 

Happy hacking,

Monty


reply via email to

[Prev in Thread] Current Thread [Next in Thread]