Exemplo n.º 1
0
static void RadioIndicatorElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned state)
{
    IndicatorElement *indicator = elementRecord;
    GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
    GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
    GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
    GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
    Ttk_Padding padding;

    Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
    b = Ttk_PadBox(b, padding);

    XFillArc(Tk_Display(tkwin),d,gcb, b.x,b.y,b.width,b.height, 0,360*64);
    XDrawArc(Tk_Display(tkwin),d,gcl, b.x,b.y,b.width,b.height, 225*64,180*64);
    XDrawArc(Tk_Display(tkwin),d,gcu, b.x,b.y,b.width,b.height, 45*64,180*64);

    if (state & TTK_STATE_SELECTED) {
	b = Ttk_PadBox(b,Ttk_UniformPadding(3));
	XFillArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64);
	XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64);
#if WIN32_XDRAWLINE_HACK
	XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 300*64,360*64);
#endif
    }
}
Exemplo n.º 2
0
static void LoopBooms(struct state *st, int xlim, int ylim)
{
  int i;
  for (i = 0; i < kMaxBooms; i++) {
	 Boom *m = &st->boom[i];
	 if (!m->alive)
		continue;
	 
	 if (st->loop & 1) {
		if (m->outgoing) {
		  m->rad++;
		  if (m->rad >= m->max)
			 m->outgoing = 0;
		  XSetLineAttributes(st->dpy, st->draw_gc, 1, 0,0,0);
		  XSetForeground (st->dpy, st->draw_gc, m->color.pixel);
		  XDrawArc(st->dpy, st->window, st->draw_gc, m->x - m->rad, m->y - m->rad, m->rad * 2, m->rad * 2, 0, 360 * 64);
		}
		else {
		  XSetLineAttributes(st->dpy, st->erase_gc, 1, 0,0,0);
		  XDrawArc(st->dpy, st->window, st->erase_gc, m->x - m->rad, m->y - m->rad, m->rad * 2, m->rad * 2, 0, 360 * 64);
		  m->rad--;
		  if (m->rad <= 0)
			 m->alive = 0;
		}
	 }
  }
}
Exemplo n.º 3
0
void UpdateSquare(int x, int y)
{
    if(x%2 != y%2) {
        if(square[y][x].state) {
            SetColor(square[y][x].col);
            XFillArc(dpy,XtWindow(square[y][x].widget),gc,
                circle1,circle1,circle2,circle2,0,360*64);
            SetColor(Black);
            XDrawArc(dpy,XtWindow(square[y][x].widget),gc,
                circle1,circle1,circle2,circle2,0,360*64);
            if(square[y][x].state == King) {
                SetColor(square[y][x].col);
                XFillArc(dpy,XtWindow(square[y][x].widget),gc,
                    circle1+4,circle1+4,circle2,circle2,0,360*64);
                SetColor(Black);
                XDrawArc(dpy,XtWindow(square[y][x].widget),gc,
                    circle1+4,circle1+4,circle2,circle2,0,360*64);
            }
        } 
        else {
            SetColor(Green);
            XFillArc(dpy,XtWindow(square[y][x].widget),gc,
                circle1-2,circle1-2,circle2+8,circle2+8,0,360*64);
        }
        SetColor(square[y][x].hilite);
        XDrawRectangle(dpy,XtWindow(square[y][x].widget),gc,0,0,squaresize,squaresize);
    }
    XSync(dpy,False);
}
Exemplo n.º 4
0
ENTRYPOINT void
draw_grav(ModeInfo * mi)
{
	Display    *display = MI_DISPLAY(mi);
	Window      window = MI_WINDOW(mi);
	GC          gc = MI_GC(mi);
	register unsigned char ball;
	gravstruct *gp;

	if (gravs == NULL)
			return;
	gp = &gravs[MI_SCREEN(mi)];
	if (gp->planets == NULL)
		return;

	if (!MI_IS_DRAWN(mi)) {
		for (ball = 0; ball < (unsigned char) gp->nplanets; ball++) {
			planetstruct *planet = &gp->planets[ball];

			/* Draw planets */
			Planet(planet->xi, planet->yi);
		}

		/* Draw centrepoint */
		XDrawArc(display, MI_WINDOW(mi), gc,
			 gp->width / 2 - gp->sr / 2, gp->height / 2 - gp->sr / 2, gp->sr, gp->sr,
			 0, 23040);
	}

	MI_IS_DRAWN(mi) = True;
	/* Mask centrepoint */
	XSetForeground(display, gc, MI_BLACK_PIXEL(mi));
	XDrawArc(display, window, gc,
		 gp->width / 2 - gp->sr / 2, gp->height / 2 - gp->sr / 2, gp->sr, gp->sr,
		 0, 23040);

	/* Resize centrepoint */
	switch (NRAND(4)) {
		case 0:
			if (gp->sr < (int) STARRADIUS)
				gp->sr++;
			break;
		case 1:
			if (gp->sr > 2)
				gp->sr--;
	}

	/* Draw centrepoint */
	XSetForeground(display, gc, gp->starcolor);
	XDrawArc(display, window, gc,
		 gp->width / 2 - gp->sr / 2, gp->height / 2 - gp->sr / 2, gp->sr, gp->sr,
		 0, 23040);

	for (ball = 0; ball < (unsigned char) gp->nplanets; ball++)
		draw_planet(mi, &gp->planets[ball]);
}
Exemplo n.º 5
0
void DrawElements(Display *display, Window window, GC graphicalContext) {
	/* draw a pixel at position '5,60' (line 5, column 60) of the given window. */
	XDrawPoint(display, window, graphicalContext, 5, 5);

	/* draw a line between point '20,20' and point '40,100' of the window. */
	XDrawLine(display, window, graphicalContext, 20, 20, 40, 100);

	/* draw an arc whose center is at position 'x,y', its width (if it was a     */
	/* full ellipse) is 'w', and height is 'h'. Start the arc at angle 'angle1'  */
	/* (angle 0 is the hour '3' on a clock, and positive numbers go              */
	/* counter-clockwise. the angles are in units of 1/64 of a degree (so 360*64 */
	/* is 360 degrees).                                                          */
	int x = 30, y = 40;
	int h = 15, w = 45;
	int angle1 = 0, angle2 = 2.109;
	XDrawArc(display, window, graphicalContext, x-(w/2), y-(h/2), w, h, angle1, angle2);

	/* now use the XDrawArc() function to draw a circle whose diameter */
	/* is 15 pixels, and whose center is at location '50,100'.         */
	XDrawArc(display, window, graphicalContext, 50-(15/2), 100-(15/2), 15, 15, 0, 360*64);

	/* the XDrawLines() function draws a set of consecutive lines, whose     */
	/* edges are given in an array of XPoint structures.                     */
	/* The following block will draw a triangle. We use a block here, since  */
	/* the C language allows defining new variables only in the beginning of */
	/* a block.                                                              */
	{
	    /* this array contains the pixels to be used as the line's end-points. */
		XPoint points[] = {
				{0, 0},
				{15, 15},
				{0, 15},
				{0, 0}
	    };
	    /* and this is the number of pixels in the array. The number of drawn */
	    /* lines will be 'npoints - 1'.                                       */
	    int npoints = sizeof(points)/sizeof(XPoint);

	    /* draw a small triangle at the top-left corner of the window. */
	    /* the triangle is made of a set of consecutive lines, whose   */
	    /* end-point pixels are specified in the 'points' array.       */
	    XDrawLines(display, window, graphicalContext, points, npoints, CoordModeOrigin);
	}

	/* draw a rectangle whose top-left corner is at '120,150', its width is */
	/* 50 pixels, and height is 60 pixels.                                  */
	XDrawRectangle(display, window, graphicalContext, 120, 150, 50, 60);

	/* draw a filled rectangle of the same size as above, to the left of the  */
	/* previous rectangle. note that this rectangle is one pixel smaller then */
	/* the previous line, since 'XFillRectangle()' assumes it is filling up   */
	/* an already drawn rectangle. This may be used to draw a rectangle using */
	/* one color, and later to fill it using another color.                   */
	XFillRectangle(display, window, graphicalContext, 60, 150, 50, 60);
}
Exemplo n.º 6
0
void GraphicWindow::point(double x, double y)
{  
   const int POINT_RADIUS = 3;
   int disp_x = user_to_disp_x(x);
   int disp_y = user_to_disp_y(y);

   XSetForeground(display, xgc, BlackPixel(display, screen_num));
   XDrawArc(display, win, xgc, disp_x - POINT_RADIUS, disp_y - POINT_RADIUS,
      2 * POINT_RADIUS, 2 * POINT_RADIUS, 0 , 360 * 64);
   XDrawArc(display, _ppm, xgc, disp_x - POINT_RADIUS,
      disp_y - POINT_RADIUS, 2 * POINT_RADIUS, 2 * POINT_RADIUS, 0 , 360 * 64);
}
Exemplo n.º 7
0
static void draw_truchet(struct state *st)
{
  int cx = 0, cy = 0;

  while(st->xgwa.height+st->overlap > cy*st->height)
	{
	  while(st->xgwa.width+st->overlap > cx*st->width)
	    {
	      if(random()%2)
	      {
		/* block1 */
		XDrawArc(st->dpy, st->frame, st->agc,
			 ((cx*st->width)-(st->width/2)),
			 ((cy*st->height)-(st->height/2)),
			 st->width,
			 st->height,
			 0, -5760);
		XDrawArc(st->dpy,st->frame, st->agc,
			 ((cx*st->width)+(st->width/2)),
			 ((cy*st->height)+(st->height/2)),
			 st->width,
			 st->height,
			 11520,
			 -5760);
	      }
	    else
	      {
		/* block 2 */
		XDrawArc(st->dpy,st->frame,st->agc,
			 ((cx*st->width)+(st->width/2)),
			 ((cy*st->height)-(st->height/2)),
			 st->width,
			 st->height,
			 17280,
			 -5760);
		XDrawArc(st->dpy,st->frame,st->agc,
			 ((cx*st->width)-(st->width/2)),
			 ((cy*st->height)+(st->height/2)),
			 st->width,
			 st->height,
			 0,
			 5760);
	      }
	      cx++;
	    }
	  cy++;
	  cx=0;
	}
}
Exemplo n.º 8
0
static	void
CanvasCB(Widget canvas, XtPointer client, XEvent *ev, Boolean *cont)
{
	Display	*dpy = XtDisplay(canvas) ;
	Window	win = XtWindow(canvas) ;
	int	x0,y0 ;

	if( !canvas_init )
	{
	  Colormap cmap ;
	  XColor	y,b, dummy ;
	  XtVaGetValues(canvas, XtNcolormap, &cmap, 0) ;
	  canvasGc = XCreateGC(dpy,win, 0,NULL) ;
	  XSetLineAttributes(dpy, canvasGc, 8, LineSolid, CapButt, JoinRound);
	  XSetGraphicsExposures(dpy, canvasGc, True) ;
	  XAllocNamedColor(dpy, cmap, "yellow", &y, &dummy) ; yellow = y.pixel ;
	  XAllocNamedColor(dpy, cmap, "black", &b, &dummy) ; black = b.pixel ;
	  canvas_init = True ;
	}

	switch( ev->type ) {
	  case GraphicsExpose:
	  case Expose:
	    x0 = MwRulerValue2Position(topRuler, 1.) ;
	    y0 = MwRulerValue2Position(leftRuler, 1.) - 100 ;
	    XSetForeground(dpy,canvasGc, yellow) ;
	    XFillArc(dpy,win,canvasGc, x0,y0, 100,100, 0,360*64) ;
	    XSetForeground(dpy,canvasGc, black) ;
	    XDrawArc(dpy,win,canvasGc, x0,y0, 100,100, 0,360*64) ;
	    XFillArc(dpy,win,canvasGc, x0+30,y0+30, 10,10, 0,360*64) ;
	    XFillArc(dpy,win,canvasGc, x0+60,y0+30, 10,10, 0,360*64) ;
	    XDrawArc(dpy,win,canvasGc, x0+20,y0+20, 60,60, 225*64,90*64) ;
	    break ;
	  case EnterNotify:
	    MwRulerShowPointer(leftRuler, True) ;
	    MwRulerShowPointer(topRuler, True) ;
	    break ;
	  case LeaveNotify:
	    MwRulerShowPointer(leftRuler, False) ;
	    MwRulerShowPointer(topRuler, False) ;
	    break ;
	  case MotionNotify:
	    MwRulerSetIValue(leftRuler, ev->xmotion.y) ;
	    MwRulerSetIValue(topRuler, ev->xmotion.x) ;
	    break ;
	}

}
Exemplo n.º 9
0
void FloodFill (int X,int Y, int BorderColor) 
{
   /* a real floodfill would be rather non-trivial and inefficient on X11;
      since puff only seems to use it to clean up the regio around the Smith
      chart, we can get away with a much simpler function:
      we just draw a _very thick_ circle in the background colour around
      the Smith chart, but clipped by the square viewport around the circle.
   */
   
   if (X==0 || Y==0) return;  // FloodFill is called 4 times by the original pascal code, this check only leaves the last one

   XDrawArc(dpy, pm, gcfill, Ox-500,Oy-500,X+1000,Y+1000,0,64*360);
   XDrawArc(dpy, pm, gc, Ox,Oy,X,Y,0,64*360);

   drawcounter++;
}
Exemplo n.º 10
0
void FillEllipse (int X,int Y, int Xradius,int Yradius) 
{

   XFillArc(dpy, pm, gcfill, Ox+X-Xradius,Oy+Y-Yradius,Xradius*2,Yradius*2,0,64*360);
   XDrawArc(dpy, pm, gc,     Ox+X-Xradius,Oy+Y-Yradius,Xradius*2,Yradius*2,0,64*360);
   drawcounter++;
}
Exemplo n.º 11
0
static PyObject *
PaxGC_DrawArc(PaxGCObject * self, PyObject *args)
{
	int arg1;
	int arg2;
	unsigned int arg3;
	unsigned int arg4;
	int arg5;
	int arg6;
	if (!PyArg_ParseTuple(args, "iiiiii",
			&arg1,
			&arg2,
			&arg3,
			&arg4,
			&arg5,
			&arg6))
		return NULL;
XDrawArc(self->display, self->drawable, self->gc,
			arg1,
			arg2,
			arg3,
			arg4,
			arg5,
			arg6);
	Py_INCREF(Py_None);
	return Py_None;
}
Exemplo n.º 12
0
static void
draw_boxes (state *st)
{
  int i;
  for (i = 0; i < st->nboxes; i++)
    {
      box *b = &st->boxes[i];

      if (b->flags & UNDEAD) continue;
      if (! (b->flags & CHANGED)) continue;
      b->flags &= ~CHANGED;

      if (!st->growing_p)
        {
          /* When shrinking, black out an area outside of the border
             before re-drawing the box.
           */
          int margin = st->inc + st->border_size;

          XSetForeground (st->dpy, st->gc, st->bg_color);
          if (st->circles_p)
            XFillArc (st->dpy, st->window, st->gc,
                      b->x - margin, b->y - margin,
                      b->w + (margin*2), b->h + (margin*2),
                      0, 360*64);
          else
            XFillRectangle (st->dpy, st->window, st->gc,
                      b->x - margin, b->y - margin,
                      b->w + (margin*2), b->h + (margin*2));

          if (b->w <= 0 || b->h <= 0)
            b->flags |= UNDEAD;   /* really very dead now */
        }

      if (b->w <= 0 || b->h <= 0) continue;

      XSetForeground (st->dpy, st->gc, b->fill_color);

      if (st->circles_p)
        XFillArc (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h,
                  0, 360*64);
      else
        XFillRectangle (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h);

      if (st->border_size > 0)
        {
          unsigned int bd = (st->image
                             ? st->fg_color
                             : st->colors [(b->fill_color + st->ncolors/2)
                                           % st->ncolors].pixel);
          XSetForeground (st->dpy, st->gc, bd);
          if (st->circles_p)
            XDrawArc (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h,
                      0, 360*64);
          else
            XDrawRectangle (st->dpy, st->window, st->gc,
                            b->x, b->y, b->w, b->h);
        }
    }
}
Exemplo n.º 13
0
void stk_canvas_draw_arc(stk_widget *pl, uint x, uint y, uint w, uint h,
                                               uint angle0, uint angle1)
{
    stk_canvas *spl = (stk_canvas*)pl->ext_struct;
    XDrawArc(pl->dsp, spl->pmap, pl->gc2, x, y, w, h, angle0, angle1);
    stk_canvas_expose(pl);
} 
Exemplo n.º 14
0
Arquivo: popup.c Projeto: Fnux/tint3
void draw_popup(popup_window *w) {
    XDrawArc(w->dsp, w->canvas, w->ctx, 60, 40, 40, 40, 45, 135);

    XClearArea(w->dsp, w->win, 0, 0, w->w, w->h, 0);
    XCopyArea(dc->dpy, dc->canvas, w->win, w->ctx, 0, 0, w->w, w->h, 0, 0);
    XFlush(dc->dpy);
}
Exemplo n.º 15
0
static gboolean
draw_arc (gpointer data)
{
  Pixmap pixmap = GPOINTER_TO_UINT (data);
  Display *dpy = clutter_x11_get_default_display ();

  static GC gc = None;
  static int x = 100, y = 100;

  if (gc == None)
    {
      XGCValues gc_values = { 0 };

      gc_values.line_width = 12;
      /* This is an attempt to get a black pixel will full
         opacity. Seemingly the BlackPixel macro and the default GC
         value are a fully transparent color */
      gc_values.foreground = 0xff000000;

      gc = XCreateGC (dpy,
                      pixmap,
                      GCLineWidth | GCForeground,
                      &gc_values);
    }

  XDrawArc (dpy, pixmap, gc, x, y, 100, 100, 0, 360 * 64);

  x -= 5;
  y -= 5;

  return G_SOURCE_CONTINUE;
}
Exemplo n.º 16
0
static void DrawCircle ( Window w, GC gc, int x, int y, int x2, int y2 )
{
    FixDataOrdering ( &x, &y, &x2, &y2 );

    XDrawArc ( display,  w, gc, x, y,
               x2 - x, y2 - y, 0, 64 * 360 );
}
Exemplo n.º 17
0
// Draw self edge
void LineGraphEdge::drawSelf(Widget w,
			     const BoxRegion& exposed,
			     const GraphGC& gc) const
{
    assert(from() == to());

    // Get region
    BoxRegion region = from()->region(gc);
    if (from()->selected())
	region.origin() += gc.offsetIfSelected;

    LineGraphEdgeSelfInfo info(region, gc);

    XDrawArc(XtDisplay(w), XtWindow(w), gc.edgeGC, info.arc_pos[X],
	     info.arc_pos[Y], info.diameter, info.diameter,
	     info.arc_start * 64, info.arc_extend * 64);

    if (annotation() != 0)
    {
	// Draw annotation
	annotation()->draw(w, info.anno_pos, exposed, gc);
    }

    // Find arrow angle
    drawArrowHead(w, exposed, gc, info.arrow_pos, info.arrow_alpha);
}
Exemplo n.º 18
0
int main (int argc, char *argv[])
{

  /* connect to the X server and make a window */
  Display *dpy = XOpenDisplay (getenv ("DISPLAY"));
  Window w = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy),
                                  100, 100, 640, 480, 1,
                                  BlackPixel (dpy, DefaultScreen (dpy)),
                                  WhitePixel (dpy, DefaultScreen (dpy)));

  /* raise it and wait */
  XSelectInput (dpy, w, StructureNotifyMask);
  XMapRaised (dpy, w);
  for(XEvent e; ( e.type != MapNotify );
      XWindowEvent (dpy, w, StructureNotifyMask, &e));

  /* create a graphics context for drawing in the window */
  GC g = XCreateGC (dpy, w, 0, NULL);

  /* draw a circle */
  XDrawArc(dpy,w,g,200,100,150,150,0,360*64);
  XFlush(dpy);

  /*wait for key press*/
  XSelectInput (dpy, w, KeyReleaseMask);
  for(XEvent e; ( e.type != KeyRelease ); 
      XWindowEvent (dpy, w, KeyReleaseMask, &e));

  /*clean up*/
  XDestroyWindow( dpy, w );
  XCloseDisplay (dpy);
}
Exemplo n.º 19
0
static void draw_arc(int x, int y, unsigned int diam)
{
    (void)XDrawArc(XtDisplay(draww), pixmap, drawGC,
	     x - diam / 2, y - diam / 2,	/* x,y */
	     diam, diam,	/* width, height */
	     0, 360 * 64);	/* angle1, angle2 */
}
Exemplo n.º 20
0
  void drawCircle(XPoint centre, int radius, Color fill_color, bool fill, unsigned int line_width, int line_style, int cap_style, int join_style, int function){
    if(fill){
      line_width = radius;
      radius /= 2;
    }

    XGCValues local_gc_vals;
    local_gc_vals.function = function;
    local_gc_vals.foreground = fill_color;
    local_gc_vals.line_width = line_width;
    local_gc_vals.line_style = line_style;
    local_gc_vals.cap_style = cap_style;
    local_gc_vals.join_style = join_style;

    // Create gc for current drawable
    GC local_gc = XCreateGC(display, curr_d, GCFunction | GCForeground | 
			    GCLineWidth | GCLineStyle | GCCapStyle | 
			    GCJoinStyle, &local_gc_vals);

    XSync(display, false);

    // Draw full arc
    XDrawArc(display, curr_d, local_gc, centre.x - radius, centre.y - radius, radius * 2, radius * 2, 0, 23040);

    XSync(display, false);

    // Free temporary GC
    XFreeGC(display, local_gc);  
  }
