#include <X11/Xlib.h>#include <X11/Xmu/Drawing.h>Include dependency graph for DrawLogo.c:

Go to the source code of this file.
Functions | |
| void | XmuDrawLogo (Display *dpy, Drawable drawable, GC gcFore, GC gcBack, int x, int y, unsigned int width, unsigned int height) |
| void XmuDrawLogo | ( | Display * | dpy, | |
| Drawable | drawable, | |||
| GC | gcFore, | |||
| GC | gcBack, | |||
| int | x, | |||
| int | y, | |||
| unsigned int | width, | |||
| unsigned int | height | |||
| ) |
Definition at line 43 of file DrawLogo.c.
References CoordModeOrigin, and size.
00045 { 00046 unsigned int size; 00047 int thin, gap, d31; 00048 XPoint poly[4]; 00049 00050 XFillRectangle(dpy, drawable, gcBack, x, y, width, height); 00051 00052 /* for now, do a centered even-sized square, at least for now */ 00053 size = width; 00054 if (height < width) 00055 size = height; 00056 size &= ~1; 00057 x += (width - size) >> 1; 00058 y += (height - size) >> 1; 00059 00060 /* 00061 * Draw what will be the thin strokes. 00062 * 00063 * ----- 00064 * / / 00065 * / / 00066 * / / 00067 * / / 00068 * /____/ 00069 * d 00070 * 00071 * Point d is 9/44 (~1/5) of the way across. 00072 */ 00073 00074 thin = (size / 11); 00075 if (thin < 1) thin = 1; 00076 gap = (thin+3) / 4; 00077 d31 = thin + thin + gap; 00078 poly[0].x = x + size; poly[0].y = y; 00079 poly[1].x = x + size-d31; poly[1].y = y; 00080 poly[2].x = x + 0; poly[2].y = y + size; 00081 poly[3].x = x + d31; poly[3].y = y + size; 00082 XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin); 00083 00084 /* 00085 * Erase area not needed for lower thin stroke. 00086 * 00087 * ------ 00088 * / / 00089 * / __ / 00090 * / / / 00091 * / / / 00092 * /__/__/ 00093 */ 00094 00095 poly[0].x = x + d31/2; poly[0].y = y + size; 00096 poly[1].x = x + size / 2; poly[1].y = y + size/2; 00097 poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2; 00098 poly[3].x = x + d31; poly[3].y = y + size; 00099 XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); 00100 00101 /* 00102 * Erase area not needed for upper thin stroke. 00103 * 00104 * ------ 00105 * / / / 00106 * /--/ / 00107 * / / 00108 * / / 00109 * /_____/ 00110 */ 00111 00112 poly[0].x = x + size - d31/2; poly[0].y = y; 00113 poly[1].x = x + size / 2; poly[1].y = y + size/2; 00114 poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2; 00115 poly[3].x = x + size - d31; poly[3].y = y; 00116 XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); 00117 00118 /* 00119 * Draw thick stroke. 00120 * Point b is 1/4 of the way across. 00121 * 00122 * b 00123 * ----- 00124 * \ \ 00125 * \ \ 00126 * \ \ 00127 * \ \ 00128 * \____\ 00129 */ 00130 00131 poly[0].x = x; poly[0].y = y; 00132 poly[1].x = x + size/4; poly[1].y = y; 00133 poly[2].x = x + size; poly[2].y = y + size; 00134 poly[3].x = x + size - size/4; poly[3].y = y + size; 00135 XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin); 00136 00137 /* 00138 * Erase to create gap. 00139 * 00140 * / 00141 * / 00142 * / 00143 * / 00144 * / 00145 */ 00146 00147 poly[0].x = x + size- thin; poly[0].y = y; 00148 poly[1].x = x + size-( thin+gap); poly[1].y = y; 00149 poly[2].x = x + thin; poly[2].y = y + size; 00150 poly[3].x = x + thin + gap; poly[3].y = y + size; 00151 XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); 00152 }
1.5.1