VAR U,V,W,H,HX,HY
VAR RAD#,COS#,SIN#
VAR SX#,SY#
VAR X,Y
VAR I,J,R
SPCHR SP OUT U,V,W,H
SPHOME SP OUT HX,HY
DIM GRP[W,H]
GSAVE SPPAGE(),U,V,W,H,GRP,0
SPROT SP OUT RAD#
RAD#=-RAD(RAD#)-PI/2
COS#=COS(RAD#)SIN#=SIN(RAD#)
SPSCALE SP OUT SX#,SY#
SPOFS SP OUT X,Y
R=MAX(ABS(HX*SX#),ABS(HY*SY#),ABS(W-HX)*SX#,ABS(H-HY)*SY#)
FOR I=-R TO R
FOR J=-R TO R
VAR
GX=ROUND((I*COS#+J*SIN#)/SX#+HX)
VAR GY=ROUND((-I*SIN#+J*COS#)/SY#+HY)
IF GX>=0&&GX<W&&GY>=0&&GY<H THEN
GPSET I+X,J+Y,GRP[GX,GY]
ENDIF
NEXT J
NEXT I