Exemplo n.º 1
0
Arquivo: do_arcs.c Projeto: aosm/X11
int 
InitSlicePartEllipses(XParms xp, Parms p, int reps)
{
    GenerateEllipses(xp, p, True, False);
    XSetArcMode(xp->d, xp->bggc, ArcPieSlice);
    XSetArcMode(xp->d, xp->fggc, ArcPieSlice);
    return reps;
}
Exemplo n.º 2
0
Arquivo: do_arcs.c Projeto: aosm/X11
int 
InitChordPartCircles(XParms xp, Parms p, int reps)
{
    GenerateCircles(xp, p, True, False);
    XSetArcMode(xp->d, xp->bggc, ArcChord);
    XSetArcMode(xp->d, xp->fggc, ArcChord);
    return reps;
}
Exemplo n.º 3
0
static PyObject *
PaxGC_SetArcMode(PaxGCObject *self, PyObject*args)
{
	int arg1;
	if (self->shared) {
		PyErr_SetString(PyExc_TypeError, "can't modify shared GC");
		return NULL;
	}
	if (!PyArg_ParseTuple(args, "i",
			&arg1))
		return NULL;
XSetArcMode(self->display, self->gc,
			arg1);
	Py_INCREF(Py_None);
	return Py_None;
}
Exemplo n.º 4
0
void iupDrawArc(IdrawCanvas* dc, int x1, int y1, int x2, int y2, double a1, double a2, unsigned char r, unsigned char g, unsigned char b, int style)
{
    XSetForeground(iupmot_display, dc->pixmap_gc, iupmotColorGetPixel(r, g, b));

    if (style==IUP_DRAW_FILL)
    {
        XSetArcMode(iupmot_display, dc->pixmap_gc, ArcPieSlice);
        XFillArc(iupmot_display, dc->pixmap, dc->pixmap_gc, x1, y1, x2 - x1 + 1, y2 - y1 + 1, iupRound(a1 * 64), iupRound((a2 - a1) * 64));
    }
    else
    {
        XGCValues gcval;
        if (style==IUP_DRAW_STROKE_DASH)
            gcval.line_style = LineOnOffDash;
        else
            gcval.line_style = LineSolid;
        XChangeGC(iupmot_display, dc->pixmap_gc, GCLineStyle, &gcval);

        XDrawArc(iupmot_display, dc->pixmap, dc->pixmap_gc, x1, y1, x2 - x1 + 1, y2 - y1 + 1, iupRound(a1 * 64), iupRound((a2 - a1) * 64));
    }
}
Exemplo n.º 5
0
void
XmuFillRoundedRectangle(Display *dpy, Drawable draw, GC gc,
			int x, int y, int w, int h, int ew, int eh)
{
	XArc	arcs[4];
	XRectangle rects[3];
	XGCValues vals;
  int ew2, eh2;

	XGetGCValues(dpy, gc, GCArcMode, &vals);
	if (vals.arc_mode != ArcPieSlice)
	    XSetArcMode(dpy, gc, ArcPieSlice);

  if ((ew2 = (ew << 1)) > w)
    ew2 = ew = 0;
  if ((eh2 = (eh << 1)) > h)
    eh2 = eh = 0;

	arcs[0].x = x;
	arcs[0].y = y;
  arcs[0].width = ew2;
  arcs[0].height = eh2;
  arcs[0].angle1 = 180 * 64;
  arcs[0].angle2 = -90 * 64;

  arcs[1].x = x + w - ew2 - 1;
	arcs[1].y = y;
  arcs[1].width = ew2;
  arcs[1].height = eh2;
  arcs[1].angle1 = 90 * 64;
  arcs[1].angle2 = -90 * 64;

  arcs[2].x = x + w - ew2 - 1;
  arcs[2].y = y + h - eh2 - 1;
  arcs[2].width = ew2;
  arcs[2].height = eh2;
	arcs[2].angle1 = 0;
  arcs[2].angle2 = -90 * 64;

	arcs[3].x = x;
  arcs[3].y = y + h - eh2 - 1;
  arcs[3].width = ew2;
  arcs[3].height = eh2;
  arcs[3].angle1 = 270 * 64;
  arcs[3].angle2 = -90 * 64;

  XFillArcs(dpy, draw, gc, arcs, 4);

	rects[0].x = x + ew;
	rects[0].y = y;
  rects[0].width = w - ew2;
	rects[0].height = h;

	rects[1].x = x;
	rects[1].y = y + eh;
	rects[1].width = ew;
  rects[1].height = h - eh2;

	rects[2].x = x + w - ew;
	rects[2].y = y + eh;
	rects[2].width = ew;
  rects[2].height = h - eh2;

  XFillRectangles(dpy, draw, gc, rects, 3);

	if (vals.arc_mode != ArcPieSlice)
	    XSetArcMode(dpy, gc, vals.arc_mode);
}
Exemplo n.º 6
0
int
XInitSpadFill(Display *dsply, int scr, Colormap * mapOfColors, int * hues,
              int *solid, int * dithered, int * shades)
{
    int maxDither;
    XColor BlackColor, WhiteColor;
    XColor retColor;
    int maxSolid;

    SpadFillInit = 1;


    /*
     * First thing I should do is get the GC's
     */
    stippleGC = XCreateGC(dsply, RootWindow(dsply, scr), 0, NULL);
    solidGC = XCreateGC(dsply, RootWindow(dsply, scr), 0, NULL);
    XSetArcMode(dsply, solidGC, ArcPieSlice);
    XSetArcMode(dsply, stippleGC, ArcPieSlice);


    cmap = DefaultColormap(dsply, scr);
    *mapOfColors = cmap;
    XAllocNamedColor(dsply, cmap, "Black", &BlackColor, &retColor);
    XAllocNamedColor(dsply, cmap, "White", &WhiteColor, &retColor);
    black = BlackColor.pixel;
    white = WhiteColor.pixel;

    /*
     * Now I check to see if I am on a monochrome display. If so then I
     * simply set totalHues to be one, and total Shades to be 2. I also have
     * to allocate balck and white colors. This I put into the first two
     * memory locations of spadcolors.
     *
     * was      if(DisplayPlanes(dsply, scr) < 2)  changed temporarily to < 8
     * because of problems with screens with 4 planes . Now if we don't have
     * 8 planes to play with  we switch to monochrome
     */

    if (DisplayPlanes(dsply, scr) < 8) {
        *dithered = totalDithered = maxGreyShade = XInitShades(dsply, scr);
        maxDither = *dithered - 1;
        spadColors = (unsigned long *) malloc(2 * sizeof(unsigned long));
        spadColors[0] = BlackColor.pixel;
        spadColors[1] = WhiteColor.pixel;
        *hues = totalHues = 1;
        *solid = totalSolid = 2;
        *shades = totalColors = totalShades = totalDithered;
        return (totalColors);
    }

    /*
     * Now I have to get all the spad colors as every good spad program
     * should Now I should initialize the dithering routines
     */

    *dithered = totalDithered =
        XInitDither(dsply, scr, stippleGC, black, white);
    maxDither = *dithered - 1;

    if ((maxSolid = makeColors(dsply, scr, &cmap, &spadColors, &totalSolid)) > 0) {
        *solid = totalSolid + 2;
        *hues = totalHues = maxSolid / totalSolid;
        *shades = totalShades = (totalSolid + 1) * (totalDithered - 1) + 1;
        totalColors = totalHues * totalShades;
        return (totalColors);
    }
    else {

        /*
         * makeColors managed to fail -- switch to mono
         */
        *dithered = totalDithered = maxGreyShade = XInitShades(dsply, scr);
        maxDither = *dithered - 1;
        spadColors = (unsigned long *) malloc(2 * sizeof(unsigned long));
        spadColors[0] = BlackColor.pixel;
        spadColors[1] = WhiteColor.pixel;
        *hues = totalHues = 1;
        *solid = totalSolid = 2;
        *shades = totalColors = totalShades = totalDithered;
        return (totalColors);
    }
}
Exemplo n.º 7
0
void
XSpadFillSetArcMode(Display *dsply, int mode)
{
    XSetArcMode(dsply, solidGC, mode);
    XSetArcMode(dsply, stippleGC, mode);
}