DrRndRect.c File Reference

#include <X11/Xlib.h>
#include <X11/Xmu/Drawing.h>

Include dependency graph for DrRndRect.c:

Go to the source code of this file.

Functions

void XmuDrawRoundedRectangle (Display *dpy, Drawable draw, GC gc, int x, int y, int w, int h, int ew, int eh)
void XmuFillRoundedRectangle (Display *dpy, Drawable draw, GC gc, int x, int y, int w, int h, int ew, int eh)


Function Documentation

void XmuDrawRoundedRectangle ( Display *  dpy,
Drawable  draw,
GC  gc,
int  x,
int  y,
int  w,
int  h,
int  ew,
int  eh 
)

Definition at line 42 of file DrRndRect.c.

00044 {
00045         XArc    arcs[8];
00046   int ew2, eh2;
00047 
00048   if ((ew2 = (ew << 1)) > w)
00049     ew2 = ew = 0;
00050   if ((eh2 = (eh << 1)) > h)
00051     eh2 = eh = 0;
00052 
00053         arcs[0].x = x;
00054         arcs[0].y = y;
00055   arcs[0].width = ew2;
00056   arcs[0].height = eh2;
00057   arcs[0].angle1 = 180 * 64;
00058   arcs[0].angle2 = -90 * 64;
00059 
00060         arcs[1].x = x + ew;
00061         arcs[1].y = y;
00062   arcs[1].width = w - ew2;
00063         arcs[1].height = 0;
00064   arcs[1].angle1 = 180 * 64;
00065   arcs[1].angle2 = -180 * 64;
00066 
00067   arcs[2].x = x + w - ew2;
00068         arcs[2].y = y;
00069   arcs[2].width = ew2;
00070   arcs[2].height = eh2;
00071   arcs[2].angle1 = 90 * 64;
00072   arcs[2].angle2 = -90 * 64;
00073 
00074         arcs[3].x = x + w;
00075         arcs[3].y = y + eh;
00076         arcs[3].width = 0;
00077   arcs[3].height = h - eh2;
00078         arcs[3].angle1 = 90 * 64;
00079   arcs[3].angle2 = -180 * 64;
00080 
00081   arcs[4].x = x + w - ew2;
00082   arcs[4].y = y + h - eh2;
00083   arcs[4].width = ew2;
00084   arcs[4].height = eh2;
00085         arcs[4].angle1 = 0;
00086   arcs[4].angle2 = -90 * 64;
00087 
00088         arcs[5].x = x + ew;
00089         arcs[5].y = y + h;
00090   arcs[5].width = w - ew2;
00091         arcs[5].height = 0;
00092         arcs[5].angle1 = 0;
00093   arcs[5].angle2 = -180 * 64;
00094 
00095         arcs[6].x = x;
00096   arcs[6].y = y + h - eh2;
00097   arcs[6].width = ew2;
00098   arcs[6].height = eh2;
00099   arcs[6].angle1 = 270 * 64;
00100   arcs[6].angle2 = -90 * 64;
00101 
00102         arcs[7].x = x;
00103         arcs[7].y = y + eh;
00104         arcs[7].width = 0;
00105   arcs[7].height = h - eh2;
00106   arcs[7].angle1 = 270 * 64;
00107   arcs[7].angle2 = -180 * 64;
00108 
00109   XDrawArcs(dpy, draw, gc, arcs, 8);
00110 }

void XmuFillRoundedRectangle ( Display *  dpy,
Drawable  draw,
GC  gc,
int  x,
int  y,
int  w,
int  h,
int  ew,
int  eh 
)

Definition at line 113 of file DrRndRect.c.

Referenced by ShapeEllipseOrRoundedRectangle().

00115 {
00116         XArc    arcs[4];
00117         XRectangle rects[3];
00118         XGCValues vals;
00119   int ew2, eh2;
00120 
00121         XGetGCValues(dpy, gc, GCArcMode, &vals);
00122         if (vals.arc_mode != ArcPieSlice)
00123             XSetArcMode(dpy, gc, ArcPieSlice);
00124 
00125   if ((ew2 = (ew << 1)) > w)
00126     ew2 = ew = 0;
00127   if ((eh2 = (eh << 1)) > h)
00128     eh2 = eh = 0;
00129 
00130         arcs[0].x = x;
00131         arcs[0].y = y;
00132   arcs[0].width = ew2;
00133   arcs[0].height = eh2;
00134   arcs[0].angle1 = 180 * 64;
00135   arcs[0].angle2 = -90 * 64;
00136 
00137   arcs[1].x = x + w - ew2 - 1;
00138         arcs[1].y = y;
00139   arcs[1].width = ew2;
00140   arcs[1].height = eh2;
00141   arcs[1].angle1 = 90 * 64;
00142   arcs[1].angle2 = -90 * 64;
00143 
00144   arcs[2].x = x + w - ew2 - 1;
00145   arcs[2].y = y + h - eh2 - 1;
00146   arcs[2].width = ew2;
00147   arcs[2].height = eh2;
00148         arcs[2].angle1 = 0;
00149   arcs[2].angle2 = -90 * 64;
00150 
00151         arcs[3].x = x;
00152   arcs[3].y = y + h - eh2 - 1;
00153   arcs[3].width = ew2;
00154   arcs[3].height = eh2;
00155   arcs[3].angle1 = 270 * 64;
00156   arcs[3].angle2 = -90 * 64;
00157 
00158   XFillArcs(dpy, draw, gc, arcs, 4);
00159 
00160         rects[0].x = x + ew;
00161         rects[0].y = y;
00162   rects[0].width = w - ew2;
00163         rects[0].height = h;
00164 
00165         rects[1].x = x;
00166         rects[1].y = y + eh;
00167         rects[1].width = ew;
00168   rects[1].height = h - eh2;
00169 
00170         rects[2].x = x + w - ew;
00171         rects[2].y = y + eh;
00172         rects[2].width = ew;
00173   rects[2].height = h - eh2;
00174 
00175   XFillRectangles(dpy, draw, gc, rects, 3);
00176 
00177         if (vals.arc_mode != ArcPieSlice)
00178             XSetArcMode(dpy, gc, vals.arc_mode);
00179 }

Here is the caller graph for this function:


Generated on Sun Mar 4 16:03:50 2007 for Scilab [trunk] by  doxygen 1.5.1