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

  1. /*
  2. ** DynamicRange.fred.pre
  3. **
  4. ** $VER: DynamicRange.fred.pre 1.2.0 (23.10.93)
  5. **
  6. ** If the DynamicRange.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user to enter the minimum and maximum values
  8. ** for all frames.  Alternatively, the user can specify that the program
  9. ** query for frame-specific results or only display the current range.
  10. **
  11. ** Clips Exported:
  12. **    FREDTestMode        -    ~0 if only testing images
  13. **                    0 if doing actual operation
  14. **    FREDGlobalModify    -    ~0 if operation is global
  15. **                    0 if it should be frame-specific
  16. **    FREDDynamicRangeMin    -    Minimum value (default)
  17. **    FREDDynamicRangeMax    -    Maximum value (default)
  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 NumberOfCells NumberOfFrames
  33.  
  34. NL = '0A'X
  35. SQ = '27'X
  36. DQ = '22'X
  37. TRUE  = 1
  38. FALSE = 0
  39.  
  40.  
  41. ADPRO_TO_FRONT
  42.  
  43. OKAYN '"DynamicRange.fred"' '"Query range only?"' '"Check|Change|Cancel"'
  44. IF (RC = 0) THEN DO
  45.     SCREEN_TO_FRONT "FRED"
  46.     EXIT 10
  47. END
  48. ELSE
  49.     TestMode = 2 - RC
  50.  
  51. IF (TestMode = 0) THEN DO
  52.     /*
  53.     ** Ask ask if the operation should be done globally or on
  54.     ** a frame-by-frame basis.
  55.     */
  56.  
  57.     ADPRO_TO_FRONT
  58.  
  59.     OKAYN '"DynamicRange.fred"' '"Do global modification?"' '"Global|Frame-Specific|Cancel"'
  60.     IF (RC = 0) THEN DO
  61.         SCREEN_TO_FRONT "FRED"
  62.         EXIT 10
  63.     END
  64.     ELSE
  65.         GlobalModify = 2 - RC
  66.  
  67.     SCREEN_TO_FRONT "FRED"
  68.  
  69.  
  70.     /*
  71.     ** Ask the user for the new min and max values.
  72.     */
  73.     IF (GlobalModify ~= 0) THEN DO
  74.         CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Minimum value"' 0 0 255 TRUE
  75.         IF (RESULT = (0-1)) THEN
  76.             EXIT 10
  77.         RangeMin = RESULT
  78.  
  79.         CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Maximum value"' 255 RangeMin 255 TRUE
  80.         IF (RESULT = (RangeMin-1)) THEN
  81.             EXIT 10
  82.         RangeMax = RESULT
  83.     END
  84. END
  85.  
  86.  
  87. /*
  88. ** Update the clips.
  89. */
  90.  
  91. SETCLIP( "FREDTestMode", TestMode )
  92. SETCLIP( "FREDGlobalModify", GlobalModify )
  93. SETCLIP( "FREDDynamicRangeMin", RangeMin )
  94. SETCLIP( "FREDDynamicRangeMax", RangeMax )
  95.  
  96. EXIT 0
  97.