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