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

  1. /*
  2. ** CropToSize.fred.pre
  3. **
  4. ** $VER: CropToSize.fred.pre 1.1.0 (23.10.93)
  5. **
  6. ** If the CropToSize.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user to enter the width, height, left offset,
  8. ** and top offset values of the area to be cropped.
  9. **
  10. ** Clips Exported:
  11. **    FREDCropWidth        -    Width user entered
  12. **    FREDCropHeight        -    Height user entered
  13. **    FREDCropLeftOffset    -    Left offset user entered
  14. **    FREDCropTopOffset    -    Top offset user entered
  15. **
  16. ** NOTE: Clip names are case sensitive.
  17. **
  18. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  19. ** ADPro v2.5.0 (or higher).
  20. **
  21. ** Copyright © 1993 ASDG, Incorporated
  22. ** All Rights Reserved
  23. */
  24.  
  25.  
  26. ADDRESS "ADPro"
  27. OPTIONS RESULTS
  28.  
  29. PARSE ARG NumberOfCells NumberOfFrames
  30.  
  31. NL = '0A'X
  32. SQ = '27'X
  33. DQ = '22'X
  34. TRUE  = 1
  35. FALSE = 0
  36.  
  37.  
  38. /*
  39. ** Set some default values.
  40. */
  41.  
  42. CurrentWidth  = 320
  43. CurrentHeight = 200
  44. CurrentLeft   = 0
  45. CurrentTop    = 0
  46.  
  47.  
  48. /*
  49. ** See what type of data is loaded in ADPro/MorphPlus.
  50. */
  51.  
  52. CALL "FREDSCRIPTS:FREDFunctions/CheckForImageData"
  53. IF (RESULT = 0) THEN DO
  54.     XSIZE
  55.     CurrentWidth = ADPRO_RESULT
  56.  
  57.     YSIZE
  58.     CurrentHeight = ADPRO_RESULT
  59. END
  60.  
  61.  
  62. /*
  63. ** Ask the user for a size using the currently loaded width as default.
  64. */
  65.  
  66. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Width"' CurrentWidth 1 999999 TRUE
  67. IF (RESULT = (1-1)) THEN
  68.     EXIT 10
  69. ELSE
  70.     DesiredWidth = RESULT
  71.  
  72.  
  73. /*
  74. ** Ask the user for a size using the currently loaded height as default.
  75. */
  76.  
  77. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Height"' CurrentHeight 1 999999 TRUE
  78. IF (RESULT = (1-1)) THEN
  79.     EXIT 10
  80. ELSE
  81.     DesiredHeight = RESULT
  82.  
  83.  
  84. /*
  85. ** Ask the user for an offset using the currently loaded x offset as default.
  86. */
  87.  
  88. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop X Offset"' CurrentLeft 0 999999 TRUE
  89. IF (RESULT = (0-1)) THEN
  90.     EXIT 10
  91. ELSE
  92.     DesiredLeft = RESULT
  93.  
  94.  
  95. /*
  96. ** Ask the user for an offset using the currently loaded y offset as default.
  97. */
  98.  
  99. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Crop Y Offset"' CurrentTop 0 999999 TRUE
  100. IF (RESULT = (0-1)) THEN
  101.     EXIT 10
  102. ELSE
  103.     DesiredTop = RESULT
  104.  
  105.  
  106. /*
  107. ** Update the clips.
  108. */
  109.  
  110. SETCLIP( "FREDCropWidth", DesiredWidth )
  111. SETCLIP( "FREDCropHeight", DesiredHeight )
  112. SETCLIP( "FREDCropLeftOffset", DesiredLeft )
  113. SETCLIP( "FREDCropTopOffset", DesiredTop )
  114.  
  115. EXIT 0
  116.