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
|
############################################################################
#
# File: mirror.icn
#
# Subject: Procedure to mirror tile
#
# Author: Ralph E. Griswold
#
# Date: November 15, 1997
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# mirror(win) mirrors win using p2mm symmetry and returns the result as a
# hidden window.
#
############################################################################
#
# Requires: Version 9 graphics
#
############################################################################
#
# Links: wopen
#
############################################################################
link wopen
procedure mirror(win, x, y, w, h) # mirror with p2mm symmetry
local width, height, sym, x1, y1
/win := &window
/x := 0
/y := 0
/w := WAttrib(win, "width")
/h := WAttrib(win, "height")
if w < 0 then {
w := -w
x -:= w
}
if h < 0 then {
h := -h
y -:= h
}
width := 2 * w
height := 2 * h
sym := WOpen("canvas=hidden", "size=" || width || "," || height) | fail
CopyArea(win, sym, x, y, w, h)
every x := 0 to w - 1 do
CopyArea(sym, sym, x, 0, 1, h, width - x - 1, 0)
every y := 0 to h - 1 do
CopyArea(sym, sym, 0, y, width, 1, 0, height - y - 1)
return sym
end
|