Exemplo n.º 21
0
Arquivo: arc.c Projeto: 4ad/sam
void
arc(Bitmap *b, Point p0, Point p1, Point p2, int v, Fcode f)
{
	unsigned int d;
	int x, y, r, start, end, delta;
	GC g;

	p1.x -= p0.x;
	p1.y -= p0.y;
	p2.x -= p0.x;
	p2.y -= p0.y;
	r = (int)sqrt((double)(p1.x*p1.x + p1.y*p1.y));
	start = (int)(64*rad2deg(atan2(-p2.y, p2.x)));
	end = (int)(64*rad2deg(atan2(-p1.y, p1.x)));
	if(start < 0)
		start += 64*360;
	if(end < 0)
		end += 64*360;
	delta = end - start;
	if(delta < 0)
		delta += 64*360;
	x = p0.x - r;
	y = p0.y - r;
	if(b->flag&SHIFT){
		x -= b->r.min.x;
		y -= b->r.min.y;
	}
	d = 2*r;
	g = _getfillgc(f, b, v);
	/*
	 * delta is positive, so this draws counterclockwise arc
	 * from start to start+delta
	 */
	XDrawArc(_dpy, (Drawable)b->id, g, x, y, d, d, start, delta);
}
Exemplo n.º 22
0
void GuiCalibratorX11::redraw()
{
#ifdef HAVE_X11_XRANDR
    // check that screensize did not change
    int nsizes;
    XRRScreenSize* randrsize = XRRSizes(display, screen_num, &nsizes);
    if (nsizes != 0 && (display_width != randrsize->width ||
                        display_height != randrsize->height)) {
        set_display_size(randrsize->width, randrsize->height);
    }
#endif

    // Print the text
    int text_height = font_info->ascent + font_info->descent;
    int text_width = -1;
    for (int i = 0; i != help_lines; i++) {
        text_width = std::max(text_width, XTextWidth(font_info,
            help_text[i].c_str(), help_text[i].length()));
    }

    int x = (display_width - text_width) / 2;
    int y = (display_height - text_height) / 2 - 60;
    XSetForeground(display, gc, pixel[BLACK]);
    XSetLineAttributes(display, gc, 2, LineSolid, CapRound, JoinRound);
    XDrawRectangle(display, win, gc, x - 10, y - (help_lines*text_height) - 10,
                text_width + 20, (help_lines*text_height) + 20);

    // Print help lines
    y -= 3;
    for (int i = help_lines-1; i != -1; i--) {
        int w = XTextWidth(font_info, help_text[i].c_str(), help_text[i].length());
        XDrawString(display, win, gc, x + (text_width-w)/2, y,
                help_text[i].c_str(), help_text[i].length());
        y -= text_height;
    }

    // Draw the points
    for (int i = 0; i <= calibrator->get_numclicks(); i++) {
        // set color: already clicked or not
        if (i < calibrator->get_numclicks())
            XSetForeground(display, gc, pixel[WHITE]);
        else
            XSetForeground(display, gc, pixel[RED]);
        XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound);

        XDrawLine(display, win, gc, X[i] - cross_lines, Y[i],
                X[i] + cross_lines, Y[i]);
        XDrawLine(display, win, gc, X[i], Y[i] - cross_lines,
                X[i], Y[i] + cross_lines);
        XDrawArc(display, win, gc, X[i] - cross_circle, Y[i] - cross_circle,
                (2 * cross_circle), (2 * cross_circle), 0, 360 * 64);
    }

    // Draw the clock background
    XSetForeground(display, gc, pixel[DIMGRAY]);
    XSetLineAttributes(display, gc, 0, LineSolid, CapRound, JoinRound);
    XFillArc(display, win, gc, (display_width-clock_radius)/2, (display_height - clock_radius)/2,
                clock_radius, clock_radius, 0, 360 * 64);
}
Exemplo n.º 23
0
void draw_circle (int x, int y, int r, int color)
{
  color = (int) ((color / 255.0) * (num_colors - 1));

  gcvalues.foreground = colors[color].pixel;
  XChangeGC (display, gc, GCForeground, &gcvalues);
  XDrawArc (display, root, gc, x-r, y-r, r+r, r+r, 0, 360 * 64);
}
Exemplo n.º 24
0
void Catcher::paint(XInfo &xInfo) {
	XDrawArc(xInfo.display, xInfo.window, xInfo.gc[0], 
		(x-10)*xInfo.width/800, (600-y-15)*xInfo.height/600,
		30*xInfo.width/800, 30*xInfo.height/600, 0, 360*64);
	XFillArc(xInfo.display, xInfo.window, xInfo.gc[2], 
		(x-10)*xInfo.width/800, (600-y-15)*xInfo.height/600,
		30*xInfo.width/800, 30*xInfo.height/600, 0, 360*64);
}
Exemplo n.º 25
0
void Crcl(int i, int j, int r)
/* The function crcl draws a circle centered at i,j of radius r */
{
   if (isgraphic)
   {
      XDrawArc(display,win,drawgc,i,j+top_marg_size,2*r,2*r,0,2304);
   }
}
Exemplo n.º 26
0
/* draw arc with float x,y,width,height,angle1,angle2 */
void FXDrawArc(Display *display, Drawable d, FGC fgc,
	float fx, float fy, float fwidth, float fheight, 
	float fangle1, float fangle2)
{          
	XDrawArc(display,d,fgc->gc,
		MapFX(fgc,fx),MapFY(fgc,fy),
		MapFWidth(fgc,fwidth),MapFHeight(fgc,fheight),
		MapFAngle(fgc,fangle1),MapFAngle(fgc,fangle2));
}
Exemplo n.º 27
0
static void
draw_circle (struct state *st, Drawable w, struct throbber *t)
{
  XDrawArc (st->dpy, w, t->gc,
            t->x - t->size / 2,
            t->y - t->size / 2,
            t->size, t->size,
            0, 360*64);
}
Exemplo n.º 28
0
void DrawAim(Display * dpy, Window w, GC gc, int x, int y, char c, int color) {
    XTextItem text = { &c, 1, 5, None };

    XSetForeground(dpy, gc, color);
    XDrawArc(dpy, w, gc, x - R / 2, y - R / 2, R, R, 0, 23040);
    XDrawLine(dpy, w, gc, x - R / 2 - 10, y, x + R / 2 + 10, y);
    XDrawLine(dpy, w, gc, x, y - R / 2 - 10, x, y + R / 2 + 10);
    XDrawText(dpy, w, gc, x, y - 4, &text, 1);
}
Exemplo n.º 29
0
void GraphicWindow::ellipse(double x, double y, double ra, double rb)
{  
   int disp_x = user_to_disp_x(x);
   int disp_y = user_to_disp_y(y);
   int disp_rx = abs(user_to_disp_dx(ra));
   int disp_ry = abs(user_to_disp_dy(rb));

   XSetForeground(display, xgc, BlackPixel(display, screen_num));
   XDrawArc(display, win, 
      xgc,               // the drawable
      disp_x - disp_rx,  // the x coord of upperleft corner of bounding rect
      disp_y - disp_ry,  // the y coord of upperleft corner of bounding rect
      disp_rx * 2,       // the major axis length
      disp_ry * 2,       // the minor axis length
      0,                 // offset from 3 o'clock  
      360 * 64);         // complete circle (360 degrees * 64 clicks per degree)
   XDrawArc(display, _ppm, xgc, disp_x - disp_rx, 
   disp_y - disp_ry, disp_rx * 2, disp_ry * 2, 0, 360 * 64);
}
Exemplo n.º 30
0
void neo_draw_pen_draw_circle(NeoDrawPen *pen, NeoDrawWindow *win, int x, int y, int width, int height, bool fill)
{
  if(!pen || !win)
    return;

  if(!fill)
    XDrawArc(win->handle->display, win->id,pen->draw, x,y,width, height, 0, 360 * 64);
  else
    XFillArc(win->handle->display, win->id,pen->draw, x,y,width, height, 0, 360 * 64);
}