home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / dir / filer / rexx / picasso.filer < prev    next >
Text File  |  1994-03-11  |  23KB  |  582 lines

  1. /*
  2.     $VER: Picasso.filer 1.5 (10.03.94)
  3.  
  4.     Author:
  5.         Michael Böhnisch (billy@uni-paderborn.de)   (mb)
  6.         Matthias Scheler (tron@lyssa.pb.owl.de)     (ms)
  7.  
  8.     Function:
  9.         ViewGIF,  the  GIF  viewer that accompanies the Picasso II graphics
  10.         board,  often  selects  wrong resolutions when displaying oversized
  11.         pictures.   E.g.   I´ve  got  a  picture,  600×800 in size, ViewGIF
  12.         displays  on  a  1024×768  screen,  cropping off the lower 34 rows.
  13.         Picasso.filer  scans  the  GIF file for the picture size and forces
  14.         ViewGIF into a better resolution.
  15.  
  16.         ViewJPEG  uses  640×480×24  by default, regardless whether it crops
  17.         the  image  or not.  I prefer seeing the whole image when possible,
  18.         so Picasso.filer allows 16 or 8 bits per pixel resolutions.  Bigger
  19.         pictures  may  take a while to display, especially on unaccelerated
  20.         Amigas.  Stay patient.
  21.  
  22.         ViewIFF   does   not  show  Multi  Palette  pictures  (PCHG  chunk)
  23.         correctly.  Picasso.filer provides a fallback to an external viewer
  24.         when such pictures are selected.
  25.         Pixels  on  the  Picasso  II board usually are square shaped, or in
  26.         other  words  have  an  X/Y  aspect  ratio  of  1.  This results in
  27.         distorted picture displays for special view modes like  "NTSC:LoRes
  28.         Lace".
  29.         Picasso.filer handles this by supplying one of the keywords DOUBLEX
  30.         or  DOUBLEY  to  ViewIFF  as  appropriate.  For extreme distortions
  31.         (e.g.   pictures for PAL:SuperHighres non-interlaced) a fallback to
  32.         an  external  external  viewer  on  conservative  Amiga  screens is
  33.         choosen.
  34.  
  35.     Requires:
  36.         Picasso II graphics board
  37.         ViewGIF, ViewJPEG and ViewIFF supplied with Picasso II
  38.         VT  2.0  by Thomas Krehbiel or any other standard IFF viewer.  Must
  39.         support  PCHG  Multi  Palette  pictures  if  you  want to view this
  40.         picture type.
  41.  
  42.     Call:
  43.         Picasso TYPE FILE
  44.  
  45.         Where  TYPE is one of GIF, IFF or JPG.  Picasso.filer relies on the
  46.         correctness of this info and does no further file type checking.
  47.  
  48.     Example for "Filer.RC":
  49.         REXXCLASS "#?","GIF8","Picasso GIF %s"
  50.         REXXCLASS "#?","??????JFIF","Picasso JPG %s"
  51.         REXXCLASS "#?","FORM????ILBM","Picasso IFF %s"
  52.  
  53.     ToDo:
  54.         IFF pictures with aspect ratios outside the range from 0.35 to 2.83
  55.         are displayed on standard Amiga screens.  Maybe some tool should be
  56.         used  to do a scale operation on the picture first and then forward
  57.         it to the Picasso viewer.
  58.  
  59.     History:
  60.         06.02.94    1.0 Initial Release                             (mb)
  61.         07.02.94    1.1 IFF & JPEG added                            (mb)
  62.         08.02.94    1.2 fallback for HAM/EHB pictures removed       (ms)
  63.         09.02.94    1.3 removed VT dependency for GIF
  64.                         removed VT dependency for IFF, any viewer
  65.                         wil do now
  66.                         added IFF PCHG fallback
  67.                         added fallback for non-square aspect ratios (mb)
  68.         10.02.94    1.4 used ViewIFF keywords DOUBLEX and DOUBLEY
  69.                         for a wider range of pictures displayed on
  70.                         the Picasso II                              (mb)
  71.         10.03.94    1.5 removed VT dependency for JPEG
  72.                         no need for rexxsupport.library any longer
  73.                         added user confirmation for oversized JPEGs (mb)
  74. */
  75.  
  76. /* -------------------------------------------------------------------- */
  77. /* External commands. Adjust these to your individual settings.         */
  78. /* -------------------------------------------------------------------- */
  79.  
  80. vtcommand = "VT"
  81. vgcommand = "ViewGIF"
  82. vjcommand = "ViewJPEG"
  83. vicommand = "ViewIFF"
  84.  
  85. /* -------------------------------------------------------------------- */
  86.  
  87. OPTIONS RESULTS                     /* we need response from filer      */
  88.  
  89. PARSE ARG TYPE PICFILE              /* get arguments                    */
  90. TYPE    = STRIP( TYPE )
  91. PICFILE = STRIP( PICFILE )
  92.  
  93. /* -------------------------------------------------------------------- */
  94. /* Default to Filer's AReXX port and prevent Filer from quitting        */
  95. /* -------------------------------------------------------------------- */
  96.  
  97. ADDRESS 'FilerRexx'
  98.  
  99. LOCKFILER
  100. Key = RESULT
  101.  
  102. /* -------------------------------------------------------------------- */
  103. /* Get source dircetory name, append "/" if it is not a device name.    */
  104. /* Tag name of file to view.                                            */
  105. /* -------------------------------------------------------------------- */
  106.  
  107. GETSOURCEPATH
  108. SrcPath = RESULT
  109.  
  110. IF RIGHT(SrcPath, 1) = ':' THEN
  111.     FileName = SrcPath || STRIP( PICFILE, B, X2C(22) )
  112. ELSE
  113.     FileName = SrcPath || '/' || STRIP( PICFILE, B, X2C(22) )
  114.  
  115. SELECT
  116.  
  117.     /* ---------------------------------------------------------------- */
  118.     /* Show GIF picture                                                 */
  119.     /* ---------------------------------------------------------------- */
  120.  
  121.     WHEN TYPE = 'GIF' THEN DO
  122.  
  123.         /* ------------------------------------------------------------ */
  124.         /* determine ViewGIF RESOLUTION parameter and call viewer       */
  125.         /* ------------------------------------------------------------ */
  126.  
  127.         CALL GIFSize
  128.         PARSE VAR RESULT xsize ysize depth
  129.         xsize = STRIP( xsize )
  130.         ysize = STRIP( ysize )
  131.         depth = STRIP( depth )
  132.  
  133.         res = 1600
  134.         IF ( xsize <= 1280 ) & ( ysize <= 1024 ) THEN res = 1280
  135.         IF ( xsize <= 1152 ) & ( ysize <=  900 ) THEN res = 1152
  136.         IF ( xsize <= 1120 ) & ( ysize <=  832 ) THEN res = 1120
  137.         IF ( xsize <= 1024 ) & ( ysize <=  768 ) THEN res = 1024
  138.         IF ( xsize <=  800 ) & ( ysize <=  600 ) THEN res =  800
  139.         IF ( xsize <=  640 ) & ( ysize <=  480 ) THEN res =  640
  140.         IF ( xsize <=  320 ) & ( ysize <=  240 ) THEN res =  320
  141.  
  142.         HISTORY 'Picasso: GIF "' || FileName || '"' xsize || '×' || ysize || '×' || depth
  143.  
  144.         SHELL COMMAND vgcommand RESOLUTION res CENTER FileName '>NIL:'
  145.  
  146.     END
  147.  
  148.     /* ---------------------------------------------------------------- */
  149.     /* Show JPG picture                                                 */
  150.     /* ---------------------------------------------------------------- */
  151.  
  152.     WHEN TYPE = 'JPG' THEN DO
  153.  
  154.         /* ------------------------------------------------------------ */
  155.         /* Determine JPEG picture size                                  */
  156.         /* ------------------------------------------------------------ */
  157.  
  158.         CALL JPGSize
  159.         PARSE VAR RESULT xsize ysize depth
  160.         xsize = STRIP( xsize )
  161.         ysize = STRIP( ysize )
  162.         depth = STRIP( depth )
  163.  
  164.         /* ------------------------------------------------------------ */
  165.         /* choose maximum number of colors available without cropping   */
  166.         /* and call ViewJPG                                             */
  167.         /* ------------------------------------------------------------ */
  168.  
  169.         dep = '8BIT'
  170.         IF ( xsize <= 1152 ) & ( ysize <=  900 ) THEN dep = '16BIT'
  171.         IF ( xsize <=  800 ) & ( ysize <=  600 ) THEN dep = '24BIT'
  172.  
  173.         banner = xsize || '×' || ysize || '×' || depth
  174.  
  175.         HISTORY 'Picasso: JPG "' || FileName || '"' banner '(' || dep || ')'
  176.  
  177.         /* ------------------------------------------------------------ */
  178.         /* Ask for confirmation if picture is "on the big side"         */
  179.         /* ------------------------------------------------------------ */
  180.  
  181.         display = 1
  182.         IF xsize * ysize > 1000000 THEN DO
  183.             txt =        "This operation may take a long time.|"
  184.             txt = txt || "      Shall I continue anyway?"
  185.  
  186.             QUESTBOX txt
  187.             display = RESULT
  188.         END
  189.  
  190.         IF display = 1 THEN SHELL COMMAND vjcommand dep FileName '>NIL:'
  191.  
  192.     END
  193.  
  194.     /* ---------------------------------------------------------------- */
  195.     /* Show IFF ILBM picture                                            */
  196.     /* -------------------------------------------------