home *** CD-ROM | disk | FTP | other *** search
- /*
- ** SaveAsX.fred
- **
- ** $VER: SaveAsX.fred 1.1.0 (24.10.93)
- **
- ** This program can be run from an InvokeADPro list to save images in
- ** X format. Including this program automatically causes a pre script
- ** to be executed as well (to select the X file extension).
- **
- ** It is up to the user to include the necessary scripts to create raw or
- ** rendered data. This script will only try to save out what you tell it,
- ** and not do any error detecting regarding what type of image data is
- ** available.
- **
- ** Clips Imported:
- ** FREDXSaveType - Image type to save
- ** FREDXSaveWindowFormat - Type of window format to use
- ** FREDXFNameSelect - String describing how the filename
- ** should be modified
- ** FREDXSeqFileSelect - Name of sequence file created
- **
- ** NOTE: Clip names are case sensitive.
- **
- ** This script requires FRED v1.4.0 (or higher) to run. Also required is
- ** ADPro v2.5.0 (or higher) and Professional Conversion Pack v2.1.0
- ** (or higher).
- **
- ** Copyright © 1993 ASDG, Incorporated
- ** All Rights Reserved
- */
-
-
- ADDRESS "ADPro"
- OPTIONS RESULTS
-
- PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
-
- NL = '0A'X
- SQ = '27'X
- DQ = '22'X
- TRUE = 1
- FALSE = 0
-
- FrameFName = STRIP(STRIP(FrameFName , "B" , " ") , "B" , '"')
-
-
- /*
- ** Get the required parameters. Error if any are missing.
- */
-
- SaveType = GETCLIP( "FREDXSaveType" )
- IF (SaveType = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXSaveType," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- SaveWindowFormat = GETCLIP( "FREDXSaveWindowFormat" )
- IF (SaveWindowFormat = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXSaveWindowFormat," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- FNameSelect = GETCLIP( "FREDXFNameSelect" )
- IF (FNameSelect = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXFNameSelect," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- SeqFileSelect = GETCLIP( "FREDXSeqFileSelect" )
- IF (SeqFileSelect = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXSeqFileSelect," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** See what type of data is loaded in ADPro/MorphPlus.
- */
-
- IF (SaveType = "RAW") THEN DO
- CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
- IF (RESULT ~= 0) THEN
- EXIT 10
- END
- ELSE IF ((SaveType = "IMAGE") | (SaveType = "SCREEN")) THEN DO
- CALL "FREDSCRIPTS:FREDFunctions/CheckForRenderedImageData" TRUE
- IF (RESULT ~= 0) THEN
- EXIT 10
- END
-
-
- /*
- ** X images cannot be in an Amiga-specific format, such as EHB, HAM, or HAM8.
- */
-
- RENDER_TYPE
- RenderType = ADPRO_RESULT
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error retrieving render type."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- IF (RenderType = "EHB") | (RenderType = "HAM") | (RenderType = "HAM8") THEN DO
- ADPRO_TO_FRONT
- OKAY1 RenderType || " images are not supported" || NL ||,
- "as valid X files."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** "DUMP"ed files can only be used with 1 bit-plane rendered data.
- */
-
- IF ((SaveType = "IMAGE") | (SaveType = "SCREEN")) THEN
- IF (RenderType = "2") & (SaveWindowFormat ~= "DUMP") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "1 bit-plane rendered data" || NL ||,
- "cannot be saved in " || SaveWindowFormat || " format."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Do the save. If we aren't using the same filename, we will use the
- ** same basename and make every effort possible to replace the
- ** perceived filename extension with the selected X extension.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/ModifyFilename" FNameSelect '"'FrameFName'"' FrameNum FALSE
- NewFName = '"'RESULT'"'
-
- SAVER "X" NewFName SaveType SaveWindowFormat
- IF (RC ~= 0) THEN DO
- Why = ADPRO_RESULT
- ADPRO_TO_FRONT
- OKAY1 "X save failed:" || NL || Why || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || NewFName || NL ||,
- "Type = " || SaveType || NL ||,
- "Compression = " || SaveWindowFormat
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- CALL "FREDSCRIPTS:FREDFunctions/SeqFileAppend" SeqFileSelect NewFName 1
-
- EXIT 0
-