home *** CD-ROM | disk | FTP | other *** search
- /*
- ** FrameBuilder.fred
- **
- ** $VER: FrameBuilder.fred 1.2.1 (17.1.94)
- **
- ** This program can be run from an InvokeADPro list to build a full frame
- ** from two fields (entered into a sequence as adjacent cells).
- **
- ** Clips Imported:
- ** FREDNumberOfFrames - Total frames selected
- ** FREDSameBaseName - ~0 if field 0 and 1 basenames are the same
- ** 0 if they are different
- ** FREDUsesFieldExt - ~0 if field 0 and 1 have extensions
- ** 0 if they don't
- ** FREDEvenFieldExt - Filename extension for even fields
- ** FREDOddFieldExt - Filename extension for odd fields
- ** FREDFieldBaseNameToUse - 0 if the even field's base name
- ** should be used for the new frame
- ** 1 if the odd field's base name
- ** should be used
- ** FREDNextFieldFlag - 0 if ready for new field pair
- ** 1 if ready to work on second field
- ** FREDEvenFieldWidth - Width of the even (first) field
- ** FREDEvenFieldHeight - Height of the even (first) field
- ** FREDEvenFieldBaseName - Basename of the even (first) field
- **
- ** Clips Exported:
- ** FREDNextFieldFlag - 0 if ready for new field pair
- ** 1 if ready to work on second field
- ** FREDEvenFieldWidth - Width of the even (first) field
- ** FREDEvenFieldHeight - Height of the even (first) field
- ** FREDEvenFieldBaseName - Basename of the even (first) field
- **
- ** 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).
- **
- ** Copyright © 1992-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
- TempEvenField = "T:TempEvenField"
- TempOddField = "T:TempOddField"
-
-
- /*
- ** Get the required clips. Error if any are missing.
- */
-
- NumberOfFrames = GETCLIP( "FREDNumberOfFrames" )
- IF (NumberOfFrames = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDNumberOfFrames," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- SameBaseName = GETCLIP( "FREDSameBaseName" )
- IF (SameBaseName = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDSameBaseName," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- IF (SameBaseName = 0) THEN DO
- FieldBaseNameToUse = GETCLIP( "FREDFieldBaseNameToUse" )
- IF (FieldBaseNameToUse = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDFieldBaseNameToUse," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
- UsesFieldExt = GETCLIP( "FREDUsesFieldExt" )
- IF (UsesFieldExt = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDUsesFieldExt," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- IF (UsesFieldExt ~= 0) THEN DO
- EvenFieldExt = GETCLIP( "FREDEvenFieldExt" )
- IF (EvenFieldExt = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDEvenFieldExt," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- OddFieldExt = GETCLIP( "FREDOddFieldExt" )
- IF (OddFieldExt = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDOddFieldExt," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
- NextFieldFlag = GETCLIP( "FREDNextFieldFlag" )
- IF (NextFieldFlag = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDNextFieldFlag," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** See what type of data is loaded in ADPro/MorphPlus.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
- IF (RESULT ~= 0) THEN
- EXIT 10
-
-
- /*
- ** Build the new frame from the even (first) and odd (second) field.
- */
-
- IF (NextFieldFlag = 0) THEN DO
- /*
- ** Get the even field's width and height.
- */
-
- XSIZE
- SETCLIP( "FREDEvenFieldWidth", ADPRO_RESULT )
-
- YSIZE
- SETCLIP( "FREDEvenFieldHeight", ADPRO_RESULT )
-
-
- /*
- ** Strip off the even field basename, if needed.
- */
-
- IF (SameBaseName = 0) THEN
- IF (FieldBaseNameToUse = 0) THEN DO
- FileExtPos = LASTPOS( EvenFieldExt, FrameFName )
- IF (FileExtPos ~= 0) THEN DO
- EvenFieldBaseName = LEFT( FrameFName, FileExtPos-1 ) || '"'
- END
- ELSE
- EvenFieldBaseName = FrameFName
-
- SETCLIP( "FREDEvenFieldBaseName", EvenFieldBaseName )
- END
-
-
- /*
- ** Temporarily save this field.
- */
-
- SAVER "IFF" TempEvenField "RAW"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "The IFF saver failed to save" || NL ||,
- "the temp even field." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || TempEvenField || NL ||,
- "Type = " || "RAW"
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Tell this script that we're ready for the odd field.
- */
-
- NextFieldFlag = 1
- END
- ELSE DO
- /*
- ** Get the even field's width and height.
- */
-
- EvenFieldWidth = GETCLIP( "FREDEvenFieldWidth" )
- IF (EvenFieldWidth = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDEvenFieldWidth," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- EvenFieldHeight = GETCLIP( "FREDEvenFieldHeight" )
- IF (EvenFieldHeight = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDEvenFieldHeight," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Get the new basename to use.
- */
-
- IF (SameBaseName = 0) & (FieldBaseNameToUse = 0) THEN DO
- NewFrameFName = GETCLIP( "FREDEvenFieldBaseName" )
- IF (NewFrameFName = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDEvenFieldBaseName," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
- ELSE DO
- FileExtPos = LASTPOS( OddFieldExt, FrameFName )
- IF (FileExtPos ~= 0) THEN DO
- NewFrameFName = LEFT( FrameFName, FileExtPos - 1 ) || '"'
- END
- ELSE
- NewFrameFName = FrameFName
- END
-
-
- /*
- ** Get the odd field's width and height.
- */
-
- XSIZE
- OddFieldWidth = ADPRO_RESULT
-
- YSIZE
- OddFieldHeight = ADPRO_RESULT
-
-
- /*
- ** The even and odd fields' width must be the same.
- */
-
- IF (EvenFieldWidth ~= OddFieldWidth) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Fields are of different widths." || NL ||,
- "They must be the same."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Temporarily save the odd field.
- */
-
- SAVER "IFF" TempOddField "RAW"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "The IFF saver failed to save" || NL ||,
- "the temp odd field." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || TempOddField || NL ||,
- "Type = " || "RAW"
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Create a backdrop that will hold both fields.
- */
-
- LOADER "BACKDROP" "XXX" "WIDTH" EvenFieldWidth "HEIGHT" (EvenFieldHeight + OddFieldHeight) "COLOR"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "The BACKDROP loader failed" || NL ||,
- "to make the backdrop." || NL ||,
- "Argument Information:" || NL ||,
- "Width = " || EvenFieldWidth || NL ||,
- "Height = " || (EvenFieldHeight + OddFieldHeight) || NL ||,
- "Type = " || "COLOR"
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Composite the even field above the odd field.
- */
-
- LOADER "IFF" TempEvenField 0 0 100
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Compositing the even field failed." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || TempEvenField || NL ||,
- "X = " || 0 || NL ||,
- "Y = " || 0 || NL ||,
- "Mix = " || 100
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- LOADER "IFF" TempOddField 0 EvenFieldHeight 100
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Compositing the odd field failed." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || TempOddField || NL ||,
- "X = " || 0 || NL ||,
- "Y = " || EvenFieldHeight || NL ||,
- "Mix = " || 100
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Interlace the image.
- */
-
- OPERATOR "INTERLACE"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "The INTERLACE operator failed."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Save the generated frame.
- */
-
- SAVER "IFF" NewFrameFName "RAW"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Saving generated frame failed." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || NewFrameFName || NL ||,
- "Type = " || "RAW"
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Tell this script that we're ready for a new frame.
- */
-
- NextFieldFlag = 0
- END
-
-
- /*
- ** Update the clips.
- */
-
- SETCLIP( "FREDNextFieldFlag", NextFieldFlag )
-
- EXIT 0
-