コード例 #1
0
ファイル: ttkClamTheme.c プロジェクト: aosm/tcl
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
    }
}
コード例 #2
0
ファイル: hw1.c プロジェクト: mk200789/Fundamental-Algorithms
void reset(int m[][6], int line_count){
	int i, j;

	for (i= 0; i<k; i++){
		if  (valid_vertex[i][6] == 0.0 || valid_vertex[i][6] == -4.0){
			printf("from (%d, %d) to (%d, %d) length: %f and path length: %f\n", (int)valid_vertex[i][0], (int)valid_vertex[i][1], (int)valid_vertex[i][2], (int)valid_vertex[i][3], valid_vertex[i][4], valid_vertex[i][5]);
			XDrawLine(display, win, white_gc, valid_vertex[i][0], valid_vertex[i][1], valid_vertex[i][2], valid_vertex[i][3]);
		}
	}

	XFillArc( display, win, white_gc, start_x, start_y, win_width/200, win_width/200, 0, 360*64);
	XFillArc( display, win, white_gc, target_x, target_y, win_width/200, win_width/200, 0, 360*64);

	for(i=0; i<k; i++){
		for (j=0; j<7; j++){
			valid_vertex[i][j] = 0.0;
		}
	}
	k=0;

	for (i = 0; i <=line_count; i++){
		//Draw the triangles
		XDrawLine(display, win, green_gc, m[i][0], m[i][1], m[i][2], m[i][3]);
		XDrawLine(display, win, green_gc, m[i][2], m[i][3], m[i][4], m[i][5]);
		XDrawLine(display, win, green_gc, m[i][4], m[i][5], m[i][0], m[i][1]);
	}
}
コード例 #3
0
ファイル: erase.c プロジェクト: RazZziel/pongclock
static void
three_circle_wipe (eraser_state *st)
{
  int rad = (st->width > st->height ? st->width : st->height);
  int max = 360 * 64;
  int th, oth;
  int i;

  if (st->ratio == 0.0)
    st->start = random() % max;

  th  = max/6 * st->ratio;
  oth = max/6 * st->prev_ratio;

  for (i = 0; i < 3; i++)
    {
      int off = i * max / 3;
      XFillArc (st->dpy, st->window, st->bg_gc,
                (st->width  / 2) - rad,
                (st->height / 2) - rad, 
                rad*2, rad*2,
                (st->start + off + oth) % max,
                th-oth);
      XFillArc (st->dpy, st->window, st->bg_gc,
                (st->width  / 2) - rad,
                (st->height / 2) - rad, 
                rad*2, rad*2,
                (st->start + off - oth) % max,
                oth-th);
    }
}
コード例 #4
0
ファイル: boxfit.c プロジェクト: mmarseglia/xscreensaver
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);
        }
    }
}
コード例 #5
0
ファイル: graphics.c プロジェクト: permalost/school-cs357
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);
}
コード例 #6
0
void HelloWorld::_drawO(const GC& gc, int x, int y, int w, int h) {
    XSetBackground(_display, gc, _whiteColor);
    XSetForeground(_display, gc, _blackColor);
    XFillArc(_display, _window, gc, x + w/10, y + h/10, (w*4)/5, (h*4)/5, 0,
            360*64);

    XSetForeground(_display, gc, _whiteColor);
    XFillArc(_display, _window, gc, x + w/5, y + h/5, (w*3)/5, (h*3)/5, 0,
            360*64);
}
コード例 #7
0
ファイル: Disp.c プロジェクト: yabuki/xfireworks
int Disp_DrawFilledCircle(Disp disp, GC gc, int x, int y, int r)
{
  if (x + r < 0 || disp->width  - 1 < x - r ||
      y + r < 0 || disp->height - 1 < y - r) return (0);
  if (disp->direct_draw)
    XFillArc(disp->display, disp->root_window, gc,
	     x - r, y - r, r * 2 + 1, r * 2 + 1, 0, 360 * 64);
  else
    XFillArc(disp->display, disp->pixmap, gc,
	     x - r, y - r, r * 2 + 1, r * 2 + 1, 0, 360 * 64);
  return (0);
}
コード例 #8
0
 void draw () {
   w->invert_colors ();
   XFillArc (w->display, w->win, w->gc,
             pos.x - outer, pos.y - outer,
             2*outer, 2*outer, 0, 365*64);
   w->default_colors ();
   XDrawArc (w->display, w->win, w->gc,
             pos.x - outer, pos.y - outer,
             2*outer, 2*outer, 0, 365*64);
   if (selected)
     XFillArc (w->display, w->win, w->gc,
               pos.x - inner, pos.y - inner,
               2*inner, 2*inner, 0, 365*64);
 }
