! @ PR:P_MASK.GREG Icorner Dx Dy
!
! Mask Dx % by Dy % of the current box near corner Icorner
!
define real user[4] poly[4,2] dx dy eps
!
let dx user_xmax-user_xmin
let dy user_ymax-user_ymin
let eps 1e-2
if (&1.eq.1) then
  let user[1] user_xmin+eps*dx
  let user[2] user_ymin+eps*dy
  let user[3] user_xmin+&2*dx
  let user[4] user_ymin+&3*dy
else if (&1.eq.2) then
  let user[1] (user_xmax+user_xmin-&2*dx)|2
  let user[2] user_ymin+eps*dy
  let user[3] (user_xmax+user_xmin+&2*dx)|2
  let user[4] user_ymin+&3*dy
else if (&1.eq.3) then
  let user[1] user_xmax-eps*dx
  let user[2] user_ymin+eps*dy
  let user[3] user_xmax-&2*dx
  let user[4] user_ymin+&3*dy
else if (&1.eq.4) then
  let user[1] user_xmin+eps*dx
  let user[2] (user_ymin+user_ymax-&3*dy)|2
  let user[3] user_xmin+&2*dx
  let user[4] (user_ymin+user_ymax+&3*dy)|2
else if (&1.eq.6) then
  let user[1] user_xmax-eps*dx
  let user[2] (user_ymin+user_ymax-&3*dy)|2
  let user[3] user_xmax-&2*dx
  let user[4] (user_ymin+user_ymax+&3*dy)|2                                !
else if (&1.eq.7) then
  let user[1] user_xmin+eps*dx
  let user[2] user_ymax-eps*dy
  let user[3] user_xmin+&2*dx
  let user[4] user_ymax-&3*dy
else if (&1.eq.8) then
  let user[1] (user_xmax+user_xmin-&2*dx)|2
  let user[2] user_ymax-eps*dy
  let user[3] (user_xmax+user_xmin+&2*dx)|2
  let user[4] user_ymax-&3*dy
else if (&1.eq.9) then
  let user[1] user_xmax-eps*dx
  let user[2] user_ymax-eps*dy
  let user[3] user_xmax-&2*dx
  let user[4] user_ymax-&3*dy
endif
!
let poly user[1] user[3] user[3] user[1] user[2] user[2] user[4] user[4]
greg1\set coordin user
!
! Remember current polygon
if (exist(poly%nxy)) then
 define real opol[poly%nxy,2]
 let opol[1] poly%x
 let opol[2] poly%y
else
 define real opol[1,2]
endif
greg2\polygon poly /variable
greg2\polygon /fill 7
!
! Restore current polygon
greg2\polygon opol /variable
