home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDSavers / SaveAsSUNRASTER.fred < prev    next >
Encoding:
Text File  |  1994-01-31  |  3.4 KB  |  137 lines

  1. /*
  2. ** SaveAsSUNRASTER.fred
  3. **
  4. ** $VER: SaveAsSUNRASTER.fred 1.1.0 (24.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to save images in
  7. ** SUNRASTER format.  Including this program automatically causes a pre script
  8. ** to be executed as well (to select the SUNRASTER file extension).
  9. **
  10. ** It is up to the user to include the necessary scripts to create raw or
  11. ** rendered data.  This script will only try to save out what you tell it,
  12. ** and not do any error detecting regarding what type of image data is
  13. ** available.
  14. **
  15. ** Clips Imported:
  16. **    FREDSUNRASTERSaveType        -    Image type to save
  17. **    FREDSUNRASTERSaveCompression    -    Type of compression to use
  18. **    FREDSUNRASTERFNameSelect    -    String describing how the filename
  19. **                        should be modified
  20. **    FREDSUNRASTERSeqFileSelect    -    Name of sequence file created
  21. **
  22. ** NOTE: Clip names are case sensitive.
  23. **
  24. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  25. ** ADPro v2.5.0 (or higher) and Professional Conversion Pack v2.1.0
  26. ** (or higher).
  27. **
  28. ** Copyright © 1992-1993 ASDG, Incorporated
  29. ** All Rights Reserved
  30. */
  31.  
  32.  
  33. ADDRESS "ADPro"
  34. OPTIONS RESULTS
  35.  
  36. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  37.  
  38. NL = '0A'X
  39. SQ = '27'X
  40. DQ = '22'X
  41. TRUE  = 1
  42. FALSE = 0
  43.  
  44. FrameFName = STRIP(STRIP(FrameFName , "B" , " ") , "B" , '"')
  45.  
  46.  
  47. /*
  48. ** Get the required parameters.  Error if any are missing.
  49. */
  50.  
  51. SaveType = GETCLIP( "FREDSUNRASTERSaveType" )
  52. IF (SaveType = "") THEN DO
  53.     ADPRO_TO_FRONT
  54.     OKAY1 "Required clip, FREDSUNRASTERSaveType," || NL ||,
  55.         "is not specified."
  56.     SCREEN_TO_FRONT "FRED"
  57.     EXIT 10
  58. END
  59.  
  60. SaveCompression = GETCLIP( "FREDSUNRASTERSaveCompression" )
  61.  
  62. FNameSelect = GETCLIP( "FREDSUNRASTERFNameSelect" )
  63. IF (FNameSelect = "") THEN DO
  64.     ADPRO_TO_FRONT
  65.     OKAY1 "Required clip, FREDSUNRASTERFNameSelect," || NL ||,
  66.         "is not specified."
  67.     SCREEN_TO_FRONT "FRED"
  68.     EXIT 10
  69. END
  70.  
  71. SeqFileSelect = GETCLIP( "FREDSUNRASTERSeqFileSelect" )
  72. IF (SeqFileSelect = "") THEN DO
  73.     ADPRO_TO_FRONT
  74.     OKAY1 "Required clip, FREDSUNRASTERSeqFileSelect," || NL ||,
  75.         "is not specified."
  76.     SCREEN_TO_FRONT "FRED"
  77.     EXIT 10
  78. END
  79.  
  80.  
  81. /*
  82. ** See what type of data is loaded in ADPro/MorphPlus.
  83. */
  84.  
  85. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  86. IF (RESULT ~= 0) THEN
  87.     EXIT 10
  88.  
  89.  
  90. /*
  91. ** SUNRASTER images cannot be in an Amiga-specific format, such as EHB, HAM, or HAM8.
  92. */
  93.  
  94. RENDER_TYPE
  95. RenderType = ADPRO_RESULT
  96. IF (RC ~= 0) THEN DO
  97.     ADPRO_TO_FRONT
  98.     OKAY1 "Error retrieving render type."
  99.     SCREEN_TO_FRONT "FRED"
  100.     EXIT 10
  101. END
  102.  
  103. IF (RenderType = "EHB") | (RenderType = "HAM") | (RenderType = "HAM8") THEN DO
  104.     ADPRO_TO_FRONT
  105.     OKAY1 RenderType || " images are not supported" || NL ||,
  106.         "as valid SUNRASTER files."
  107.     SCREEN_TO_FRONT "FRED"
  108.     EXIT 10
  109. END
  110.  
  111.  
  112. /*
  113. ** Do the save.  If we aren't using the same filename, we will use the
  114. ** same basename and make every effort possible to replace the
  115. ** perceived filename extension with the selected SUNRASTER extension.
  116. */
  117.  
  118. CALL "FREDSCRIPTS:FREDFunctions/ModifyFilename" FNameSelect '"'FrameFName'"' FrameNum FALSE
  119. NewFName = '"'RESULT'"'
  120.  
  121. SAVER "SUNRASTER" NewFName SaveType SaveCompression
  122. IF (RC ~= 0) THEN DO
  123.     Why = ADPRO_RESULT
  124.     ADPRO_TO_FRONT
  125.     OKAY1 "SUNRASTER save failed:" || NL || Why || NL ||,
  126.         "Argument Information:" || NL ||,
  127.         "Filename = " || NewFName || NL ||,
  128.         "Type = " || SaveType || NL ||,
  129.         "Compression = " || SaveCompression
  130.     SCREEN_TO_FRONT "FRED"
  131.     EXIT 10
  132. END
  133.  
  134. CALL "FREDSCRIPTS:FREDFunctions/SeqFileAppend" SeqFileSelect NewFName 1
  135.  
  136. EXIT 0
  137.