コード例 #9
0
ファイル: rulerdemo.c プロジェクト: UlricE/Mowitz
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 ;
	}

}
コード例 #10
0
ファイル: eyes.c プロジェクト: Bluerise/bitrig-xenocara
static void
TFillArc(register Display * dpy, Drawable d, GC gc, Transform * t, double x, double y, double width, double height, int angle1, int angle2, XRectangle * rect)
{
	int         xx, xy, xw, xh;

	xx = Xx(x, y, t);
	xy = Xy(x, y, t);
	xw = Xwidth(width, height, t);
	xh = Xheight(width, height, t);
	if (xw < 0) {
		xx += xw;
		xw = -xw;
	}
	if (xh < 0) {
		xy += xh;
		xh = -xh;
	}
	XFillArc(dpy, d, gc, xx, xy, xw, xh, angle1, angle2);

	if (rect != NULL) {
		rect->x = xx;
		rect->y = xy;
		rect->width = xw;
		rect->height = xh;
	}
}
コード例 #11
0
ファイル: tela.c プロジェクト: joao-lima/elc1067-2014-2
void tela_circulo(tela_t* tela, circulo_t c)
{
    /* preenche o circulo r na tela com a cor padrao */
    XFillArc(tela->display, tela->pixmap, tela->gc, 
                   XU2X(c.centro.x - c.raio), YU2X(c.centro.y - c.raio), 
                   XU2X(2*c.raio), YU2X(2*c.raio), 0, 360*64);
}
コード例 #12
0
ファイル: eyes.c プロジェクト: Bluerise/bitrig-xenocara
static void
paint_fly(ModeInfo * mi, Fly * f)
{
	EyeScrInfo *ep = &eye_info[MI_SCREEN(mi)];
	Display    *display = MI_DISPLAY(mi);
	Window      window = MI_WINDOW(mi);
	int         x = f->x, y = f->y;

	if (MI_IS_ICONIC(mi)) {
		/* don't need to unpaint when iconic
		 * ep->flyGC has stipple set, don't use when iconic
		 */
		XSetForeground(display, MI_GC(mi), f->pixel);
		XFillArc(display, window, MI_GC(mi), x, y,
			 f->width, f->height, 90 * 64, 360 * 64);
	} else {
		unpaint_fly(mi, f);
		XSetForeground(display, ep->flyGC, f->pixel);
#ifdef XBM_GRELB
		if (ep->fly2pix != None) {
			XSetStipple(display, ep->flyGC, (f->vy <= 0) ? ep->flypix : ep->fly2pix);
		} else
#endif
			XSetStipple(display, ep->flyGC, ep->flypix);
		XSetTSOrigin(display, ep->flyGC, x, y);
#ifdef FLASH
		XSetFillStyle(display, ep->flyGC, FillStippled);
#else
		XSetFillStyle(display, ep->flyGC, FillOpaqueStippled);
#endif
		XFillRectangle(display, window, ep->flyGC,
			       x, y, f->width, f->height);
		XFlush(display);
	}
}
コード例 #13
0
ファイル: erase.c プロジェクト: RazZziel/pongclock
static void
circle_wipe (eraser_state *st)
{
  int rad = (st->width > st->height ? st->width : st->height);
  int max = 360 * 64;
  int th, oth;

  if (st->ratio == 0.0)
    {
      st->flip_p = random() & 1;
      st->start = random() % max;
    }

  th  = max * st->ratio;
  oth = max * st->prev_ratio;
  if (st->flip_p)
    {
      th  = max - th;
      oth = max - oth;
    }
  XFillArc (st->dpy, st->window, st->bg_gc,
            (st->width  / 2) - rad,
            (st->height / 2) - rad, 
            rad*2, rad*2,
            (st->start + oth) % max,
            th-oth);
}
コード例 #14
0
ファイル: gcmethods.c プロジェクト: sk1project/skencil
static PyObject *
PaxGC_FillArc(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;
XFillArc(self->display, self->drawable, self->gc,
			arg1,
			arg2,
			arg3,
			arg4,
			arg5,
			arg6);
	Py_INCREF(Py_None);
	return Py_None;
}
コード例 #15
0
ファイル: Simple.c プロジェクト: fjardon/motif
/******************************************************************************
 *
 *  DrawVisual:
 *     Called by ExmSimple whenever it needs to draw or redraw the
 *     widget visual (either an oval or a rectangle).
 *
 *****************************************************************************/
