summaryrefslogtreecommitdiff
path: root/ipl/gprocs/tiler.icn
blob: dae19974c94d33cda2464b9a3d43765181f17acd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
############################################################################
#
#	File:     tiler.icn
#
#	Subject:  Procedures to tile window with image
#
#	Author:   Ralph E. Griswold
#
#	Date:     December 18, 1997
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  tileimg(win, image) tiles win with copies of image.
#
#  tileims(win, ims) tiles win with copies of the image specified by ims
#
#  Note that tileimg() uses the gamma value of win.
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#  Links:  imutils, tile
#
############################################################################

link imutils
link tile

procedure tileimg(win, img)		#: tile image
   local hidden

   hidden := WOpen("canvas=hidden", "image=" || img, "gamma=" ||
      WAttrib(win, "gamma")) | {
      write(&errout, "*** cannot open image ", img)
      fail
      }

   tile(hidden, win)

   WClose(hidden)

   return

end

procedure tileims(win, ims)		#: tile image string
   local w, h

   w := imswidth(ims)
   h := imsheight(ims)

   if ims ? {
      tab(many(&digits)) & =",#"
      } then {
         WAttrib(win, "pattern=" || ims)
         WAttrib(win, "fillstyle=textured")
         FillRectangle(win)
         }
   
   else {
      DrawImage(win, 0, 0, ims) | fail
      tile(win, win, 0, 0, w, h)
      }

   return

end