procedure main(av) w1 := open(av[1],"g","canvas=hidden","image="||av[1]) | stop("can't open window or image file argument") wid := WAttrib(w1, "width") ht := WAttrib(w1, "height") w2 := open(av[1],"g","size="||(wid*2)||","||(ht*2)) CopyArea(w1,w2,0,0,wid,ht,0,0) CopyArea(w1,w2,0,0,wid,ht,wid,ht) CopyArea(w1,w2,0,0,wid,ht,0,ht) CopyArea(w1,w2,0,0,wid,ht,wid,0) WAttrib(w2,"label=Tilinator: is it good enough already?") if Event(w2) === "y" then exit(0) x := y := 0 wid2 := wid * 2 ht2 := ht * 2 every p := Pixel(w1) do { x +:= 1 if x = wid then { x := 0; y +:= 1 } Fg(w2, p) mirx := wid2 - x - 1 miry := ht2 - y - 1 DrawPoint(w2, mirx, miry, mirx, y, x, miry) } WAttrib(w2,"label=Tilinator: now is it good enough?") if Event(w2) === "y" then { WriteImage(w2,"tile-" || av[1], 0, 0) exit(0) } # go off and do a more serious mathematical tiling end