home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / my_favourite / imagefx_add_ons / pcd-overview.lha / pcd-overview.ifx next >
Text File  |  1996-10-12  |  3KB  |  151 lines

  1. /*
  2.  * Arexx Program created by Les Hewitt Oct/1996
  3.  */
  4.  
  5. call addlib('rexxsupport.library',0,-30,0)
  6.  
  7. OPTIONS RESULTS
  8.  
  9. Width  = 800
  10. Height = 600
  11. OVdir  = "RAM:"   /* this is the directory where the requester starts
  12.                                      * from the first time you use the script. It
  13.                                      * remembers where you where for the next time you
  14.                                      * use the script untill you switch off or reboot
  15.                                      * your Amiga. */
  16.  
  17.  
  18.  
  19. IF OPEN(OViewDIR, "Env:OViewDIR", R) then do
  20.     OVdir = (READLN(OViewDIR))
  21.     call CLOSE OViewDIR
  22. END
  23.  
  24. if OVdir = '"wrong"' then OVdir = 'RAM:'
  25.  
  26. /* --- GET DIR LISTS --- */
  27.  
  28. address command 'c:echo >t:List1.tmp "~~~EndOfList~~~"'
  29.  
  30. do forever
  31.  
  32. RollScreenUp Height
  33. address command 'requestfile >env:OViewDIR title "Select Directory " drawer 'OVdir' drawersonly noicons pubscreen "IMAGEFX.1"'
  34. RollScreenDown
  35.  
  36. IF OPEN(OViewDIR, "Env:OViewDIR", R) then do
  37.     OVdir = (READLN(OViewDIR))
  38.     call CLOSE OViewDIR
  39. END
  40.  
  41. message OVdir
  42.  
  43. address command 'c:list >t:List.tmp 'OVdir' nohead quick lformat "%P%N"'
  44. address command 'c:join t:List.tmp t:List1.tmp as t:List2.tmp'
  45.  
  46. RequestResponse 'Do you want to add another directory?'
  47. IF rc ~= 0 THEN break
  48.  
  49. end 
  50.  
  51. RequestResponse 'Edit file list?.'
  52. IF rc = 0 THEN address command 'ced t:List2.tmp'
  53.  
  54. RequestResponse 'Sort file list?.'
  55. IF rc = 0 THEN DO
  56. address command 'sort t:List2.tmp t:List2.tmp'
  57. END
  58.  
  59. /* --- Output Picture --- */
  60.  
  61. message 'Possible Total Pix: 4 9 16 25 36 49 64 81 100'
  62. RequestSlider '"Number of pictures across and down:"' 2 10 8
  63. IF rc ~= 0 THEN EXIT 0
  64. xx = result
  65.  
  66. RequestFile '"SAVE as 24BIT JPEG Picture:"'
  67. IF rc ~= 0 THEN EXIT 0
  68. outpic = result
  69.  
  70. RequestSlider '"Enter Quality (Highest Quality = 100%)"' 1 100 85
  71. IF rc ~= 0 THEN EXIT 0
  72. Quality = result
  73.  
  74. /* ---- Hard Work ---- */
  75.  
  76. message xx*xx' Pictures'
  77.  
  78. REDRAW OFF
  79. UNDO OFF
  80. KillBuffer Force
  81. KillSwap
  82. KillAlpha
  83. KillUndo
  84. KillBrush
  85. CreateBuffer Width Height 0 0 0 1 1 100 100 FORCE
  86. ClearBuffer 255 255 255 FORCE
  87. REDRAW ON
  88. REDRAW OFF
  89.  
  90. IF OPEN(InFile, "T:List2.Tmp", R) then do
  91.  
  92. tx = xx*xx
  93. wx = Width/xx
  94. hx = Height/xx
  95. ww = wx/2
  96. hh = hx/2
  97. wb = 96*wx/100
  98. hb = 96*hx/100
  99. wc = wb/2
  100. hc = hb/2
  101.  
  102.     number = 1
  103.         do j = 0 to xx-1
  104.                 REDRAW OFF
  105.             do i = 0 to xx-1
  106.  
  107.             if EOF(InFile) then leave j
  108.                 inpic = (READLN(InFile))
  109.             if inpic = "" then leave j
  110.             if inpic = "~~~EndOfList~~~" then leave j
  111.  
  112.                 message inpic'  pic 'number
  113.  
  114.                 LoadBrush '"'inpic'"' FORCE
  115.                 Scale wb hb
  116.                 BrushHandle wc hc
  117.  
  118.                 NewArea
  119.                 AddArea ww+(wx*i) hh+(hx*j)
  120.                 FreeDraw
  121.  
  122.                 number = number + 1
  123.                 if number > tx then leave j
  124.             END i
  125.             REDRAW ON
  126.         END j
  127.         Redraw ON
  128.  
  129. /*    Menu Render */
  130. /*    SetRender CyberGraphics.030 */
  131.     message 'Rendering'
  132.     Render Go
  133.  
  134.     message 'Saving JPEG'
  135.     SaveBufferAs JPEG  '"'outpic'"' Quality  
  136.  
  137.     Render CLOSE
  138.  
  139.     call CLOSE InFile
  140. END
  141.  
  142. address command 'delete >nil: t:List.tmp t:List1.tmp t:List2.tmp'
  143.  
  144. UNDO ON
  145. Redraw ON
  146.  
  147. Message 'Finished'
  148. address command 'echo >speak: Finished'
  149.  
  150. EXIT
  151.