home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Graphics / PerfectPaint / rexx / circle / Sun.rx < prev    next >
Text File  |  1999-12-09  |  2KB  |  118 lines

  1. /* Script Rexx
  2.     Make Star
  3. */
  4.  
  5.     call addlib("rexxmathlib.library", 5, -30, 0)
  6.  
  7.     options results
  8.   parse ARG Port x1 y1 r b
  9.  
  10.     ADDRESS COMMAND
  11.     s0=3
  12.     s1=0
  13.     Ray=0
  14.     if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/Sun') THEN DO
  15.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/Sun', "R") then DO
  16.             s0 = READLN('lfile')
  17.             s1 = READLN('lfile')
  18.             Ray = READLN('lfile')
  19.             CALL CLOSE('lfile')
  20.         END
  21.     END
  22.  
  23.     Pi=3.1415926/180
  24.     r2=r/3
  25.  
  26.     ADDRESS value Port
  27.     pp_DialogInit 250 125 "*Sun*" 4
  28.         pp_Integer 0 110 5 50 16 "Number*of*Point*" 1 s0
  29.         pp_Cycle 1 110 25 100 16 "Option" 1 "Filled|Unfilled" s1
  30.         pp_Integer 2 110 50 50 16 "Sun*Radius" 1 trunc(r2)
  31.         pp_Cycle 3 110 70 100 16 "Ray*Lenght" 1 "Random|Regular" Ray        
  32.     pp_Dialog
  33.     rc=result
  34.     if rc=0 then
  35.         do
  36.             EXIT
  37.         end        
  38.         
  39.     pp_GetDialog 0
  40.     s0=result
  41.  
  42.     pp_GetDialog 1
  43.     s1=result
  44.  
  45.     pp_GetDialog 2
  46.     r2=result
  47.  
  48.     pp_GetDialog 3
  49.     Ray=result
  50.  
  51.     CALL SavePrefs('Sun',s0,s1,Ray)
  52.     ADDRESS value Port    
  53.  
  54.     a=360/s0
  55.     a2=a/2
  56.  
  57.     pp_UpdateUndo
  58.  
  59.   DO i=0 To 359 by a
  60.         if ray=0 then 
  61.         do
  62.             r3=random(trunc(r2),r,time('S'))+5
  63.         end
  64.         else
  65.         do
  66.         r3=r
  67.         end
  68.  
  69.       x = Sin(i*Pi)*r3+x1
  70.     y = Cos(i*Pi)*r3+y1
  71.  
  72.         ii=i+a2
  73.       x2 = Sin(ii*Pi)*r2+x1
  74.     y2 = Cos(ii*Pi)*r2+y1
  75.  
  76.         ii=i-a2
  77.       x3 = Sin(ii*Pi)*r2+x1
  78.     y3 = Cos(ii*Pi)*r2+y1
  79.  
  80.         if s1=0 then do
  81.         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)
  82.         end
  83.         else do
  84.         pp_Spline trunc(x3) trunc(y3) trunc(x2) trunc(y2) trunc(x) trunc(y)
  85.         end
  86.         
  87.  
  88.     END
  89.  
  90.         if s1=0 then do
  91.             pp_CircleF x1 y1 trunc(r2+0.5)+2
  92.       end
  93.  
  94. EXIT
  95.  
  96.  
  97. SavePrefs: PROCEDURE
  98.     
  99.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  100.  
  101.     if EXISTS(Prefname) THEN DO
  102.         ADDRESS COMMAND
  103.         'delete >nil: '||Prefname
  104.     END
  105.  
  106.     IF OPEN('pfile',PrefName,'W') THEN DO
  107.  
  108.     do i=2 to ARG()
  109.         CALL WRITELN('pfile',ARG(i))
  110.     end
  111.  
  112.     CALL CLOSE('pfile')
  113.  
  114. RETURN
  115.  
  116.  
  117.  
  118.