home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDOperators / GradualScale.fred < prev    next >
Encoding:
Text File  |  1994-01-31  |  3.5 KB  |  161 lines

  1. /*
  2. ** GradualScale.fred
  3. **
  4. ** $VER: GradualScale.fred 1.1.0 (23.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to gradually scale the images
  7. ** in a sequence.
  8. **
  9. ** Clips Imported:
  10. **    FREDGradualWidthCurr    -    Current width
  11. **    FREDGradualHeightCurr    -    Current height
  12. **    FREDGradualWidthIncr    -    Width increment per frame
  13. **    FREDGradualHeightIncr    -    Height increment per frame
  14. **    FREDGradualWidthFinal    -    Final width
  15. **    FREDGradualHeightFinal    -    Final height
  16. **    FREDNumberOfFrames    -    The number of frames selected
  17. **    FREDFrameCount        -    The number of frames already processed
  18. **
  19. ** NOTE: Clip names are case sensitive.
  20. **
  21. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  22. ** ADPro v2.5.0 (or higher).
  23. **
  24. ** Copyright © 1992-1993 ASDG, Incorporated
  25. ** All Rights Reserved
  26. */
  27.  
  28.  
  29. ADDRESS "ADPro"
  30. OPTIONS RESULTS
  31.  
  32. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  33.  
  34. NL = '0A'X
  35. SQ = '27'X
  36. DQ = '22'X
  37. TRUE  = 1
  38. FALSE = 0
  39.  
  40.  
  41. /*
  42. ** Get the required clips.  Error if any are missing.
  43. */
  44.  
  45. WidthCurr = GETCLIP( "FREDGradualWidthCurr" )
  46. IF (WidthCurr = "") THEN DO
  47.     ADPRO_TO_FRONT
  48.     OKAY1 "Required clip, FREDGradualWidthCurr," || NL ||,
  49.         "is not specified."
  50.     SCREEN_TO_FRONT "FRED"
  51.     EXIT 10
  52. END
  53.  
  54. HeightCurr = GETCLIP( "FREDGradualHeightCurr" )
  55. IF (HeightCurr = "") THEN DO
  56.     ADPRO_TO_FRONT
  57.     OKAY1 "Required clip, FREDGradualHeightCurr," || NL ||,
  58.         "is not specified."
  59.     SCREEN_TO_FRONT "FRED"
  60.     EXIT 10
  61. END
  62.  
  63. WidthIncr = GETCLIP( "FREDGradualWidthIncr" )
  64. IF (WidthIncr = "") THEN DO
  65.     ADPRO_TO_FRONT
  66.     OKAY1 "Required clip, FREDGradualWidthIncr," || NL ||,
  67.         "is not specified."
  68.     SCREEN_TO_FRONT "FRED"
  69.     EXIT 10
  70. END
  71.  
  72. HeightIncr = GETCLIP( "FREDGradualHeightIncr" )
  73. IF (HeightIncr = "") THEN DO
  74.     ADPRO_TO_FRONT
  75.     OKAY1 "Required clip, FREDGradualHeightIncr," || NL ||,
  76.         "is not specified."
  77.     SCREEN_TO_FRONT "FRED"
  78.     EXIT 10
  79. END
  80.  
  81. WidthFinal = GETCLIP( "FREDGradualWidthFinal" )
  82. IF (WidthFinal = "") THEN DO
  83.     ADPRO_TO_FRONT
  84.     OKAY1 "Required clip, FREDGradualWidthFinal," || NL ||,
  85.         "is not specified."
  86.     SCREEN_TO_FRONT "FRED"
  87.     EXIT 10
  88. END
  89.  
  90. HeightFinal = GETCLIP( "FREDGradualHeightFinal" )
  91. IF (HeightFinal = "") THEN DO
  92.     ADPRO_TO_FRONT
  93.     OKAY1 "Required clip, FREDGradualHeightFinal," || NL ||,
  94.         "is not specified."
  95.     SCREEN_TO_FRONT "FRED"
  96.     EXIT 10
  97. END
  98.  
  99. NumberOfFrames = GETCLIP( "FREDNumberOfFrames" )
  100. IF (NumberOfFrames = "") THEN DO
  101.     ADPRO_TO_FRONT
  102.     OKAY1 "Required clip, FREDNumberOfFrames," || NL ||,
  103.         "is not specified."
  104.     SCREEN_TO_FRONT "FRED"
  105.     EXIT 10
  106. END
  107.  
  108. FrameCount = GETCLIP( "FREDFrameCount" )
  109. IF (FrameCount = "") THEN DO
  110.     ADPRO_TO_FRONT
  111.     OKAY1 "Required clip, FREDFrameCount," || NL ||,
  112.         "is not specified."
  113.     SCREEN_TO_FRONT "FRED"
  114.     EXIT 10
  115. END
  116.  
  117.  
  118. /*
  119. ** See what type of data is loaded in ADPro/MorphPlus.
  120. */
  121.  
  122. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  123. IF (RESULT ~= 0) THEN
  124.     EXIT 10
  125.  
  126.  
  127. /*
  128. ** If the size we want to scale to is exactly half the current size,
  129. ** then we can gain a lot of speed by using the Halve operator instead
  130. ** of scaling.
  131. */
  132.  
  133. FrameCount = FrameCount + 1
  134. IF (FrameCount = NumberOfFrames) THEN DO
  135.     WidthCurr = WidthFinal
  136.     HeightCurr = HeightFinal
  137. END
  138.  
  139. ABS_SCALE WidthCurr HeightCurr
  140. IF (RC ~= 0) THEN DO
  141.     Why = ADPRO_RESULT
  142.     ADPRO_TO_FRONT
  143.     OKAY1 "Scaling failed:" || NL ||,
  144.         "Argument Information:" || NL ||,
  145.         "Width = " || WidthCurr || NL ||,
  146.         "Height = " || HeightCurr
  147.     SCREEN_TO_FRONT "FRED"
  148.     EXIT 10
  149. END
  150.  
  151.  
  152. /*
  153. ** Update the clips.
  154. */
  155.  
  156. SETCLIP( "FREDGradualWidthCurr", WidthCurr + WidthIncr )
  157. SETCLIP( "FREDGradualHeightCurr", HeightCurr + HeightIncr )
  158. SETCLIP( "FREDFrameCount", FrameCount )
  159.  
  160. EXIT 0
  161.