home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 20
/
AACD20.BIN
/
AACD
/
Graphics
/
PerfectPaint
/
rexx
/
circle
/
Sun.rx
< prev
next >
Wrap
Text File
|
2000-05-30
|
2KB
|
142 lines
/* Script Rexx
Make Star
*/
call addlib("rexxmathlib.library", 5, -30, 0)
options results
parse ARG Port x1 y1 r b
ADDRESS COMMAND
s0=3
s1=0
Ray=0
if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/Sun') THEN DO
IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/Sun', "R") then DO
s0 = READLN('lfile')
s1 = READLN('lfile')
Ray = READLN('lfile')
Typ = READLN('lfile')
CALL CLOSE('lfile')
END
END
Pi=3.1415926/180
r2=r/3
ADDRESS value Port
pp_DialogInit 250 155 "*Sun*" 5
pp_Integer 0 110 5 50 16 "Number*of*Point*" 1 s0
pp_Cycle 1 110 25 100 16 "Option" 1 "Filled|Unfilled" s1
pp_Integer 2 110 50 50 16 "Sun*Radius" 1 trunc(r2)
pp_Cycle 3 110 70 100 16 "Ray*Lenght" 1 "Random|Regular" Ray
pp_Cycle 4 110 100 100 16 "Drawing" 1 "Polygone|Spline" Typ
pp_Dialog
rc=result
if rc=0 then
do
EXIT
end
pp_GetDialog 0
s0=result
pp_GetDialog 1
s1=result
pp_GetDialog 2
r2=result
pp_GetDialog 3
Ray=result
pp_GetDialog 4
Typ=result
CALL SavePrefs('Sun',s0,s1,Ray,Typ)
ADDRESS value Port
a=360/s0
a2=a/2
pp_UpdateUndo
DO i=0 To 359 by a
if ray=0 then
do
r3=random(trunc(r2),r,time('S'))+5
end
else
do
r3=r
end
x = Sin(i*Pi)*r3+x1
y = Cos(i*Pi)*r3+y1
ii=i+a2
x2 = Sin(ii*Pi)*r2+x1
y2 = Cos(ii*Pi)*r2+y1
ii=i-a2
x3 = Sin(ii*Pi)*r2+x1
y3 = Cos(ii*Pi)*r2+y1
if Typ=1 then DO
if s1=0 then do
pp_SplineF trunc(x3+0.5) trunc(y3+0.5) trunc(x2+0.5) trunc(y2+0.5) trunc(x+0.5) trunc(y+0.5)
end
else do
pp_Spline trunc(x3) trunc(y3) trunc(x2) trunc(y2) trunc(x) trunc(y)
end
END
ELSE DO
if s1=0 then do
pp_StartPoly
pp_AddPoly trunc(x3+0.5) trunc(y3+0.5)
pp_AddPoly trunc(x2+0.5) trunc(y2+0.5)
pp_AddPoly trunc(x+0.5) trunc(y+0.5)
pp_EndPolyF
end
else do
pp_StartPoly
pp_AddPoly trunc(x2+0.5) trunc(y2+0.5)
pp_AddPoly trunc(x+0.5) trunc(y+0.5)
pp_AddPoly trunc(x3+0.5) trunc(y3+0.5)
pp_EndPoly
end
END
END
if s1=0 then do
pp_CircleF x1 y1 trunc(r2+0.5)+2
end
EXIT
SavePrefs: PROCEDURE
Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
if EXISTS(Prefname) THEN DO
ADDRESS COMMAND
'delete >nil: '||Prefname
END
IF OPEN('pfile',PrefName,'W') THEN DO
do i=2 to ARG()
CALL WRITELN('pfile',ARG(i))
end
CALL CLOSE('pfile')
RETURN