1
/* $Xorg: DrawLogo.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
5
Copyright 1988, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall not be
24
used in advertising or otherwise to promote the sale, use or other dealings
25
in this Software without prior written authorization from The Open Group.
28
/* $XFree86: xc/lib/Xmu/DrawLogo.c,v 1.8 2001/12/14 19:55:41 dawes Exp $ */
31
#include <X11/Xmu/Drawing.h>
34
* Draw the "official" X Window System Logo, designed by Danny Chong
36
* Written by Ollie Jones, Apollo Computer
38
* Does some fancy stuff to make the logo look acceptable even
39
* if it is tiny. Also makes the various linear elements of
40
* the logo line up as well as possible considering rasterization.
43
XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
44
int x, int y, unsigned int width, unsigned int height)
50
XFillRectangle(dpy, drawable, gcBack, x, y, width, height);
52
/* for now, do a centered even-sized square, at least for now */
57
x += (width - size) >> 1;
58
y += (height - size) >> 1;
61
* Draw what will be the thin strokes.
71
* Point d is 9/44 (~1/5) of the way across.
75
if (thin < 1) thin = 1;
77
d31 = thin + thin + gap;
78
poly[0].x = x + size; poly[0].y = y;
79
poly[1].x = x + size-d31; poly[1].y = y;
80
poly[2].x = x + 0; poly[2].y = y + size;
81
poly[3].x = x + d31; poly[3].y = y + size;
82
XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
85
* Erase area not needed for lower thin stroke.
95
poly[0].x = x + d31/2; poly[0].y = y + size;
96
poly[1].x = x + size / 2; poly[1].y = y + size/2;
97
poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2;
98
poly[3].x = x + d31; poly[3].y = y + size;
99
XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
102
* Erase area not needed for upper thin stroke.
112
poly[0].x = x + size - d31/2; poly[0].y = y;
113
poly[1].x = x + size / 2; poly[1].y = y + size/2;
114
poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2;
115
poly[3].x = x + size - d31; poly[3].y = y;
116
XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
120
* Point b is 1/4 of the way across.
131
poly[0].x = x; poly[0].y = y;
132
poly[1].x = x + size/4; poly[1].y = y;
133
poly[2].x = x + size; poly[2].y = y + size;
134
poly[3].x = x + size - size/4; poly[3].y = y + size;
135
XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
138
* Erase to create gap.
147
poly[0].x = x + size- thin; poly[0].y = y;
148
poly[1].x = x + size-( thin+gap); poly[1].y = y;
149
poly[2].x = x + thin; poly[2].y = y + size;
150
poly[3].x = x + thin + gap; poly[3].y = y + size;
151
XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);