home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / Converter / AD2.55-C.DMS / in.adf / FREDScripts.lha / FREDOperators / GradualCrop.fred.pre < prev    next >
Encoding:
Text File  |  1994-01-31  |  4.5 KB  |  183 lines

  1. /*
  2. ** GradualCrop.fred.pre
  3. **
  4. ** $VER: GradualCrop.fred.pre 1.1.0 (23.10.93)
  5. **
  6. ** If the GradualCrop.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user to enter the beginning and ending width and height.
  8. **
  9. ** Clips Exported:
  10. **    FREDGradualCropWidthCurr    -    Current crop width
  11. **    FREDGradualCropHeightCurr    -    Current crop height
  12. **    FREDGradualCropXOffCurr        -    Current crop x offset
  13. **    FREDGradualCropYOffCurr        -    Current crop y offset
  14. **    FREDGradualCropWidthIncr    -    Crop width increment per frame
  15. **    FREDGradualCropHeightIncr    -    Crop height increment per frame
  16. **    FREDGradualCropXOffIncr        -    Crop x offset increment per frame
  17. **    FREDGradualCropYOffIncr        -    Crop y offset increment per frame
  18. **    FREDGradualCropWidthFinal    -    Final crop width
  19. **    FREDGradualCropHeightFinal    -    Final crop height
  20. **    FREDGradualCropXOffFinal    -    Final crop x offset
  21. **    FREDGradualCropYOffFinal    -    Final crop y offset
  22. **    FREDNumberOfFrames        -    The number of frames selected
  23. **    FREDFrameCount            -    The number of frames already processed
  24. **
  25. ** NOTE: Clip names are case sensitive.
  26. **
  27. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  28. ** ADPro v2.5.0 (or higher).
  29. **
  30. ** Copyright © 1992-1993 ASDG, Incorporated
  31. ** All Rights Reserved
  32. */
  33.  
  34.  
  35. ADDRESS "ADPro"
  36. OPTIONS RESULTS
  37.  
  38. PARSE ARG NumberOfCells NumberOfFrames
  39.  
  40. NL = '0A'X
  41. SQ = '27'X
  42. DQ = '22'X
  43. TRUE  = 1
  44. FALSE = 0
  45.  
  46.  
  47. /*
  48. ** Ensure that at least two frames are to be processed.
  49. */
  50.  
  51. IF (NumberOfFrames < 2) THEN DO
  52.     ADPRO_TO_FRONT
  53.     OKAY1 "Frame count must be more than 2."
  54.     SCREEN_TO_FRONT "FRED"
  55.     EXIT 10
  56. END
  57.  
  58.  
  59. /*
  60. ** Set some default values.
  61. */
  62.  
  63. StartingWidth  = 640
  64. StartingHeight = 400
  65. EndingWidth  = 320
  66. EndingHeight = 200
  67.  
  68.  
  69. /*
  70. ** See what type of data is loaded in ADPro/MorphPlus.
  71. */
  72.  
  73. CALL "FREDSCRIPTS:FREDFunctions/CheckForImageData" FALSE
  74. IF (RESULT = 0) THEN DO
  75.     XSIZE
  76.     StartingWidth = ADPRO_RESULT
  77.  
  78.     YSIZE
  79.     StartingHeight = ADPRO_RESULT
  80. END
  81.  
  82.  
  83. /*
  84. ** Ask the user for a starting size using the currently loaded width as default.
  85. */
  86.  
  87. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop width"' StartingWidth 1 999999 TRUE
  88. StartingWidth = RESULT
  89. IF (StartingWidth = (1-1)) THEN
  90.     EXIT 10
  91.  
  92.  
  93. /*
  94. ** Ask the user for a starting size using the currently loaded height as default.
  95. */
  96.  
  97. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop height"' StartingHeight 1 999999 TRUE
  98. StartingHeight = RESULT
  99. IF (StartingHeight = (1-1)) THEN
  100.     EXIT 10
  101.  
  102.  
  103. /*
  104. ** Ask the user for a starting x offset.
  105. */
  106.  
  107. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop X offset"' 0 0 999999 TRUE
  108. StartingXOff = RESULT
  109. IF (StartingXOff = (0-1)) THEN
  110.     EXIT 10
  111.  
  112.  
  113. /*
  114. ** Ask the user for a starting y offset.
  115. */
  116.  
  117. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting crop Y offset"' 0 0 999999 TRUE
  118. StartingYOff = RESULT
  119. IF (StartingYOff = (0-1)) THEN
  120.     EXIT 10
  121.  
  122.  
  123. /*
  124. ** Ask the user for an ending size using the currently loaded width as default.
  125. */
  126.  
  127. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop width"' EndingWidth 1 999999 TRUE
  128. EndingWidth = RESULT
  129. IF (EndingWidth = (1-1)) THEN
  130.     EXIT 10
  131.  
  132.  
  133. /*
  134. ** Ask the user for an ending size using the currently loaded height as default.
  135. */
  136.  
  137. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop height"' EndingHeight 1 999999 TRUE
  138. EndingHeight = RESULT
  139. IF (EndingHeight = (1-1)) THEN
  140.     EXIT 10
  141.  
  142.  
  143. /*
  144. ** Ask the user for an ending x offset.
  145. */
  146.  
  147. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop X offset"' 0 0 999999 TRUE
  148. EndingXOff = RESULT
  149. IF (EndingXOff = (0-1)) THEN
  150.     EXIT 10
  151.  
  152.  
  153. /*
  154. ** Ask the user for an ending y offset.
  155. */
  156.  
  157. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending crop Y offset"' 0 0 999999 TRUE
  158. EndingYOff = RESULT
  159. IF (EndingYOff = (0-1)) THEN
  160.     EXIT 10
  161.  
  162.  
  163. /*
  164. ** Update the clips.
  165. */
  166.  
  167. SETCLIP( "FREDGradualCropWidthCurr", StartingWidth )
  168. SETCLIP( "FREDGradualCropHeightCurr", StartingHeight )
  169. SETCLIP( "FREDGradualCropXOffCurr", StartingXOff )
  170. SETCLIP( "FREDGradualCropYOffCurr", StartingYOff )
  171. SETCLIP( "FREDGradualCropWidthIncr", (EndingWidth - StartingWidth) / (NumberOfFrames - 1) )
  172. SETCLIP( "FREDGradualCropHeightIncr", (EndingHeight - StartingHeight) / (NumberOfFrames - 1) )
  173. SETCLIP( "FREDGradualCropXOffIncr", (EndingXOff - StartingXOff) / (NumberOfFrames - 1) )
  174. SETCLIP( "FREDGradualCropYOffIncr", (EndingYOff - StartingYOff) / (NumberOfFrames - 1) )
  175. SETCLIP( "FREDGradualCropWidthFinal", EndingWidth )
  176. SETCLIP( "FREDGradualCropHeightFinal", EndingHeight )
  177. SETCLIP( "FREDGradualCropXOffFinal", EndingXOff )
  178. SETCLIP( "FREDGradualCropYOffFinal", EndingYOff )
  179. SETCLIP( "FREDNumberOfFrames", NumberOfFrames )
  180. SETCLIP( "FREDFrameCount", 0 )
  181.  
  182. EXIT 0
  183.