home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / animutil / pcmovie / pcmovied.exe < prev   
Encoding:
Text File  |  1994-01-10  |  51.2 KB  |  648 lines

  1. Producing Animations on IBM PC's and PS 2's                                     
  2.                                                                                 
  3. by Viktor K. Decyk, Physics Department                                          
  4. and Joan Slottow, OAC                                                           
  5.                                                                                 
  6. A. Introduction                                                                 
  7.                                                                                 
  8. The ability to animate graphics on personal computers is an                     
  9. important visualization tool which can lead to new                              
  10. scientific insights and discoveries.  Much of science                           
  11. involves dynamics in time and the human eye is a marvelous                      
  12. tool for recognizing patterns in time.  When animating data,                    
  13. one sees details and patterns one never notices in the still                    
  14. pictures.  Animation also allows a researcher to examine                        
  15. more data more quickly.  To use animation as a discovery                        
  16. tool, it need not be fancy, just simple and easy to do.  It                     
  17. is very handy to carry these movies around on diskettes and                     
  18. pop them into a PC to show someone.  If needed, a videotape                     
  19. can be used to show the animation to a larger audience, such                    
  20. as a conference session.  Such a videotape can easily be made of                
  21. a computer animation using the equipment in UCLA's                              
  22. Visualization Demonstration Laboratory.                                         
  23.                                                                                 
  24. Viktor Decyk, of the UCLA plasma physics simulation group, has                  
  25. created a library of Fortran subroutines that produce a file                    
  26. of compressed raster images, which may then be sent to a                        
  27. personal computer for rapid playback.  Joan Slottow of OAC                      
  28. has added routines that allow existing raster images to be                      
  29. compressed and has added compressed raster image for the IBM                    
  30. PC to the output formats that can be produced by the CGM to                     
  31. Raster program, thus allowing graphics created by DISSPLA                       
  32. and SAS/GRAPH to be displayed as both stills and movies on                      
  33. IBM PCs.                                                                        
  34.                                                                                 
  35. The software for playing these movies is written by the                         
  36. National Energy Supercomputer Center (NERSC) at Lawrence                        
  37. Livermore National Laboratory and currently runs on IBM PCs                     
  38. (Ref. 1,2).  Versions for Suns and Macintoshes will be                          
  39. available soon.  The IBM PC version supports three formats:                     
  40. 4-color CGA (320x200 pixels), monochrome EGA (640x350                           
  41. pixels), and 256-color VGA (320x200 pixels).  We have given                     
  42. this program to the MIC for distribution along with the                         
  43. documentation from NERSC.                                                       
  44.                                                                                 
  45. There are several ways to create the compressed movie files:                    
  46.                                                                                 
  47.  - One way is to use the portable Fortran graphics library                      
  48.    described in a previous Perspective article (Ref. 3).  This                  
  49.    library contains nine general-purpose graphics subroutines,                  
  50.    six of which are line drawing routines and three of which                    
  51.    are contouring routines.                                                     
  52.                                                                                 
  53.  - Alternatively, you could run DISSPLA or SAS/GRAPH, both                      
  54.    of which are large graphics packages, and create your                        
  55.    graphics in a CGM metafile.  You could then run the                          
  56.    program CGM to Raster to create the compressed movie                         
  57.    file.  CGM to Raster was described in (Ref. 4) and an                        
  58.    update on it appears in this issue of Perspective.                           
  59.                                                                                 
  60.  - If you happen to have raw raster images from another                         
  61.    source, these can also be compressed into compressed                         
  62.    movie files.                                                                 
  63.                                                                                 
  64.  - Finally, you can create a compressed movie file by rasterizing               
  65.    a file of Tektronix commands.  Again, this allows you to use                 
  66.    another software package to create the images, since                         
  67.    many graphics packages, such as DISSPLA, can create                          
  68.    Tektronix files as output (Ref. 5).                                          
  69.                                                                                 
  70. The compressed movie file is sent from whatever computer it                     
  71. was created on (in this case the IBM 3090) to your PC for                       
  72. playback, using either Y-Term (which can be slow) or, if                        
  73. your PC is on the network, FTP.  In either case you must use                    
  74. binary transfer mode.                                                           
  75.                                                                                 
  76. There is no limit to the length of the movie files you can                      
  77. create, because the software from NERSC that reads the movie                    
  78. files and displays the movies reads the frames from disk as                     
  79. it displays them.  However, you might want to limit yourself                    
  80. to movies which will fit on a diskette, since that makes                        
  81. them easily transportable.                                                      
  82.                                                                                 
  83. When reading a compressed movie file from a hard disk,                          
  84. speeds of 18, 12, and 6 frames per second are typical for                       
  85. EGA, CGA, and VGA respectively, with slower speeds when                         
  86. reading directly from diskette.                                                 
  87.                                                                                 
  88. B. Calling the Routines in Viktor Decyk's Fortran Graphics Library              
  89.                                                                                 
  90. This library of subroutines was initially developed for use                     
  91. in an interactive plasma simulation program. It includes six                    
  92. X-Y plotting subroutines: GRAF2, GRAF1, GRAF3, DISP, DISP1,                     
  93. and DISP2, and three contour-plotting subroutines: CONTUR,                      
  94. DISPCN, and DSPCN2.  The subroutine library, as written by                      
  95. Viktor, supports numerous graphics output devices.  The                         
  96. subroutine library as installed at OAC includes only IBM PC                     
  97. compressed movie output.  Viktor distributes the entire                         
  98. library to interested parties.  See Reference 3.                                
  99.                                                                                 
  100. The subroutines and their arguments are:                                        
  101.                                                                                 
  102.    CALL GRAF2(  y, labely, x, labelx, n, chr, ncr, irc )                        
  103.                                                                                 
  104.       Produces a line plot of Y versus X, which fills the maximum               
  105.       area of the display region.                                               
  106.                                                                                 
  107.    CALL GRAF1(  y, labely, ymax, ymin, x, labelx, xmax, mxim, n,                
  108.                 chr, ncr, irc )                                                 
  109.                                                                                 
  110.       Produces a scattergram (point plot) of Y versus X with                    
  111.       the maximum and minimum values of the display region                      
  112.       given by YMAX, YMIN, XMAX, and XMIN.                                      
  113.                                                                                 
  114.    CALL GRAF3(  f, labely, x, labelx, n, m, nv, chr, ncr, irc )                 
  115.                                                                                 
  116.       Produces M line plots of subarrays of F versus X. Each                    
  117.       plot contains N points. The total graphic fills the                       
  118.       maximum area of the display region.                                       
  119.                                                                                 
  120.    CALL DISP(   f, label, xmin, xmax, n, m, nv, isc, chr, ncr, irc )            
  121.                                                                                 
  122.       Produces M line plots of subarrays of F versus a                          
  123.       linear function in x, where XMIN < x < XMAX. A common                     
  124.       scale given by YMAX = 2**ISC, YMIN = -2**ISC is used                      
  125.       for the Y-axis.  If ABS(ISC) > 116, the program finds                     
  126.       the minimum value of ISC which will contain the plots.                    
  127.                                                                                 
  128.    CALL DISP1(  f, label, xmin, xmax, n, m, nv, isc, ist, chr, ncr, irc )       
  129.                                                                                 
  130.       DISP1 is similar to DISP except that it includes an                       
  131.       additional parameter IST. If IST > 0, then YMIN = 0 is                    
  132.       used for the common scale, while if IST < 0, then YMAX                    
  133.       = 0 is used for the common scale. If IST = 0, then                        
  134.       DISP1 functions exactly as DISP.                                          
  135.                                                                                 
  136.    CALL DISP2(  f, label, xv, xmin, xmax, n, m, nv, isc, chr, ncr, irc )        
  137.                                                                                 
  138.       DISP2 is similar to DISP, except that only two                            
  139.       subarrays are plotted, the first as a line plot and                       
  140.       the second as a set of small closed circles.  In                          
  141.       addition, a vertical line at location x = XV is drawn.                    
  142.                                                                                 
  143.    CALL CONTUR( f, link, label, n, m, nc, nv, chr, ncr, irc )                   
  144.                                                                                 
  145.       Produces a contour plot of the function F, for values                     
  146.       of the first index in the range 1 < i < N, and of the                     
  147.       second index 1 < j < M. NC contour intervals are                          
  148.       chosen, spaced equally between the maximum and minimum                    
  149.       values of F.                                                              
  150.                                                                                 
  151.    CALL DISPCN( f, link, label, n, m, nc, nv, isc, chr, ncr, irc )              
  152.                                                                                 
  153.       DISPCN is similar to CONTUR, except that the NC contour                   
  154.       intervals are chosen equally spaced between FMAX = 2**ISC                 
  155.       and FMIN = -2**ISC.  If ABS(ISC) > 116, then the program                  
  156.       finds the minimum value of ISC which will contain the                     
  157.       function values.                                                          
  158.                                                                                 
  159.    CALL DSPCN2( f, link, label, xv, yv, n, m, nc, nv, isc, chr, ncr,            
  160.                 irc )                                                           
  161.                                                                                 
  162.       DSPCN2 is similar to DISPCN, except that a pair of                        
  163.       vertical and horizontal lines are drawn at x = XV and                     
  164.       y = YV, where the units are 0 < x < N and 0 < y < M.                      
  165.                                                                                 
  166. Where:                                                                          
  167.                                                                                 
  168.    Y, X, and F                                                                  
  169.                                                                                 
  170.       are real arrays of dimension:                                             
  171.                                                                                 
  172.          y( n ), x( n ), f( nv, m )                                             
  173.                                                                                 
  174.    LINK                                                                         
  175.                                                                                 
  176.       is a logical*1 array of dimension:                                        
  177.                                                                                 
  178.          link( 2, n, m )                                                        
  179.                                                                                 
  180.    LABELY, LABELX, and LABEL                                                    
  181.                                                                                 
  182.       are character*20 labels.                                                  
  183.                                                                                 
  184.    CHR                                                                          
  185.                                                                                 
  186.       is a character*128 label, of which                                        
  187.       NCR characters are to be printed on                                       
  188.       the plot. When NCR = 0, none                                              
  189.       of the characters in CHR are printed.                                     
  190.                                                                                 
  191.    IRC                                                                          
  192.                                                                                 
  193.       is always returned to you as 0.                                           
  194.                                                                                 
  195.                                                                                 
  196. Before the first plot, your program must initiate graphics with:                
  197.                                                                                 
  198.    CALL GOPEN                                                                   
  199.                                                                                 
  200. In addition, a common block:                                                    
  201.                                                                                 
  202.    COMMON /PLOTCM/ IPLOT, NPLOT, IDTYPE                                         
  203.                                                                                 
  204. needs to be declared at the beginning of the main program,                      
  205. and you should set the variable NPLOT to the desired number                     
  206. of plots per frame of the movie.  IPLOT is used to control                      
  207. the position of each individual plot in the frame, and is                       
  208. not usually set by the user.                                                    
  209.                                                                                 
  210. After the last plot, your program must terminate the graphics with:             
  211.                                                                                 
  212.    CALL GCLOSE                                                                  
  213.                                                                                 
  214. Also, you must open a file on Fortran Logical Unit Number 19                    
  215. to contain the compressed movie. This must be allocated as a                    
  216. card-image dataset.  You can use a DD statement such as the                     
  217. following to define this dataset:                                               
  218.                                                                                 
  219.    //GO.ddname  DD  DSN=aaaaiii.name,UNIT=DATA,DISP=(NEW,CATLG),                
  220.    //   DCB=CARD,SPACE=(TRK,(p,s),RLSE)                                         
  221.                                                                                 
  222. By default, the output is generated in the IBM PC VGA (256-color)               
  223. format.  To produce output in either the 4-color CGA or for monochrome          
  224. EGA format, you have to provide an input parameter on SYSIN as                  
  225. follows:                                                                        
  226.                                                                                 
  227.    Format    Input Parameter                                                    
  228.    CGA       1                                                                  
  229.    EGA       2                                                                  
  230.    VGA       3                                                                  
  231.                                                                                 
  232. For example, to get CGA mode code:                                              
  233.                                                                                 
  234.    //GO.SYSIN  DD *                                                             
  235.    1                                                                            
  236.                                                                                 
  237. Each execution of a call to one of the graphics subroutines                     
  238. produces a complete plot. It takes NPLOT calls to the                           
  239. subroutines to fill one frame of the movie.                                     
  240.                                                                                 
  241. Example 1:                                                                      
  242.                                                                                 
  243. This sample program makes a simple test movie of a traveling                    
  244. sine wave.  The 250-frame movie created by this test program                    
  245. occupies 553K bytes in 4-color CGA mode, 667K bytes in                          
  246. monochrome EGA mode, and 757K bytes in 256 color VGA mode.                      
  247.                                                                                 
  248.          PROGRAM MOVIET                                                         
  249.          PARAMETER(NX=128)                                                      
  250.          COMMON /PLOTCM/ IPLOT, NPLOT, IDTYPE                                   
  251.          CHARACTER*128 CHR                                                      
  252.          CHARACTER*20 CHP                                                       
  253.          DIMENSION F(NX)                                                        
  254.       91 FORMAT (8H TIME = ,F7.2)                                               
  255.          DATA NLOOP,NCURVE,ISC,NCR /250,1,0,15/                                 
  256.          DATA FREQ,DT /1.,.2/                                                   
  257.          DATA CHP /'           POTENTIAL'/                                      
  258.                                                                                 
  259.    C OPEN OUTPUT DEVICE FOR RASTER FILE                                         
  260.                                                                                 
  261.          OPEN(UNIT=19,FILE='MGRAPH',FORM='FORMATTED',STATUS='UNKNOWN')          
  262.                                                                                 
  263.    C CALCULATE CONTANTS                                                         
  264.                                                                                 
  265.          DNX = 6.2831853/FLOAT(NX)                                              
  266.          XMIN = 0.                                                              
  267.          XMAX = FLOAT(NX - 1)                                                   
  268.                                                                                 
  269.    C NPLOT = NUMBER OF GRAPHS PER PAGE                                          
  270.                                                                                 
  271.          NPLOT = 1                                                              
  272.                                                                                 
  273.    C OPEN GRAPHICS                                                              
  274.                                                                                 
  275.          CALL GOPEN                                                             
  276.                                                                                 
  277.    C MAIN TIME LOOP                                                             
  278.                                                                                 
  279.          DO 20 I = 1, NLOOP                                                     
  280.             TIME = DT*FLOAT(I - 1)                                              
  281.             WT = FREQ*TIME                                                      
  282.                                                                                 
  283.    C CALCULATE NEW FUNCTION VALUES                                              
  284.                                                                                 
  285.             DO 10 J = 1, NX                                                     
  286.                F(J) = COS(2.*DNX*FLOAT(J - 1) - WT)                             
  287.       10    CONTINUE                                                            
  288.                                                                                 
  289.    C DISPLAY FUNCTION                                                           
  290.                                                                                 
  291.             WRITE (CHR,91) TIME                                                 
  292.             CALL DISP (F,CHP,XMIN,XMAX,NX,NCURVE,NX,ISC,CHR,NCR,IRC)            
  293.             IF (IRC.EQ.1) GO TO 30                                              
  294.                                                                                 
  295.       20 CONTINUE                                                               
  296.                                                                                 
  297.    C CLOSE GRAPHICS                                                             
  298.                                                                                 
  299.       30 CALL GCLOSE                                                            
  300.          STOP                                                                   
  301.          END                                                                    
  302.                                                                                 
  303. C. Creating a Movie from images in a CGM Clear Text Metafile                    
  304.                                                                                 
  305. The program CGM to Raster has been updated to allow you to specify              
  306. CGA, EGA, or VGA as one of the output file types.  See the article              
  307. on CGM to Raster also appearing in this issue.                                  
  308.                                                                                 
  309. D. Creating a Movie from Raw Raster Images                                      
  310.                                                                                 
  311. You can call Subroutines in the Fortran Graphics library                        
  312. that create a compressed movie file from raw raster images.                     
  313. Such a movie can contain any number of frames.                                  
  314.                                                                                 
  315. You can create a compressed movie file out of a single image                    
  316. for display on an IBM PC and then tell the Movie software                       
  317. from NERSC to single-step through the movie.  You will see                      
  318. the image displayed until you press Return.                                     
  319.                                                                                 
  320. The NERSC software allows you to control the speed at which movies              
  321. are displayed so that you can play them slow or fast.                           
  322.                                                                                 
  323. Your raw-raster image should be placed in a CHARACTER*1 matrix:                 
  324.                                                                                 
  325.    raster( x,y )                                                                
  326.                                                                                 
  327. Where x is the number of columns in the image and y is the number               
  328. of rows.                                                                        
  329.                                                                                 
  330. The raw-raster image must be of one of these three types:                       
  331.                                                                                 
  332.    Type      Description                                                        
  333.    1-bit     Each pixel is represented in the low-order 1 bit of                
  334.              each character (byte) the 7 high-order bits are                    
  335.              unused.  A low-order 0 bit represents the background               
  336.              color.  A low-order 1 bit represents the drawing                   
  337.              color.                                                             
  338.    2-bits    Each pixel is represented in the low-order 2 bits of               
  339.              each character (byte).  The other 6 bits are unused.               
  340.              00 represents the background color.  01, 10, and 11                
  341.              are the drawing colors.                                            
  342.    8-bits    All the bytes of each pixel are used, giving 256 colors            
  343.              from 0 through 255.  An 8-bit raster can also be                   
  344.              accompanied by a color lookup table (CLUT).                        
  345.                                                                                 
  346. If the PC display mode with which the movie is to be                            
  347. displayed has at least as many bits as the raw-raster                           
  348. images, the images are simply compressed into the movie                         
  349. file.  If, however, the PC display mode with which the movie                    
  350. is to be displayed has fewer bits than the raw-raster                           
  351. images, the images are filtered to reduce the number of                         
  352. colors.                                                                         
  353.                                                                                 
  354.   IBM PC Format   Number of bits                                                
  355.   CGA             2                                                             
  356.   EGA             1                                                             
  357.   VGA             8                                                             
  358.                                                                                 
  359. For example, an 8-bit raster image has to be filtered to be displayed           
  360. on a CGA display; a 2-bit raster image does not.                                
  361.                                                                                 
  362. Four filters are:                                                               
  363.                                                                                 
  364.    Filter     Description                                                       
  365.    0          For EGA, the low-order 1 bit of each byte is used.                
  366.               For CGA, the low-order 2 bits of each byte are used.              
  367.    1          All 0 pixels are mapped to the background color.  All             
  368.               non-0 pixels are mapped to the drawing color.                     
  369.    2          Thresholding is used.  For EGA, all pixel values less             
  370.               than (max-min)/2 are mapped to the background color.              
  371.               All other pixel values are mapped to the drawing color.           
  372.               Where max is the largest pixel value in the raster image          
  373.               and min is the smallest. For CGA, all pixel values falling        
  374.               within the lowest fourth are mapped to the background             
  375.               color, pixel values in the next fourth are mapped to              
  376.               magenta, in the next fourth to cyan, and in the highest           
  377.               fourth to white.                                                  
  378.    3          Dithering is used.  Dithering is a process by which               
  379.               colors are replaced by dots.  For a monochrome image,             
  380.               areas of darker color are replaced by densely clustered           
  381.               dots and areas of light color are replaced by sparse              
  382.               dots. For EGA, white dots on a black background result            
  383.               from the dithering process. For CGA, the result of                
  384.               dithering depends upon whether a CLUT is supplied                 
  385.               by the user or if the default CLUT is used.                       
  386.               Each pixel value is looked up on the CLUT to                      
  387.               determine its red, green, and blue component.                     
  388.               These are dithered and combined into a                            
  389.               resultant picture with the following mapping:                     
  390.                  red     is mapped to magenta                                   
  391.                  green   is mapped to cyan                                      
  392.                  blue    is mapped to cyan                                      
  393.                  yellow  is mapped to white                                     
  394.                  magenta is mapped to magenta                                   
  395.                  cyan    is mapped to cyan                                      
  396.                  white   is mapped to white                                     
  397.                  black   is mapped to the background                            
  398.               The default CLUT maps pixels values as follows:                   
  399.                  0       black                                                  
  400.                  1       blue                                                   
  401.                  2       green                                                  
  402.                  3       cyan                                                   
  403.                  4       red                                                    
  404.                  5       yellow                                                 
  405.                  6       magenta                                                
  406.                  7       white                                                  
  407.                  8-255   black                                                  
  408.                                                                                 
  409. Filters 0 and 1 work well when the raw-raster image contains a line             
  410. drawing.  Filters 2 and 3 work well for colored in images.                      
  411.                                                                                 
  412. The following CALLs are required to create a compressed movie file:             
  413.                                                                                 
  414.    CALL GMOPEN( iout, clut, ncolors )                                           
  415.                                                                                 
  416.       Initiates the graphics.                                                   
  417.                                                                                 
  418.    CALL COMPRG( raster, nx, ny, ixdim, nbits, ifilter, iflip )                  
  419.                                                                                 
  420.       Compresses a single raw-raster image as a frame of the movie.             
  421.                                                                                 
  422.    CALL GCLOSE                                                                  
  423.                                                                                 
  424.       Terminates the graphics.                                                  
  425.                                                                                 
  426. Where:                                                                          
  427.                                                                                 
  428.    IOUT                                                                         
  429.                                                                                 
  430.        should be set to 1 for CGA, 2 for EGA, or 3 for VGA output.              
  431.                                                                                 
  432.    CLUT                                                                         
  433.                                                                                 
  434.        is a CHARACTER*1 color lookup table of 0 to 256 entries.                 
  435.        If you are not supplying a color lookup table, you must still            
  436.        provide some sort of dummy argument here.  If you are supplying          
  437.        a color lookup table, dimension it as 3 times the number of              
  438.        entries (768 max), initialize it as follows: CLUT(1) = red value         
  439.        for the first entry, CLUT(2) = green value for the first                 
  440.        entry, CLUT(3) = blue value for the first entry, CLUT(4) =               
  441.        red value for the second entry, etc.  Each value should range            
  442.        form 0 (no color) to 255 (maximum color).                                
  443.                                                                                 
  444.    NCOLORS                                                                      
  445.                                                                                 
  446.        should be set to the number of entries in CLUT.  Set NCOLORS = 0         
  447.        if you are not supplying a color lookup table (and are supplying         
  448.        a dummy argument instead).                                               
  449.                                                                                 
  450.    RASTER                                                                       
  451.                                                                                 
  452.       is the CHARACTER*1 matrix of dimension:                                   
  453.                                                                                 
  454.          raster( ixdim, ny )                                                    
  455.                                                                                 
  456.       containing the raw-raster image.                                          
  457.                                                                                 
  458.    IXDIM, NY                                                                    
  459.                                                                                 
  460.       are the dimensions of RASTER                                              
  461.                                                                                 
  462.    NX                                                                           
  463.                                                                                 
  464.       is the number of columns to select from the raster image.                 
  465.       See the discussion of the raster image size below.                        
  466.                                                                                 
  467.    NBITS                                                                        
  468.                                                                                 
  469.       is the number of significant bits in the raw-raster image:                
  470.       1, 2, or 8.                                                               
  471.                                                                                 
  472.    IFILTER                                                                      
  473.                                                                                 
  474.      is the filter you want to be used.  If the output format, EGA,             
  475.      CGA, or VGA has at least as many bits as the raw-raster image              
  476.      (NBITS), IFILTER is ignored.                                               
  477.                                                                                 
  478.    IFLIP                                                                        
  479.                                                                                 
  480.      set IFLIP to 0 if the image is right side up in RASTER and                 
  481.      to 1 if it is upside down.                                                 
  482.                                                                                 
  483. In addition, you must open a file on Fortran Logical Unit                       
  484. Number 19 to contain the compressed movie. This must be                         
  485. allocated as a card-image dataset.                                              
  486.                                                                                 
  487. The maximum number of pixels that can be displayed on the IBM PC                
  488. screen depends upon the display type:                                           
  489.                                                                                 
  490.    Type        X        Y                                                       
  491.    EGA         640      350                                                     
  492.    CGA         320      200                                                     
  493.    VGA         320      200                                                     
  494.                                                                                 
  495. Images smaller than the display size are padded with the background             
  496. color.  Images larger than the display size are truncated on the                
  497. right and the bottom.                                                           
  498.                                                                                 
  499. For images larger that the display size, you can use the                        
  500. RASTER, NX, NY, and IXDIM parameters to select a subsection                     
  501. of the image to compress into the movie file.                                   
  502.                                                                                 
  503. For example when a specific 500x387 image is displayed on VGA,                  
  504. only the upper right portion is visable.  However, since both the               
  505. left and the top of the image contain a considerable amount of                  
  506. the background color, it is desired that a different portion of the             
  507. image be displayed.                                                             
  508.                                                                                 
  509.    CALL COMPRG( raster, 320, 387, 500, nbits, ifilter, iflip )                  
  510.                                                                                 
  511.       This selects the leftmost 320 columns out of the 500 and is               
  512.       equivalent to what you would get by setting NX to 500 and                 
  513.       allowing the image to be truncated.                                       
  514.                                                                                 
  515.    CALL COMPRG( raster(181,1), 320, 387, 500, nbits, ifilter, iflip )           
  516.                                                                                 
  517.       This selects the rightmost 320 columns starting with column 181.          
  518.                                                                                 
  519.    CALL COMPRG(raster(181,188), 320, 200, 500, nbits, ifilter, iflip)           
  520.                                                                                 
  521.       This selects the rightmost 320 columns and the bottommost 200             
  522.       rows.                                                                     
  523.                                                                                 
  524. Example 2:                                                                      
  525.                                                                                 
  526. This example reads in 30 raw raster images and a CLUT and generates             
  527. a compressed movie file.                                                        
  528.                                                                                 
  529.          program rmovie                                                         
  530.          parameter( nx=259, ny=218 )                                            
  531.          character*1 raster( nx, ny )                                           
  532.          character*1 clut( 768 )                                                
  533.                                                                                 
  534.    *     ***********************************                                    
  535.    *     OPEN OUTPUT DEVICE FOR RASTER FILE                                     
  536.    *     ***********************************                                    
  537.                                                                                 
  538.          OPEN(UNIT=19,FILE='MGRAPH',FORM='FORMATTED',STATUS='UNKNOWN')          
  539.                                                                                 
  540.    *     ***********************************                                    
  541.    *     read the clut                                                          
  542.    *     ***********************************                                    
  543.                                                                                 
  544.          read( 1, 1 )  clut                                                     
  545.     1       format( 200a1, 56a1 )                                               
  546.             CALL GMOPEN( 1, clut, 256 )                                         
  547.                                                                                 
  548.    *     ***********************************                                    
  549.    *     read the raster image                                                  
  550.    *     ***********************************                                    
  551.                                                                                 
  552.          do 5 i = 1, 30                                                         
  553.             do 3 iy = 1, ny                                                     
  554.                read( 2, 2 )  ( raster( ix,iy ), ix = 1, nx )                    
  555.    2           format( 200a1, 200a1, 100a1 )                                    
  556.    3        continue                                                            
  557.                                                                                 
  558.    *        ***********************************                                 
  559.    *        put out the image                                                   
  560.    *        ***********************************                                 
  561.                                                                                 
  562.             CALL COMPRG( raster, nx, ny, nx, 8, 1, 0 )                          
  563.                                                                                 
  564.    *        ***********************************                                 
  565.    *        bump the dataset sequence number                                    
  566.    *        ***********************************                                 
  567.                                                                                 
  568.             read( 2, 2,end=5 )  ( raster( ix,iy ), ix = 1, nx )                 
  569.    5     continue                                                               
  570.                                                                                 
  571.          CALL GCLOSE                                                            
  572.                                                                                 
  573.          STOP                                                                   
  574.          END                                                                    
  575.                                                                                 
  576. E. JCL required to use the Fortran Graphics Library                             
  577.                                                                                 
  578.    //aaaaiiic  JOB  job-parameters                                              
  579.    //  EXEC FORTCG,LIBB='APP1.PCMOVIE.LOAD'                                     
  580.       (Fortran Program)                                                         
  581.    //GO.ddname19  DD  DISP=(NEW,CATLG),DSN=aaaaiii.cmf,                         
  582.    //   DCB=CARD,UNIT=DATA,SPACE=(TRK,(p,s),RLSE)                               
  583.    //GO.ddname  DD  dd-parameters                                               
  584.    //GO.SYSIN  DD  *                                                            
  585.    n                                                                            
  586.                                                                                 
  587. Where:                                                                          
  588.                                                                                 
  589.    aaaaiii                                                                      
  590.       is your Userid.                                                           
  591.                                                                                 
  592.    c                                                                            
  593.       is an optional character to make the jobname unique.                      
  594.                                                                                 
  595.    ddname19                                                                     
  596.       is your ddname for Fortran Logical Unit 19.                               
  597.                                                                                 
  598.    aaaaiii.cmf                                                                  
  599.       is the dataset to contain the compressed movie file.                      
  600.                                                                                 
  601.    p and s                                                                      
  602.       are the primary and secondary space requests for this dataset.            
  603.                                                                                 
  604.    //GO.ddname  DD  dd-parameters                                               
  605.       are any additional DD statements required by your program                 
  606.       including those necessary to read in a color lookup table and             
  607.       raster images, if any.                                                    
  608.                                                                                 
  609.    //GO.SYSIN  DD * and n                                                       
  610.       is required only when you are calling the graphics routines               
  611.       in the Fortran Graphics Library and want something other than             
  612.       the default VGA output.                                                   
  613.                                                                                 
  614. F. Creating a Movie from Textronix Files                                        
  615.                                                                                 
  616. If you have already saved Textronix Files from some other source,               
  617. Viktor will be happy to give you access to his software.                        
  618.                                                                                 
  619. G. Test Movie Player for the IBM 3179s                                          
  620.                                                                                 
  621. You can preview the frames in your compressed movie file on the                 
  622. IBM 3179 terminals before transfering it to the PC.  Logon to                   
  623. TSO and enter:                                                                  
  624.                                                                                 
  625.    PCMOVIE dsname                                                               
  626.                                                                                 
  627. H. References                                                                   
  628.                                                                                 
  629.                                                                                 
  630. 1. Jean Shuler, "Kinetic Output for Viewing Your Graphics                       
  631. Files Dynamically on Your PC," NMFECC Buffer, Vol. 12, No.                      
  632. 6, p. 6 (1988).                                                                 
  633.                                                                                 
  634. 2. MOVIE Document                                                               
  635. National Energy Supercomputer Center                                            
  636. Lawrence Livermore National Laboratory                                          
  637.                                                                                 
  638. 3. V. K. Decyk, "A Portable Fortran Graphics Library,"                          
  639. UCLA-OAC Perspective, vol. 14, No. 2, p. 16 (1990).                             
  640.                                                                                 
  641. 4. OAC Writeup MVS: Visualizing Supercomputer Scientific Data on                
  642. Macintoshes (SG22)                                                              
  643.                                                                                 
  644. 5.  V. K.  Decyk and L. Xu, "Transmission of Graphics by                        
  645. Electronic Mail," UCLA-OAC Perspective, Vol. 11, No. 4, p.                      
  646. 30 (1987).                                                                      
  647.                                                                                 
  648.