%!PS-Adobe-2.0 %%BoundingBox: 0 0 300 300 %%Pages: 2 /page-begin { gsave 72 dup scale 1 72 div setlinewidth /Times-Roman findfont 0.2 scalefont setfont 1 1 translate } def /page-end { 0 0 moveto gsave 1 1 1 setrgbcolor (Page ) show pageno ( ) cvs show grestore grestore showpage } def % g s = arguments to this procedure % g entered first, s second /fill-square { % the color shade g and the side s now sit on the stack 1 dict begin % define s (local) to be the top value on the stack /s exch def % define g (local) to be the value now on the top of the stack /g exch def newpath 0 0 moveto s 0 lineto s s lineto 0 s lineto closepath gsave g aload pop setrgbcolor fill grestore stroke end } def % ================================================= /s 0.5 def % === page 1 ============================================== %%Page: 1 1 page-begin % in the original program, pageno and g were % global variables that were changed on each page, % but here we have to set them explicitly on each page. /pageno 1 def /g [ 1 1 0 ] def gsave 10 { g 1 fill-square 0.25 0.25 translate % decrease the red component of g g 0 g 0 get 0.1 sub put } repeat grestore 0.5 0.5 moveto (Squares and circles) show page-end % === page 2 ============================================== %%Page: 2 2 page-begin /pageno 2 def /g [ 1 0 1 ] def gsave 10 { g 1 fill-square newpath 0 0 0.25 0 360 arc gsave g aload pop setrgbcolor fill grestore stroke 0.25 0.25 translate g 0 g 0 get 0.1 sub put } repeat grestore page-end