ftp://ftp.ntnu.no/old/pub/X11/R5contrib/xscreensaver-1.17.tar.gz
[xscreensaver] / utils / xroger.c
1 /* xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski <jwz@lucid.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 static void
15 crossbones (dpy, window, draw_gc, x, y, w, h)
16      Display *dpy;
17      Window window;
18      GC draw_gc;
19      int x, y, w, h;
20 {
21   double xscale = w / 440.0;
22   double yscale = h / 216.0;
23   XPoint points [6];
24   points [0].x = x + xscale * 20;
25   points [0].y = y + yscale * 10;
26   points [1].x = x + xscale * 120;
27   points [1].y = y + yscale * 10;
28   points [2].x = x + xscale * 243;
29   points [2].y = y + yscale * 93;
30   points [3].x = x + xscale * 57;
31   points [3].y = y + yscale * 210;
32   points [4].x = x + xscale * 20;
33   points [4].y = y + yscale * 210;
34   points [5].x = x + xscale * 175;
35   points [5].y = y + yscale * 113;
36   XFillPolygon (dpy, window, draw_gc, points, 6, Complex, CoordModeOrigin);
37   points [0].x = x + xscale * 197;
38   points [0].y = y + yscale * 127;
39   points [1].x = x + xscale * 384;
40   points [1].y = y + yscale * 10;
41   points [2].x = x + xscale * 420;
42   points [2].y = y + yscale * 10;
43   points [3].x = x + xscale * 265;
44   points [3].y = y + yscale * 108;
45   points [4].x = x + xscale * 420;
46   points [4].y = y + yscale * 210;
47   points [5].x = x + xscale * 320;
48   points [5].y = y + yscale * 210;
49   XFillPolygon (dpy, window, draw_gc, points, 6, Complex, CoordModeOrigin);
50 }
51
52
53 void
54 skull (dpy, window, draw_gc, erase_gc, x, y, w, h)
55      Display *dpy;
56      Window window;
57      GC draw_gc, erase_gc;
58      int x, y, w, h;
59 {
60   XPoint points [3];
61   crossbones (dpy, window, draw_gc, x, y+h/2, w, h/2);
62   x += w/100;
63   y += h/15;
64   XFillArc (dpy, window, draw_gc, (int) (x + (w * 0.3)), y, w/2, h/2,
65             -40*64, 260*64);
66   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.35)), y + h/5,
67                   (int) (w * 0.4), h/5);
68   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.375)),
69                   (int) (y + (h * 0.425)), w / 20, h / 20);
70   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.495)),
71                   (int) (y + (h * 0.425)), w / 20, h / 20);
72   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.555)),
73                   (int) (y + (h * 0.425)), w / 20, h / 20);
74   XFillRectangle (dpy, window, draw_gc, (int) (x + (w * 0.675)),
75                   (int) (y + (h * 0.425)), w / 20, h / 20);
76   points [0].x = x + (w * 0.435);
77   points [0].y = y + (h * 0.425);
78   points [1].x = x + (w * 0.485);
79   points [1].y = points [0].y;
80   points [2].x = (points [0].x + points [1].x) / 2;
81   points [2].y = points [0].y + h/10;
82   XFillPolygon (dpy, window, draw_gc, points, 3, Complex, CoordModeOrigin);
83   points [0].x = x + (w * 0.615);
84   points [1].x = x + (w * 0.665);
85   points [2].x = (points [0].x + points [1].x) / 2;
86   XFillPolygon (dpy, window, draw_gc, points, 3, Complex, CoordModeOrigin);
87   points [0].x = x + (w * 0.52);
88   points [0].y = y + (h * 0.35);
89   points [1].x = points [0].x - (w * 0.05);
90   points [1].y = points [0].y;
91   points [2].x = points [0].x;
92   points [2].y = points [0].y - (w * 0.10);
93   XFillPolygon (dpy, window, erase_gc, points, 3, Complex, CoordModeOrigin);
94   points [0].x = x + (w * 0.57);
95   points [1].x = x + (w * 0.62);
96   points [2].x = points [0].x;
97   XFillPolygon (dpy, window, erase_gc, points, 3, Complex, CoordModeOrigin);
98   XFillArc (dpy, window, erase_gc, x + ((int) (w * 0.375)), y + h/7,
99             w/10, h/10, 0, 360*64);
100   XFillArc (dpy, window, erase_gc, x + ((int) (w * 0.615)), y + h/7,
101             w/10, h/10, 0, 360*64);
102 }