Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 39fccafb9cc33eb5e2c44828f5a62bff > files > 32

lush-2.0-1.fc14.x86_64.rpm

#!/bin/sh
exec lush2 "$0" "$@"
!#

;; Displays and image (in any format).

(defvar maxwidth 800)
(defvar maxheight 600)

(cond
 ((or (member "-h" argv) 
      (member "--help" argv)
      (< (length argv) 2))
  (writing "$stderr" 
   (render-brace-text 0 72
   '{<p> 
     Synopsis: ,,(basename (car argv)) [-h] [-s maxwidth maxheight] filename

     Shows the image in file <filename>.
     The display widow is shrink-wrapped around the image unless the
     image is larger than maxwidth by maxheight (800x600 by default), 
     in which it is displayed in a scrollable window of size maxwidth be maxheight.
     The image file can be in any format that ImageMagick's <convert>
     command understands.
     The "-h" option shows this message.{<br>}
     })
  (exit 1)))
 ;; check for -w option
 ((setq opt (member "-s" argv))
  (when (not (and (cadr opt) (caddr opt)))
     (writing "$stderr" (printf "sizes missing\n"))
    (exit 1))
   (setq maxwidth (val (cadr opt)))
   (setq maxheight (val (caddr opt)))
   (when (not (and maxwidth maxheight))
     (writing "$stderr" (printf "illegal width or height\n"))
     (exit 1))))


(libload "libimage/image-io")
(ogre)
(let* ((m (image-read-rgb (lasta argv)))
       (w (min (idx-dim m 1) maxwidth))
       (h (min (idx-dim m 0) maxheight)))
  (wait (new WindowObject 10 10 (+ w 32) (+ h 32)
             "Lush Image Viewer" (new ImageViewer (+ w 30) (+ h 30) m t))))