summaryrefslogtreecommitdiff
path: root/ipl/gprogs/fractlin.icn
blob: c9a3639180439db2b3d432757b3723d4caf42cd9 (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
75
76
77
78
############################################################################
#
#       File:     fractlin.icn
#
#	Subject:  Program to demonstrate fractal lines
#
#	Author:   Stephen Wampler
#
#	Date:     August 3, 2000
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#	Version:  1.0
#
############################################################################
#
#
#   Comments: This program shows how fractal lines work.
#
#	See the procedure 'helpmsg' for command line options
#
#	Waits for a window event before closing window
#
############################################################################
#
#	Links: glib, wopen
#
############################################################################
#
#	Requires:  Version 9 graphics and co-expressions (for glib.icn)
#
############################################################################

link glib
link wopen

global win, mono, h, w
global Window, XMAX, YMAX

procedure main (args)
    local nextarg, arg, i

    XMAX := YMAX := 700                 # physical screen size
    w := h := 1.0
   
    nextarg := create !args
    while arg := @nextarg do {
       if arg == ("-help"|"-h") then stop(helpmsg())
       }

    win := WOpen("label=Fractal Lines", "width="||XMAX, "height="||YMAX)
    mono := WAttrib (win, "depth") == "1"
    Window := set_window(win, point(0,0), point(w,h),
                  viewport(point(0,0), point(XMAX, YMAX), win))

    EraseArea(win)

    Fg(win, "black")

    every  i := 1 to 10 do {
       fract_line(Window, point(0.25,0.25), point(0.50,0.67), i/10.0)
       fract_line(Window, point(0.50,0.67), point(0.75,0.25), i/10.0)
       fract_line(Window, point(0.75,0.25), point(0.25,0.25), i/10.0)
       }

    Event(win)
    close(win)
end

procedure helpmsg()
   write("Usage: Fract")
   return
end