home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / SaversPseudo.lha / _VT_Display < prev   
Encoding:
Text File  |  1994-01-31  |  3.6 KB  |  202 lines

  1. /*
  2. ** _VT_Display
  3. **
  4. ** $VER: _VT_Display 1.2.0 (30.12.93)
  5. **
  6. ** This program can be run from ADPro's savers list to display the current
  7. ** raw image data to the current Video Toaster frame buffer.
  8. **
  9. ** This script required ADPro v2.5.0 (or higher).
  10. **
  11. ** Copyright © 1993 ASDG, Incorporated
  12. ** All Rights Reserved
  13. */
  14.  
  15.  
  16. OPTIONS FAILAT 20
  17. OPTIONS RESULTS
  18.  
  19. NL = '0A'X
  20. SQ = '27'X
  21. DQ = '22'X
  22. TRUE  = 1
  23. FALSE = 0
  24. TempFramestoreDir = "RAM:Framestore"
  25. TempFramestore = "RAM:Framestore/999.FS.ADProTemp"
  26. ToasterWidth = 752
  27. ToasterHeight = 480
  28. TempImageDir = "T:"
  29. TempImageName = "ADProTempImage"
  30.  
  31. ADDRESS "ADPro"
  32.  
  33. IF (~SHOW( 'P', "ToasterARexx.port" )) THEN DO
  34.     ADPRO_TO_FRONT
  35.     OKAY1 "Switcher is not running!"
  36.     ADPRO_TO_BACK
  37.     CALL ErrorOut 10
  38. END
  39.  
  40.  
  41. /*
  42. ** See what type of data is loaded in ADPro/MorphPlus.
  43. */
  44.  
  45. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  46. IF (RESULT ~= 0) THEN
  47.     CALL ErrorOut 10
  48.  
  49. IF (~EXISTS( TempFramestoreDir )) THEN
  50.     ADDRESS COMMAND "MakeDir " || TempFramestoreDir
  51.  
  52. XSIZE
  53. ImageWidth = ADPRO_RESULT
  54.  
  55. YSIZE
  56. ImageHeight = ADPRO_RESULT
  57.  
  58. IF (ImageWidth ~= ToasterWidth) | (ImageHeight ~= ToasterHeight) THEN DO
  59.     ADPRO_TO_FRONT
  60.  
  61.     OKAY2 "Scale to fill" ToasterWidth "x" ToasterHeight || "?" || NL || NL ||,
  62.         "Select OK to scale image" || NL ||,
  63.         "or Cancel to leave unaltered"
  64.  
  65.     IF (RC = TRUE) THEN DO
  66.         /*
  67.         ** Adjust the pixel aspect of the image.
  68.         */
  69.  
  70.         OPERATOR "DEFINE_PXL_ASPECT" 22 26
  71.         IF (RC ~= 0) THEN DO
  72.             ADPRO_TO_FRONT
  73.             OKAY1 "Could not scale to aspect."
  74.             ADPRO_TO_BACK
  75.             CALL ErrorOut 10
  76.         END
  77.  
  78.  
  79.         /*
  80.         ** Scale the image to fill a ToasterWidth x ToasterHeight screen.
  81.         */
  82.  
  83.         ABS_SCALE ToasterWidth ToasterHeight
  84.         IF (RC ~= 0) THEN DO
  85.             ADPRO_TO_FRONT
  86.             OKAY1 "Could not scale by percentage."
  87.             ADPRO_TO_BACK
  88.             CALL ErrorOut 10
  89.         END
  90.     END
  91. END
  92.  
  93. IF (EXISTS( TempFramestore )) THEN DO
  94.     ADPRO_TO_FRONT
  95.  
  96.     OKAYN '"_VT_Display"' '"Frame 999 already exists.  Delete it?"' '"Delete|Cancel"'
  97.     IF (RC = 0) THEN
  98.         CALL ErrorOut 10
  99.     ELSE
  100.         ADDRESS COMMAND "Delete >NIL:" TempFramestore
  101.  
  102.     ADPRO_TO_BACK
  103. END
  104.  
  105. SAVER "FRAMESTORE" TempFramestore "RAW" "COMPRESS" 1
  106. IF (RC ~= 0) THEN DO
  107.     ADPRO_TO_FRONT
  108.     OKAY1 "Error saving temp file."
  109.     ADPRO_TO_BACK
  110.     CALL ErrorOut 10
  111. END
  112.  
  113. IF (~SHOW( 'L', "ToasterARexx.port" )) THEN
  114.     ADDLIB( "ToasterARexx.port", -1 )
  115.  
  116. oldFS = Switcher( FSNM )
  117.  
  118. Switcher( TOSW )
  119. IF (oldFS = "RAM:") THEN
  120.     /*
  121.     ** IF FSDEV is already RAM:, just re-read it
  122.     */
  123.  
  124.     Switcher( FSBD )
  125. ELSE DO
  126.     /*
  127.     ** Change the FSDEV to RAM:
  128.     */
  129.  
  130.     IF (Switcher( FSDV, "RAM:" ) ~= SWITCHER) THEN DO
  131.         Switcher( TOWB )
  132.         ADPRO_TO_FRONT
  133.         OKAY1 "Could not change Framestore device."
  134.         ADPRO_TO_BACK
  135.         CALL ErrorOut 10
  136.     END
  137. END
  138.  
  139.  
  140. /*
  141. ** Make sure the frame is really there
  142. */
  143.  
  144. FS = Switcher( FMXI, 999 )
  145. IF (FS = 0) THEN DO
  146.     Switcher( TOWB )
  147.     ADPRO_TO_FRONT
  148.     OKAY1 "Could not load frame into Switcher."
  149.     ADPRO_TO_BACK
  150.     CALL ErrorOut 10
  151. END
  152.  
  153.  
  154. /*
  155. ** Load the frame
  156. */
  157.  
  158. IF (Switcher( FMLD, 999 ) ~= SWITCHER) THEN DO
  159.     Switcher( TOWB )
  160.     ADPRO_TO_FRONT
  161.     OKAY1 "Could not load frame into Switcher."
  162.     ADPRO_TO_BACK
  163.     CALL ErrorOut 10
  164. END
  165.  
  166. Switcher( TAKE )    /* Display the frame */
  167. Switcher( TOWB )    /* Go back to ADPro */
  168.  
  169.  
  170. /*
  171. ** Reset FSDEV to what it was before
  172. */
  173.  
  174. Switcher( FSDV, oldFS )
  175.  
  176. CALL ErrorOut 0
  177.  
  178.  
  179. ErrorOut:
  180.     PARSE ARG ExitCode
  181.  
  182.     IF (EXISTS( TempDefaults )) THEN DO
  183.         LOAD_DEFAULTS TempDefaults
  184.         IF (RC ~= 0) THEN DO
  185.             ADPRO_TO_FRONT
  186.             OKAY1 "Error restoring settings."
  187.             ADPRO_TO_BACK
  188.         END
  189.  
  190.         ADDRESS COMMAND "Delete >NIL:" TempDefaults
  191.     END
  192.  
  193.     IF (EXISTS( TempFramestore )) THEN
  194.         ADDRESS COMMAND "Delete >NIL:" TempFramestore
  195.  
  196.     IF (oldFS ~= "OLDFS") THEN
  197.         Switcher( FSDV, oldFS )
  198.  
  199.     REMLIB( "ToasterARexx.port" )
  200.  
  201.     EXIT ExitCode
  202.