home *** CD-ROM | disk | FTP | other *** search
- /*
- ** GradualCrop.fred.pre
- **
- ** $VER: GradualCrop.fred.pre 1.1.0 (23.10.93)
- **
- ** If the GradualCrop.fred script appears in the InvokeADPro list,
- ** this program will ask the user to enter the beginning and ending width and height.
- **
- ** Clips Exported:
- ** FREDGradualCropWidthCurr - Current crop width
- ** FREDGradualCropHeightCurr - Current crop height
- ** FREDGradualCropXOffCurr - Current crop x offset
- ** FREDGradualCropYOffCurr - Current crop y offset
- ** FREDGradualCropWidthIncr - Crop width increment per frame
- ** FREDGradualCropHeightIncr - Crop height increment per frame
- ** FREDGradualCropXOffIncr - Crop x offset increment per frame
- ** FREDGradualCropYOffIncr - Crop y offset increment per frame
- ** FREDGradualCropWidthFinal - Final crop width
- ** FREDGradualCropHeightFinal - Final crop height
- ** FREDGradualCropXOffFinal - Final crop x offset
- ** FREDGradualCropYOffFinal - Final crop y offset
- ** FREDNumberOfFrames - The number of frames selected
- ** FREDFrameCount - The number of frames already processed
- **
- ** 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 NumberOfCells NumberOfFrames
-
- NL = '0A'X
- SQ = '27'X
- DQ = '22'X
- TRUE = 1
- FALSE = 0
-
-
- /*
- ** Ensure that at least two frames are to be processed.
- */
-
- IF (NumberOfFrames < 2) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Frame count must be more than 2."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** Set some default values.
- */
-
- StartingWidth = 640
- StartingHeight = 400
- EndingWidth = 320
- EndingHeight = 200
-
-
- /*
- ** See what type of data is loaded in ADPro/MorphPlus.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/CheckForImageData" FALSE
- IF (RESULT = 0) THEN DO
- XSIZE
- StartingWidth = ADPRO_RESULT
-
- YSIZE
- StartingHeight = ADPRO_RESULT
- END
-
-
- /*
- ** Ask the user for a starting size using the currently loaded width as default.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop width"' StartingWidth 1 999999 TRUE
- StartingWidth = RESULT
- IF (StartingWidth = (1-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for a starting size using the currently loaded height as default.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop height"' StartingHeight 1 999999 TRUE
- StartingHeight = RESULT
- IF (StartingHeight = (1-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for a starting x offset.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop X offset"' 0 0 999999 TRUE
- StartingXOff = RESULT
- IF (StartingXOff = (0-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for a starting y offset.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop Y offset"' 0 0 999999 TRUE
- StartingYOff = RESULT
- IF (StartingYOff = (0-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for an ending size using the currently loaded width as default.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop width"' EndingWidth 1 999999 TRUE
- EndingWidth = RESULT
- IF (EndingWidth = (1-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for an ending size using the currently loaded height as default.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop height"' EndingHeight 1 999999 TRUE
- EndingHeight = RESULT
- IF (EndingHeight = (1-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for an ending x offset.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop X offset"' 0 0 999999 TRUE
- EndingXOff = RESULT
- IF (EndingXOff = (0-1)) THEN
- EXIT 10
-
-
- /*
- ** Ask the user for an ending y offset.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop Y offset"' 0 0 999999 TRUE
- EndingYOff = RESULT
- IF (EndingYOff = (0-1)) THEN
- EXIT 10
-
-
- /*
- ** Update the clips.
- */
-
- SETCLIP( "FREDGradualCropWidthCurr", StartingWidth )
- SETCLIP( "FREDGradualCropHeightCurr", StartingHeight )
- SETCLIP( "FREDGradualCropXOffCurr", StartingXOff )
- SETCLIP( "FREDGradualCropYOffCurr", StartingYOff )
- SETCLIP( "FREDGradualCropWidthIncr", (EndingWidth - StartingWidth) / (NumberOfFrames - 1) )
- SETCLIP( "FREDGradualCropHeightIncr", (EndingHeight - StartingHeight) / (NumberOfFrames - 1) )
- SETCLIP( "FREDGradualCropXOffIncr", (EndingXOff - StartingXOff) / (NumberOfFrames - 1) )
- SETCLIP( "FREDGradualCropYOffIncr", (EndingYOff - StartingYOff) / (NumberOfFrames - 1) )
- SETCLIP( "FREDGradualCropWidthFinal", EndingWidth )
- SETCLIP( "FREDGradualCropHeightFinal", EndingHeight )
- SETCLIP( "FREDGradualCropXOffFinal", EndingXOff )
- SETCLIP( "FREDGradualCropYOffFinal", EndingYOff )
- SETCLIP( "FREDNumberOfFrames", NumberOfFrames )
- SETCLIP( "FREDFrameCount", 0 )
-
- EXIT 0
-