~aleteoryx/9c

ref: c460f2906d707ca59addf4180b4447bc05ee5310 9c/spiral.c -rw-r--r-- 746 bytes
c460f290 — glenda first* line! 37 years ago
                                                                                
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
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
#include <cursor.h>

void
usage(void)
{
	fprint(2,"usage: %s\n", argv0);
	exits("usage");
}

Point
Spt(int x, int y)
{
	return addpt(Pt(x, y), screen->r.min);
}

Rectangle
Srect(int x0, int y0, int x1, int y1)
{
	return rectaddpt(Rect(x0, y0, x1, y1), screen->r.min);
}

void
main(int argc, char* argv[])
{
	Image* drawsrc;

	ARGBEGIN{
	default:
		usage();
	} ARGEND

	if (initdraw(nil, nil, "spiral") == -1)
		sysfatal("initdraw: %r");

	drawsrc = allocimagemix(display, DPurpleblue, DPurpleblue);
	if (!drawsrc)
		sysfatal("couldn't allocimage!");

	line(screen, Spt(10,10), Spt(50,50), Enddisc, Endsquare, 5, drawsrc, Spt(0,0));
	flushimage(display, 1);
	sleep(10*1000);
}