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

  1. /*
  2. ** SimpleRotate.fred
  3. **
  4. ** $VER: SimpleRotate.fred 1.2.0 (23.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to rotate the current
  7. ** frame by the previously defined amount.  Note that the rotation will be
  8. ** centered on the image and encompass the entire image.
  9. **
  10. ** Clips Imported:
  11. **    FREDCurrentRotateAmount    -    Current Rotate amount (degrees)
  12. **    FREDRotateIncrement    -    Rotate increment per frame
  13. **
  14. ** Clips Exported:
  15. **    FREDCurrentRotateAmount    -    Current Rotate amount (degrees)
  16. **    FREDOverrideLength    -    Override Length parameter flag
  17. **                    (if 1, override the Length)
  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. RotateAmount = GETCLIP( "FREDCurrentRotateAmount" )
  46. IF (RotateAmount = "") THEN DO
  47.     ADPRO_TO_FRONT
  48.     OKAY1 "Required clip, FREDCurrentRotateAmount," || NL ||,
  49.         "is not specified."
  50.     SCREEN_TO_FRONT "FRED"
  51.     EXIT 10
  52. END
  53.  
  54. RotateIncrement = GETCLIP( "FREDRotateIncrement" )
  55. IF (RotateIncrement = "") THEN DO
  56.     ADPRO_TO_FRONT
  57.     OKAY1 "Required clip, FREDRotateIncrement," || NL ||,
  58.         "is not specified."
  59.     SCREEN_TO_FRONT "FRED"
  60.     EXIT 10
  61. END
  62.  
  63.  
  64. /*
  65. ** See what type of data is loaded in ADPro/MorphPlus.
  66. */
  67.  
  68. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  69. IF (RESULT ~= 0) THEN
  70.     EXIT 10
  71.  
  72.  
  73. /*
  74. ** Do the Rotate operation, with the rotate circle centered on the image
  75. ** and encompassing the entire image.
  76. */
  77.  
  78. XSIZE
  79. CenterX = ADPRO_RESULT / 2
  80.  
  81. YSIZE
  82. CenterY = ADPRO_RESULT / 2
  83.  
  84. OPERATOR "ROTATE",
  85.     "CENTER" CenterX CenterY,
  86.     "RADIUS" CenterX + CenterY,
  87.     "AMOUNT" RotateAmount,
  88.     "BLUR_RADIUS" 5,
  89.     "QUALITY_HIGH"
  90. IF (RC ~= 0) THEN DO
  91.     Why = ADPRO_RESULT
  92.     ADPRO_TO_FRONT
  93.     OKAY1 "The operator ROTATE" || NL ||,
  94.         "failed to execute." || NL ||,
  95.         Why
  96.     SCREEN_TO_FRONT "FRED"
  97.     EXIT 10
  98. END
  99.  
  100.  
  101. /*
  102. ** Update the clips.
  103. */
  104.  
  105. SETCLIP( "FREDCurrentRotateAmount", RotateAmount + RotateIncrement )
  106. SETCLIP( "FREDOverrideLength", 1 )
  107.  
  108. EXIT 0
  109.