/* ** CropToSize.fred.pre ** ** $VER: CropToSize.fred.pre 1.1.0 (23.10.93) ** ** If the CropToSize.fred script appears in the InvokeADPro list, ** this program will ask the user to enter the width, height, left offset, ** and top offset values of the area to be cropped. ** ** Clips Exported: ** FREDCropWidth - Width user entered ** FREDCropHeight - Height user entered ** FREDCropLeftOffset - Left offset user entered ** FREDCropTopOffset - Top offset user entered ** ** 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 © 1993 Elastic Reality, Inc. ** All Rights Reserved */ ADDRESS "ADPro" OPTIONS RESULTS PARSE ARG NumberOfCells NumberOfFrames NL = '0A'X SQ = '27'X DQ = '22'X TRUE = 1 FALSE = 0 /* ** Set some default values. */ CurrentWidth = 320 CurrentHeight = 200 CurrentLeft = 0 CurrentTop = 0 /* ** See what type of data is loaded in ADPro/MorphPlus. */ CALL "FREDSCRIPTS:FREDFunctions/CheckForImageData" IF (RESULT = 0) THEN DO XSIZE CurrentWidth = ADPRO_RESULT YSIZE CurrentHeight = ADPRO_RESULT END /* ** Ask the user for a size using the currently loaded width as default. */ CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Width"' CurrentWidth 1 999999 TRUE IF (RESULT = (1-1)) THEN EXIT 10 ELSE DesiredWidth = RESULT /* ** Ask the user for a size using the currently loaded height as default. */ CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Height"' CurrentHeight 1 999999 TRUE IF (RESULT = (1-1)) THEN EXIT 10 ELSE DesiredHeight = RESULT /* ** Ask the user for an offset using the currently loaded x offset as default. */ CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop X Offset"' CurrentLeft 0 999999 TRUE IF (RESULT = (0-1)) THEN EXIT 10 ELSE DesiredLeft = RESULT /* ** Ask the user for an offset using the currently loaded y offset as default. */ CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Y Offset"' CurrentTop 0 999999 TRUE IF (RESULT = (0-1)) THEN EXIT 10 ELSE DesiredTop = RESULT /* ** Update the clips. */ SETCLIP( "FREDCropWidth", DesiredWidth ) SETCLIP( "FREDCropHeight", DesiredHeight ) SETCLIP( "FREDCropLeftOffset", DesiredLeft ) SETCLIP( "FREDCropTopOffset", DesiredTop ) EXIT 0