http://www.ibiblio.org/pub/historic-linux/ftp-archives/sunsite.unc.edu/Sep-29-1996...
[xscreensaver] / utils / xroger.c
1 /* xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski <jwz@netscape.com>
2  *
3  * Permission to use, copy, modify, distribute, and sell this software and its
4  * documentation for any purpose is hereby granted without fee, provided that
5  * the above copyright notice appear in all copies and that both that
6  * copyright notice and this permission notice appear in supporting
7  * documentation.  No representations are made about the suitability of this
8  * software for any purpose.  It is provided "as is" without express or 
9  * implied warranty.
10  */
11
12 #include <X11/Xlib.h>
13
14 #if __STDC__
15 static void crossbones (Display *, Window, GC, int x, int y, int w, int h);
16 #endif
17
18 static void
19 crossbones (dpy, window, draw_gc, x, y, w, h)
20      Display *dpy;
21      Window window;
22      GC draw_gc;
23      int x, y, w, h;
24 {
25   double xscale = w / 440.0;
26   double yscale = h / 216.0;
27   XPoint points [6];
28   points [0].x = x + xscale * 20;
29   points [0].y = y + yscale * 10;
30   points [1].x = x + xscale * 120;
31   points [1].y = y + yscale * 10;
32   points [2].x = x + xscale * 243;
33   points [2].y = y + yscale * 93;
34   points [3].x = x + xscale * 57;
35   points [3].y = y + yscale * 210;
36   points [4].x = x + xscale * 20;
37   points [4].y = y + yscale * 210;
38   points [5].x = x + xscale * 175;
39   points [5].y = y + yscale * 113;
40   XFillPolygon (dpy, window, draw_gc, points, 6, Complex, CoordModeOrigin);
41   points [0].x = x + xscale * 197;
42   points [0].y = y + yscale * 127;
43   points [1].x = x + xscale * 384;
44   points [1].y = y + yscale * 10;
45   points [2].x = x + xscale * 420;
46   points [2].y = y + yscale * 10;
47   points [3].x = x + xscale * 265;
48   points [3].y = y + yscale * 108;
49   points [4].x = x + xscale * 420;
50   points [4].y = y + yscale * 210;
51   points [5].x = x + xscale * 320;
52   points [5].y = y + yscale * 210;
53   XFillPolygon (dpy, window, draw_gc, points, 6, Complex, CoordModeOrigin);
54 }
55
56
57 void
58 skull (dpy, window, draw_gc, erase_gc, x, y, w, h)
59      Display *dpy;
60      Window window;
61      GC draw_gc, erase_gc;
62      int x, y, w, h;
63 {
64   XPoint points [3];
65   crossbones (dpy, window, draw_gc, x, y+h/2, w, h/2);
66   x += w/100;
67   y += h/15;
68   XFillArc (dpy, window, draw_gc, (int) (x + (w * 0.3)), y, w/2, h/2,
69             -40*64, 260*64);
70   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.35)), y + h/5,
71                   (int) (w * 0.4), h/5);
72   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.375)),
73                   (int) (y + (h * 0.425)), w / 20, h / 20);
74   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.495)),
75                   (int) (y + (h * 0.425)), w / 20, h / 20);
76   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.555)),
77                   (int) (y + (h * 0.425)), w / 20, h / 20);
78   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.675)),
79                   (int) (y + (h * 0.425)), w / 20, h / 20);
80   points [0].x = x + (w * 0.435);
81   points [0].y = y + (h * 0.425);
82   points [1].x = x + (w * 0.485);
83   points [1].y = points [0].y;
84   points [2].x = (points [0].x + points [1].x) / 2;
85   points [2].y = points [0].y + h/10;
86   XFillPolygon (dpy, window, draw_gc, points, 3, Complex, CoordModeOrigin);
87   points [0].x = x + (w * 0.615);
88   points [1].x = x + (w * 0.665);
89   points [2].x = (points [0].x + points [1].x) / 2;
90   XFillPolygon (dpy, window, draw_gc, points, 3, Complex, CoordModeOrigin);
91   points [0].x = x + (w * 0.52);
92   points [0].y = y + (h * 0.35);
93   points [1].x = points [0].x - (w * 0.05);
94   points [1].y = points [0].y;
95   points [2].x = points [0].x;
96   points [2].y = points [0].y - (w * 0.10);
97   XFillPolygon (dpy, window, erase_gc, points, 3, Complex, CoordModeOrigin);
98   points [0].x = x + (w * 0.57);
99   points [1].x = x + (w * 0.62);
100   points [2].x = points [0].x;
101   XFillPolygon (dpy, window, erase_gc, points, 3, Complex, CoordModeOrigin);
102   XFillArc (dpy, window, erase_gc, x + ((int) (w * 0.375)), y + h/7,
103             w/10, h/10, 0, 360*64);
104   XFillArc (dpy, window, erase_gc, x + ((int) (w * 0.615)), y + h/7,
105             w/10, h/10, 0, 360*64);
106 }