home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprogs / zoomtile.icn < prev   
Text File  |  2000-07-29  |  2KB  |  73 lines

  1. ############################################################################
  2. #
  3. #    File:     zoomtile.icn
  4. #
  5. #    Subject:  Program to show a tile magnified
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     July 28, 1993
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program provides an optionally magnified view of a tile.
  18. #
  19. #  Options are:
  20. #
  21. #    -z i    zoom factor, default 8
  22. #    -g    provide grid; only supported if zoom factor > 2
  23. #
  24. #  Typical usage is
  25. #
  26. #    zoomfile <tile
  27. #
  28. ############################################################################
  29. #
  30. #  Requires:  Version 9 graphics
  31. #
  32. ############################################################################
  33. #
  34. #  Links:  options, patutils, win
  35. #
  36. ############################################################################
  37.  
  38. link options
  39. link patutils
  40. link win
  41.  
  42. procedure main(args)
  43.    local i, x, y, opts, magnif, pattern, dims, row, pixel, width, height, glist
  44.  
  45.    opts := options(args, "z+g")
  46.    magnif := \opts["z"] | 8
  47.  
  48.    pattern := readpatt() | stop("*** no tile specification")
  49.  
  50.    dims := tiledim(pattern)
  51.  
  52.    width := magnif * dims.w
  53.    height := magnif * dims.h
  54.  
  55.    win(width, height)
  56.  
  57. #  Build a grid
  58.  
  59.    glist := []
  60.  
  61.    if \opts["g"] & (magnif > 2) then {
  62.       every y := 0 to height by magnif do
  63.          DrawLine(0, y, width, y)
  64.       every x := 0 to width by magnif do
  65.          DrawLine(x, 0, x, height)
  66.       }
  67.  
  68.    DrawTile(0, 0, pattern, , magnif)
  69.  
  70.    Event()
  71.  
  72. end
  73.