home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / scripti.lha / 3-DEE / Scripti / Composition / ForeGround.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-05-19  |  3.3 KB  |  143 lines

  1. /*
  2. ----------------------------------------------------------------------------
  3. This AREXX-Script will compose two any images into one.
  4. Warning! The number of colors is determined by the first argument!
  5.  
  6. Host address: ADPro (Art Department Pprofessional   ®ASDG)
  7. Written by Jan Van Overbeke, 3-DEE, ©1993.
  8. Read the AREXX-Scripti doc, for more info about operation and rights!
  9. ----------------------------------------------------------------------------
  10. */
  11.  
  12. options results
  13. parse arg filename foregroundname offX offY Mix R G B
  14. if ~ exists(filename)|filename='' then do
  15.     say 'Unable to find the image !!'
  16.     say 'See Ya...'
  17.     say ''
  18.     exit
  19.     end
  20.  
  21. /* ---- Standard values!!!! ---- */
  22. /* ----------------------------- */
  23. if offX='' then offX=0
  24. if offY='' then offY=0
  25. if Mix='' then mix=100
  26. if r='' then r=0
  27. if g='' then g=0
  28. if b='' then b=0
  29.  
  30. /* ---- If the argumented foreground has no path, ---- */
  31. /* ----          we'll have to add one            ---- */
  32. /* --------------------------------------------------- */
  33. foreground=foregroundname
  34. if pos('/',foregroundname)=0 & pos(':',foregroundname)=0 then do
  35.     endpath=lastpos('/',filename)
  36.     if endpath=0 then endpath=lastpos(':',filename)
  37.     foreground=delstr(filename,endpath+1)||foregroundname
  38.     end
  39.  
  40. if ~exists(foreground)|foreground='' then do
  41.     say 'Unable to find the foreground image.'
  42.     say 'See Ya..........'
  43.     say ''
  44.     exit
  45.     end
  46.  
  47. address 'ADPro'
  48. say 'Foreground: Written by JAN VAN OVERBEKE, 3-DEE, ©1993'
  49. say 'Background: 'filename
  50. say 'Foreground: 'foreground
  51. say 'SAVE: IFF Original Colors ->Background.'
  52. say ''
  53.  
  54. LFORMAT "UNIVERSAL"
  55. if RC ~=0 then do
  56.     say 'Unable to select the UNIVERSAL loader.'
  57.     say 'See Ya...'
  58.     say ''
  59.     exit
  60.     end
  61.  
  62. say 'Loading1.........'
  63. LOAD filename
  64. if RC ~=0 then do
  65.     say 'Had some problems while loading.'
  66.     say 'See Ya...'
  67.     say ''
  68.     exit
  69.     end
  70.  
  71. /* ----            Get some info about image:             ---- */
  72. /* ---- is it gray? is it 24Bit? If not: How many colors? ---- */
  73. /* ----------------------------------------------------------- */
  74. IMAGE
  75. help=ADPRO_RESULT
  76. dontrender='ok'
  77. if pos('RENDERED',help)>0|pos('BITPLANE',help)>0 then dontrender='nok'
  78. if pos('GRAY',help)>0 then do
  79.     say 'Setting color data.....'
  80.     operator gray_to_Color
  81.     if RC~=0 then do
  82.         say 'Gray_To_color Failed!!!!!'
  83.         say 'See Ya.....'
  84.         say ''
  85.         exit
  86.         end
  87. end
  88. render_type
  89. colors=ADPRO_RESULT
  90.  
  91. say 'Loading2.........'
  92. LOAD foreground OffX OffY Mix R G B
  93. if RC ~=0 then do
  94.     say 'Had some problems while loading the foreground.'
  95.     say 'See Ya.'
  96.     say ''
  97.     exit
  98.     end
  99.  
  100. /* ---- Fine-tune palette to colors of background image ---- */
  101. /* ----               and render a new one              ---- */
  102. /* --------------------------------------------------------- */
  103. if dontrender='nok' then do
  104.     say 'Converting......'
  105.     render_type colors
  106.     palette=0
  107.     if colors='HAM' then palette=16
  108.     if colors='HAM8' then palette=64
  109.     if palette=0 then palette=colors
  110.     ptotal palette
  111.     pused palette
  112.     execute
  113.     if RC ~= 0 then do
  114.         say 'Execute failed.'
  115.         say 'See Ya...'
  116.         say ''
  117.         exit
  118.         end
  119.     saveformat='IMAGE'
  120.     say 'Saving IMAGE 'colors'.......'
  121.     end
  122.     else do
  123.         saveformat='RAW'
  124.         say 'Saving RAW.....'
  125.          end
  126.  
  127. SFORMAT "IFF"
  128. if RC ~=0 then do
  129.     say 'Unable to select the IFF Saver.'
  130.     say 'See Ya...'
  131.     say ''
  132.     exit
  133.     end
  134.  
  135. filename=filename'.new'
  136. SAVE filename saveformat
  137. if RC~=0 then do
  138.     say 'Problems while saving: NOT SAVED.'
  139.     say 'See Ya...'
  140.     end
  141. say ''
  142. exit
  143.