/* Weird effect of multi-lenses in front of image */
/* © 1993 NewTek, Inc.    by Arnie Cachelin */

address 'DigiPaint' /* Tell ARexx where commands go */
'Drre'
'Flon'
'Hvof'					/* Turn off Horizontal and Vertical gradients */	
'Hvar'					/* Toggle Horiz and Vert. Gradient (on) */
'Txva' $0000
'Tyva' $0000
'Dotb'
'Poth' $F000		/* Set Gradient center to middle ($0000 - $FFFF) */
'Rang'
siz=120
do y=0 to 480-1 by siz
  do x=0 to 752-1 by siz
    Call CutBrush(x,y,x+siz,y+siz)
		'Bcop'
		'Cbx0'
		'Pmcl'
    Call Rectangle(x,y,x+siz,y+siz)		
		'Txma'
    Call DrawCircle(x,y,x+siz,y+siz)
  end
end
'Shco'          /* Render to Program Out */
exit            /* Bye bye! */

Rectangle: PROCEDURE
  arg x,y,x2,y2
  'Drre'
  'Dotb'
  'Pend' x y
  'Penu' x2 y2
  return 0

CutBrush: PROCEDURE  /* Cut out a brush with corners at (x1,y1) and (x2,y2) */
  arg x1, y1, x2, y2
  'Dotb'        /* smallest brush size */
  'Drre'        /* Rectangle mode  */
  'Scis'        /* Scissors on, for cutting a brush  */
  'Pend' x1 y1  /* Get in top Left corner  */
  'Penu' x2 y2  /* lift pen to get brush!  */
  return 0

DrawCircle: PROCEDURE  /* Draw circle in box */
  arg x1, y1, x2, y2
  'Dotb'        /* smallest brush size */
  'Drci'        /* Circle mode  */
  'Pend' (x2+x1)%2 (y2+y1)%2  /* Get in Center  */
  'Penu' x1 (y2+y1)%2  /* lift pen at edge  */	
  return 0

Lens: PROCEDURE
  arg x1, y1, x2, y2
  Call CutBrush(x1,y1,x2,y2)
	'Bcop'
	'Txma'
  Call DrawCircle(x1,y1,x2,y2)
  return 0


