home *** CD-ROM | disk | FTP | other *** search
/ DTP Toolbox / DTPToolbox.iso / utilities / propage_pdraw / donsgenies / adproscripts.lha / CombinedPalette.adpro < prev    next >
Encoding:
Text File  |  1993-04-08  |  1.9 KB  |  81 lines

  1. /* Program to use ADPro to create a compromise palette for a number of pictures or frames, in a chosen number of colours. There must be some space in the same directory to hold temporary files. */
  2.  
  3. trace r
  4.  
  5. options results
  6. address "ADPro"
  7.  
  8. lformat "UNIVERSAL"
  9. sformat "IFF"
  10.  
  11.  
  12. GETFILES '"Hold down shift & click on Files"'
  13. IF RC ~= 0 THEN EXIT
  14.  
  15. TheFiles      = ADPRO_RESULT
  16. NumberOfFiles = WORDS(TheFiles)
  17. stripwidth = trunc(320/NumberOfFiles)
  18.  
  19. getnumber '"How many colours?"' 32 2 256
  20. colours = ADPro_result
  21. if rc~=0 then exit
  22. if colours>256 then colours = 256
  23.  
  24. getfile '"File name for palette..."'
  25. if rc~=0 then do
  26.     okay1 "No file selected"
  27.     exit
  28.     end
  29.  
  30. palettename = ADPro_result
  31. pstatus unlocked
  32.  
  33. do i = 1 to NumberOfFiles
  34.     filename = word(TheFiles,i) /* this filename includes the path */
  35.     load filename
  36.     if rc ~=0 then break
  37.     abs_scale stripwidth 200
  38.     render_type "HAM"   /* number of colours  */
  39.     screen_type 4  /* 0 for NTSC machines */
  40.     execute
  41.  
  42.     newname = compress(filename||".s", '"') /* compress deals with a bug in ADPro */
  43. /* should really strip name from path & check if now too long */
  44.     save newname "IMAGE"
  45.     if rc~=0 then do
  46.         okay1 '"Trouble saving file "||newname'
  47.         exit
  48.         end
  49.     end   /* end of multiple files */
  50.  
  51. lformat "BACKDROP"
  52. load "X" 320 200 "COLOR"  /* black backdrop */
  53. lformat "UNIVERSAL"
  54.  
  55. do i = 1 to NumberOfFiles
  56.     filename = word(TheFiles,i)
  57.     newname = compress(filename||".strip", '"')
  58.     if length(newname)>30 then newname = right(newname,30)
  59.     load newname stripwidth*(i-1) 0 100
  60.     if rc ~=0 then break
  61.     end
  62.  
  63. pstatus unlocked
  64. ptotal 256
  65. poffset 0
  66. pused colours
  67. if colours<33 then newtotal = 32
  68. if colours<17 then newtotal = 16
  69. if colours<9 then newtotal = 8
  70. if colours<5 then newtotal = 4
  71. ptotal newtotal
  72. render_type "CUST"
  73. dither 6  /* Random dither */
  74. execute
  75. pstatus locked
  76. psave palettename
  77.  
  78. exit
  79. end
  80.  
  81.