First VersionSecond VersionThird Version
%!PS-Adobe-2.0
newpath %Begin black box
  252 324 moveto
  0 72 rlineto
  72 0 rlineto
  0 -72 rlineto
  closepath
  fill
newpath %Begin gray box
  270 360 moveto
  0 72 rlineto
  72 0 rlineto
  0 -72 rlineto
  closepath
  .4 setgray
  fill
newpath %Begin lighter box       
  288 396 moveto
  0 72 rlineto
  72 0 rlineto
  0 -72 rlineto
  closepath
  .8 setgray
  fill
showpage %Send to printer
%!PS-Adobe-2.0
% Define box procedure      
/box
{ 72 0 rlineto
  0 72 rlineto  
  -72 0 rlineto  
  closepath } def
  
% Begin Program 
newpath % First box
  252 324 moveto box
  0 setgray fill
newpath % Second box
  270 360 moveto box
  .4 setgray fill
newpath % Third box
  288 396 moveto box  
  .8 setgray fill
showpage
%!PS-Adobe-2.0
% Define procedures
/inch {72 mul} def

/box  % stack: x y => ---
{ newpath moveto
  1 inch 0 rlineto
  0 1 inch rlineto
  -1 inch 0 rlineto
  closepath } def
  
/fillbox % stack: grayvalue => ---
{ setgray fill } def

% Main Program
3.5 inch 4.5 inch box
0 fillbox
3.75 inch 5 inch box
.4 fillbox
4 inch 5.5 inch box
.8 fillbox
showpage