static void 
DrawVisual (
        Widget w
           )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(w);
 ExmSimpleWidget sw = (ExmSimpleWidget)w;

 /* Draw the oval or the rectangle, space permitting. */
   if (sw->simple.visual.width > 0 && sw->simple.visual.height > 0) {
     switch (sw->simple.simple_shape) {
	    case(ExmSHAPE_OVAL):
	    default:
		XFillArc (XtDisplay(w), XtWindow(w),
			  wc->simple_class.select_gc(w),
			  sw->simple.visual.x, sw->simple.visual.y,
			  sw->simple.visual.width, sw->simple.visual.height,
			  0, 360 * 64);
		break;
	    case(ExmSHAPE_RECTANGLE):
		XFillRectangle (XtDisplay(w), XtWindow(w),
                          wc->simple_class.select_gc(w),
                          sw->simple.visual.x, sw->simple.visual.y,
                          sw->simple.visual.width, sw->simple.visual.height);
		break;
     }
   }
}
コード例 #16
0
static void DrawFilledCircle ( Window w, GC gc, int x, int y, int x2, int y2 )
{
    FixDataOrdering ( &x, &y, &x2, &y2 );

    XFillArc ( display,  w, gc, x, y,
               x2 - x, y2 - y, 0, 64 * 360 );
}
コード例 #17
0
ファイル: drawx.c プロジェクト: herrsergio/bee_src
void EZX_FillCircle(EZXW_p w, int x, int y, int r)
{
    int  r2 = (int) (r  /* / 1.41421356 */ + 0.5); /*(st) */
    unsigned int wh = 2 * r2;

    XFillArc( theDisplay, w->w, theGC, x - r2, y - r2, wh, wh, 0, 360*64);
}
コード例 #18
0
ファイル: psdriver.c プロジェクト: PNCG/genesis
void
XPSFillArc(Display *display, Drawable drawable, GC context,
           int x, int y, int w, int h, int angle1, int angle2)
{
    if (output_flag == XOUT)
    {
        XFillArc(display, drawable, context, x, y, w, h, angle1, angle2);
    }
    else
    {
        XGCValues values;

        XGetGCValues(display, context, GCForeground | GCLineWidth
                     | GCArcMode, &values);
        PSNewpath();
        PSSetPixel(display, values.foreground);
        PSSetLineWidth(values.line_width);

        if (values.arc_mode == ArcPieSlice)
            PSMoveto(x + w / 2, y + h / 2);

        PSArc(x + w / 2.0, y + h / 2.0, w / 2.0, angle1 / 64.0,
              angle2 / 64.0);
        PSClosefill();
    }
}
コード例 #19
0
ファイル: puff_c.c プロジェクト: trayres/PUFF
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++;
}
コード例 #20
0
ファイル: gui_x11.cpp プロジェクト: axet/xinput_calibrator
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);
}
コード例 #21
0
void dijsktra(int source,int target)
{
    int dist[302], prev[302], finished[302], path[302];
    int next, x1, y1, x2, y2, min, start, i, d;
    int no_of_path = 0;
    for(i=0;i<pixel_count;i++)
    {
        dist[i] = 9999;
        prev[i] = -1;
        finished[i]=0;
    }
    start = source;
    finished[start]=1;
    dist[start] = 0;
    while(finished[target] ==0)
    {
      min = 9999;
      next = 0;
      for(i=0;i < pixel_count;i++)
      {
          d = dist[start] + cost[start][i];
          if(d < dist[i] && finished[i]==0)
          {
              dist[i] = d;
              prev[i] = start;
          }
          if(min > dist[i] && finished[i]==0)
          {
              min = dist[i];
              next = i;
          }
      }
      start = next;
      finished[start] = 1;
    }
    start = target;
    while(start != -1)
    {
        path[no_of_path] = start;    
        no_of_path++;    
        start = prev[start];
    }
    printf("Distance : %d\n" , dist[target]);
    for(i=0;i<no_of_path-1;i++)
    {
      x1 = get_x(path[i]);
      y1 = get_y(path[i]);
      x2 = get_x(path[i+1]);
      y2 = get_y(path[i+1]);
      XDrawLine(display_ptr, win, gc_white, x1, y1, x2, y2);
      XDrawLine(display_ptr, win, gc_blue, x1, y1, x2, y2);
    }
    for(i=1;i<no_of_path-1;i++)
    {
      x1 = get_x(path[i]);
      y1 = get_y(path[i]);
      XFillArc( display_ptr, win, gc_red, x1- win_height/200, y1 - win_height/200, win_height/100, win_height/100, 0, 360*64);
    }
}
コード例 #22
0
ファイル: Catcher.cpp プロジェクト: aimango/xshooter
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);
}
コード例 #23
0
ファイル: xlib.c プロジェクト: Tarek-Samy/zahnrad
static void
surface_draw_circle(XSurface *surf, zr_short x, zr_short y, zr_ushort w,
    zr_ushort h, struct zr_color col)
{
    unsigned long c = color_from_byte(&col.r);
    XSetForeground(surf->dpy, surf->gc, c);
    XFillArc(surf->dpy, surf->drawable, surf->gc, (int)x, (int)y,
        (unsigned)w, (unsigned)h, 0, 360 * 64);
}
コード例 #24
0
ファイル: XSpadFill.c プロジェクト: acralfs/fricas
void
XSpadFillArc(Display *dsply, Drawable drawable, int x, int y,
             unsigned int width, unsigned int height,
             int angle1, int angle2, int hue, int  theshade)
{

    XFillArc(dsply, drawable,
                    SpadFillGC(dsply, hue, theshade, "XSpadFillRectangle"),
                    x, y, width, height, angle1, angle2);
}
コード例 #25
0
ファイル: shapes.c プロジェクト: mame98/neoui
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);
}
コード例 #26
0
void xdot ( int *ix, int *iy, int *ilwid, int *iret )
/************************************************************************
 * xdot									*
 *									*
 * This subroutine draws circles.  It is used to draw round dots in an	*
 * X window.								*
 *									*
 * xdot ( ix, iy, ilwid, iret )						*
 *									*
 * Input parameters:							*
 *	*ix		int		X coordinate			*
 *	*iy		int		Y coordinate			*
 *	*ilwid		int		Current line width		*
 *									*
 * Output parameters:							*
 *	*iret		int		Return code			*
 *              			G_NORMAL = normal return.       *
 **									*
 * Log:									*
 * J. Whistler/SSAI	 7/91	C call for XW device driver		*
 * M. desJardins/NMC	12/91	xfcirc --> xcirc; center circle		*
 * S. Jacobs/NMC	 7/94	General clean up			*
 * C. Lin/EAI	         7/94	multi-window, multi-pixmap		*
 * A. Hardy/GSC		11/98   Renamed xcirc to xdot                   *
 * E. Safford/GSC	12/99	update for new xwcmn.h			*
 * S. Law/GSC		01/00	changed curpxm to an array		*
 * S. Law/GSC		08/00	removed nmap vs nmap2 references	*
 ***********************************************************************/
{
    int		ixnew, iynew, ipxm, lp;
    Window_str	*cwin;
    GC		gemgc;
    /*---------------------------------------------------------------------*/

    *iret = G_NORMAL;
    cwin = &(gemwindow[current_window]);

    /*
     * Transform x and y to the upper left corner of bounding
     * rectangle.
     */
    ixnew = *ix - *ilwid / 2;
    iynew = *iy - *ilwid / 2;

    /*
     * Fill in entire circle.  Note that start and end angles of
     * arc are in 64ths of degrees.
     */
    ipxm  = gemwindow[current_window].curpxm[cwin->curr_loop];
    gemgc = gemwindow[current_window].gc;

    lp = cwin->curr_loop;
    XFillArc (gemdisplay, cwin->pxms[lp][ipxm], gemgc,
              ixnew, iynew, *ilwid, *ilwid, 0, 360*64);
}
コード例 #27
0
ファイル: wio.c プロジェクト: dogrizz/wilk-i-owca
void rysujPionek(pion pionek) {
  if(pionek.typ != ' '){
    if(pionek.typ == OWCA) {
      XSetForeground(mydisplay,mygc,white.pixel);
    } else {
      XSetForeground(mydisplay,mygc,black.pixel);
    }
    //zeby zgadzal sie obraz wyswietlany z planszą trzeba zamienic x y.
    XFillArc(mydisplay,mywindow,mygc,5+pionek.y*50,5+pionek.x*50,40,40,0,360*64);
  }
}
コード例 #28
0
ファイル: XShade.c プロジェクト: EmmanuelCharpentier/fricas
void
XShadeArc(Display *display, Drawable drawable, int x, int y,
          unsigned int width, unsigned int height, int angle1, int angle2)
{
    if (!INIT) {
        fprintf(stderr, "XShade Error: Tried to fill before INIT called\n");
        exit(-1);
    }
    XFillArc(display, drawable, TileGC, x, y, width,
                    height, angle1, angle2);
}
コード例 #29
0
ファイル: whirlygig.c プロジェクト: MaddTheSane/xscreensaver
static void
smoothen(struct state *st, int x, int lastx, int y, int lasty, int size, int last_color, XColor *colors, Display *dpy, Window window, GC bgc, int screen, struct info *info)
{
    double xdistance = abs((double)x-(double)lastx);
    double ydistance = abs((double)y-(double)lasty);
    double distance = sqrt(((xdistance * xdistance) + (ydistance * ydistance)) );
    double slope = (((double)y-(double)lasty) / ((double)x-(double)lastx));
    printf("Starting smoothen with values: %f, %f, %f, %f\n", xdistance, ydistance, distance, slope);
    if (distance > 2.0) {
        int newx = (int)((xdistance / distance) * slope);
        int newy = (int)((ydistance / distance) * slope);
        if (! st->info->trail) {
            XSetForeground(st->dpy, st->bgc, BlackPixel(st->dpy, st->screen));
            XFillArc(st->dpy, st->window, st->bgc, lastx, lasty, size, size, START_ARC, END_ARC);
        }
        XSetForeground(st->dpy, st->bgc, st->colors[last_color].pixel);
        XFillArc(st->dpy, st->window, st->bgc, newx, newy, size, size, START_ARC, END_ARC);
        smoothen(st, newx, x, newy, y, size, last_color, st->colors, st->dpy, st->window, st->bgc, st->screen, st->info);
    }
}
コード例 #30
0
ファイル: HGraf.c プロジェクト: nlphacker/OpenSpeech
/* EXPORT-> HFillArc: Draw filled arc from stAngle thru arcAngle degrees */
void HFillArc(int x0,int y0,int x1,int y1,int stAngle,int arcAngle)
{
   unsigned int rw, rh;
   
   CheckCorners(&x0,&y0,&x1,&y1);
   /* calculate width and height */
   rw = abs(x1 - x0); rh = abs(y1 - y0);
   /* the angles are signed integers in 64ths of a degree */
   stAngle *=64; arcAngle*=64;
   XFillArc(theDisp, theWindow, theGC, x0, y0, rw, rh, stAngle, arcAngle);
}