Esempio n. 1
0
void
do_draw_option_shadow(GdkWindow * window,
	       GdkRectangle * area,
               GdkGC * tl_gc,
               GdkGC * br_gc,
	       gint x,
	       gint y,
	       gint width,
	       gint height)
{
  if (area)
    {
      gdk_gc_set_clip_rectangle(tl_gc, area);
      gdk_gc_set_clip_rectangle(br_gc, area);
    }

  gdk_draw_arc(window, tl_gc, FALSE, x, y, width, height, 45 * 64, 225 * 64);
  gdk_draw_arc(window, br_gc, FALSE, x, y, width, height, 225 * 64, 180 * 64);

  if (area)
    {
      gdk_gc_set_clip_rectangle(tl_gc, NULL);
      gdk_gc_set_clip_rectangle(br_gc, NULL);
    }
}
Esempio n. 2
0
int GCarc(Gwidget_t * widget, Gpoint_t gc, Gsize_t gs, double ang1,
	  double ang2, Ggattr_t * ap)
{

    PIXpoint_t pc;
    PIXsize_t ps;
    Grect_t gr;

    gr.o.x = gc.x - gs.x, gr.o.y = gc.y - gs.y;
    gr.c.x = gc.x + gs.x, gr.c.y = gc.y + gs.y;
/*	if(!ISVISIBLE(gr))
		return 1;
*/

    pc = pdrawtopix(widget, gc), ps = sdrawtopix(widget, gs);
    setgattr(widget, ap);

    if (WCU->gattr.fill) {
	gdk_draw_arc(widget->w->window, GC, TRUE, pc.x - ps.x, pc.y - ps.y,
		     ps.x * 2, ps.y * 2, (int) (ang1 * 64), (ang2 * 64));
    } else {
	gdk_draw_arc(widget->w->window, GC, FALSE, pc.x - ps.x,
		     pc.y - ps.y, ps.x * 2, ps.y * 2, (int) (ang1 * 64),
		     (ang2 * 64));
    }
    return 0;
}
Esempio n. 3
0
GdkBitmap *
arc_clip_mask(gint width,
	      gint height)
{
  GdkBitmap *result;
  GdkGC *gc;
  GdkColor color;

  result = (GdkBitmap *)gdk_pixmap_new(NULL, width, height, 1);
  gc = gdk_gc_new(result);
	
  color.pixel = 0;
  gdk_gc_set_foreground(gc, &color);

  gdk_draw_rectangle(result, gc, TRUE, 0, 0, width, height);
  gdk_draw_rectangle(result, gc, FALSE, 0, 0, width, height);

  color.pixel = 1;
  gdk_gc_set_foreground(gc, &color);

  gdk_draw_arc(result, gc, TRUE, 0, 0, width, height, 0, 360*64);
  gdk_draw_arc(result, gc, FALSE, 0, 0, width, height, 0, 360*64);

  gdk_gc_destroy(gc);

  return result;
}
static void
draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
{
	if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
		gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
	if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
		gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
}
Esempio n. 5
0
void UI_buildui(IBusHandwriteEngine * engine)
{
	GdkPixmap * pxmp;
	GdkGC * gc;
	GdkColor black, white;

	GdkColormap* colormap = gdk_colormap_get_system();

	gdk_color_black(colormap, &black);
	gdk_color_white(colormap, &white);

	g_object_unref(colormap);

	int R = 5;

	if (!engine->drawpanel)
	//建立绘图窗口, 建立空点
	{
		engine->drawpanel = gtk_window_new(GTK_WINDOW_POPUP);
		gtk_window_move((GtkWindow*) engine->drawpanel, 500, 550);
		gtk_widget_add_events(GTK_WIDGET(engine->drawpanel),
				GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK
						| GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK);
		g_signal_connect_after(G_OBJECT(engine->drawpanel),"motion_notify_event",G_CALLBACK(on_mouse_move),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"expose-event",G_CALLBACK(paint_ui),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"button-release-event",G_CALLBACK(on_button),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"button-press-event",G_CALLBACK(on_button),engine);

		gtk_window_resize(GTK_WINDOW(engine->drawpanel), 200, 250);

		gtk_widget_show(engine->drawpanel);

		pxmp = gdk_pixmap_new(NULL, 200, 250, 1);
		gc = gdk_gc_new(GDK_DRAWABLE(pxmp));

		gdk_gc_set_foreground(gc, &black);

		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, 200, 250);

		gdk_gc_set_foreground(gc, &white);

		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, R*2, R*2, 0, 360 * 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 0, R*2, R*2, 0, 360
				* 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 250 - R*2, R*2, R*2, 0,
				360 * 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 250 - R*2, R*2, R*2, 0, 360
				* 64);
		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, R, 200, 250 - R*2);
		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, R, 0, 200 - R*2, 250);
		gdk_window_shape_combine_mask(engine->drawpanel->window, pxmp, 0, 0);
		g_object_unref(gc);
		g_object_unref(pxmp);
		gtk_window_set_opacity(GTK_WINDOW(engine->drawpanel), 0.62);
		//	engine->GdkPoints = NULL;
	}
	//	gtk_widget_show_all(engine->drawpanel);
}
Esempio n. 6
0
static gint user_install_corner_expose(GtkWidget      *widget,
                                       GdkEventExpose *eevent,
                                       gpointer        data)
{
  switch ((GtkCornerType)data)
  {
    case GTK_CORNER_TOP_LEFT:
      gdk_draw_arc(widget->window,
                   white_gc,
                   TRUE,
                   0, 0,
                   widget->allocation.width * 2,
                   widget->allocation.height * 2,
                   90 * 64,
                   180 * 64);
      break;

    case GTK_CORNER_BOTTOM_LEFT:
      gdk_draw_arc(widget->window,
                   white_gc,
                   TRUE,
                   0, -widget->allocation.height,
                   widget->allocation.width * 2,
                   widget->allocation.height * 2,
                   180 * 64,
                   270 * 64);
      break;

    case GTK_CORNER_TOP_RIGHT:
      gdk_draw_arc(widget->window,
                   white_gc, TRUE,
                   -widget->allocation.width, 0,
                   widget->allocation.width * 2,
                   widget->allocation.height * 2,
                   0 * 64,
                   90 * 64);
      break;

    case GTK_CORNER_BOTTOM_RIGHT:
      gdk_draw_arc(widget->window,
                   white_gc, TRUE,
                   -widget->allocation.width, -widget->allocation.height,
                   widget->allocation.width * 2,
                   widget->allocation.height * 2,
                   270 * 64,
                   360 * 64);
      break;

    default:
      return FALSE;
  }

  return TRUE;
}
Esempio n. 7
0
File: 3dtest.c Progetto: adius/FeetJ
gboolean Update(gpointer data)
{
	int c,x,y,cx,cy;
	GtkWidget *dc=GetWidget("drawingarea1");
	GdkGC *gc=dc->style->fg_gc[GTK_WIDGET_STATE(dc)];
	GdkGCValues gcsave;

	gdk_gc_get_values(gc,&gcsave);

	cx=dc->allocation.width/2;
	cy=dc->allocation.height/2;

	{ // clear the display
		GdkColor c={0,0xffff,0xffff,0xffff};
		gdk_gc_set_rgb_fg_color(gc,&c);
		gdk_draw_rectangle(dc->window,gc,TRUE,0,0,dc->allocation.width,dc->allocation.height);
	}

	{ // Draw the listener
		GdkColor c={0,0x8000,0x8000,0x8000};
		gdk_gc_set_rgb_fg_color(gc,&c);
		gdk_draw_arc(dc->window,gc,TRUE,cx-4,cy-4,8,8,0,360*64);
	}

	for (c=0;c<chanc;c++) {
		// If the channel's playing then update it's position
		if (BASS_ChannelIsActive(chans[c].channel)==BASS_ACTIVE_PLAYING) {
			// Check if channel has reached the max distance
			if (chans[c].pos.z>=MAXDIST || chans[c].pos.z<=-MAXDIST)
				chans[c].vel.z=-chans[c].vel.z;
			if (chans[c].pos.x>=MAXDIST || chans[c].pos.x<=-MAXDIST)
				chans[c].vel.x=-chans[c].vel.x;
			// Update channel position
			chans[c].pos.z+=chans[c].vel.z*TIMERPERIOD/1000;
			chans[c].pos.x+=chans[c].vel.x*TIMERPERIOD/1000;
			BASS_ChannelSet3DPosition(chans[c].channel,&chans[c].pos,NULL,&chans[c].vel);
		}
		{ // Draw the channel position indicator
			static GdkColor cols[2]={{0,0xffff,0xc000,0xc000},{0,0xffff,0,0}};
			gdk_gc_set_rgb_fg_color(gc,&cols[chan==c]);
			x=cx+(int)((cx-10)*chans[c].pos.x/MAXDIST);
			y=cy-(int)((cy-10)*chans[c].pos.z/MAXDIST);
			gdk_draw_arc(dc->window,gc,TRUE,x-4,y-4,8,8,0,360*64);
		}
	}
	// Apply the 3D changes
	BASS_Apply3D();

	gdk_gc_set_values(gc,&gcsave,GDK_GC_FOREGROUND);

	return TRUE;
}
Esempio n. 8
0
static void set_foreground(GdkColor *color, int status)
{
    int i, num;
    GdkPoint *p;
    int num_app_shells = get_num_shells();
    GdkGC *app_gc = get_toplevel();

    num = numpoints[status];
    p = polyptr[status];

    if (num) {
        gdk_gc_set_rgb_fg_color(app_gc, color);
        for (i = 0; i < num_app_shells; i++) {
            tape_status_widget *ts = &app_shells[i].tape_status;
            if (ts) {
                gdk_draw_polygon(ts->control_pixmap, app_gc, TRUE, p, num);
                gtk_widget_queue_draw(ts->control);
            }
        }
    } else {
        gdk_gc_set_rgb_fg_color(app_gc, &drive_led_on_red_pixel);
        for (i = 0; i < num_app_shells; i++) {
            tape_status_widget *ts = &app_shells[i].tape_status;
            if (ts) {
                gdk_draw_arc(ts->control_pixmap, app_gc, TRUE, 3, 1, CTRL_WIDTH - 6, CTRL_HEIGHT - 2, 0, 360 * 64);
                gtk_widget_queue_draw(ts->control);
            }
        }
    }
}
Esempio n. 9
0
File: main.c Progetto: bobbens/cwiid
void drawIR_expose_event(void)
{
	int i;
	int size;
	gint width, height;

	gdk_window_get_geometry(drawIR->window, NULL, NULL, &width, &height, NULL);

	for (i=0; i < CWIID_IR_SRC_COUNT; i++) {
		if (ir_data.src[i].valid) {
			if (ir_data.src[i].size == -1) {
				size = 3;
			}
			else {
				size = ir_data.src[i].size+1;
			}
			gdk_draw_arc(drawIR->window,
			             drawIR->style->fg_gc[GTK_WIDGET_STATE(drawIR)],
			             TRUE,
						 ir_data.src[i].pos[CWIID_X] * width / CWIID_IR_X_MAX,
						 height - ir_data.src[i].pos[CWIID_Y] * height /
			                      CWIID_IR_Y_MAX,
						 size, size,
						 0, 64 * 360);
		}
	}
}
Esempio n. 10
0
void bez_spot_draw	(BezSpot *s,GdkWindow *window, GdkGC *gc, double radius)
{
	
	Point *p=s->point;
	gc_set_rgb_fg (gc, 0x000000);
	gdk_draw_arc(window,gc,FALSE,p->x-radius,p->y-radius,p->x+radius,p->y+radius,64,360*64);
}
Esempio n. 11
0
void SDC::DrawCircle(int x, int y, int r) {
#ifdef __WXGTK__
	gdk_draw_arc(m_gdkbmp, m_gc, FALSE, x - r, y - r, 2 * r, 2 * r, 0, 360 * 64);
#else
	Select();
	Ellipse(m_gc, x - r, y - r, x + r, y + r);
#endif
}
Esempio n. 12
0
static void DrawCircle( GdkDrawable *drawable, GdkGC* gc, bool filled,
                        const GdkPoint& center, int radius,
                        const GdkColor& color )
{
  gdk_gc_set_rgb_fg_color( gc, &color );
  gdk_draw_arc( drawable, gc, filled, center.x-radius, center.y-radius,
                2*radius, 2*radius, 0, 64*360 );
}
Esempio n. 13
0
static void Dw_bullet_draw (DwWidget *widget,
                            DwRectangle *area,
                            GdkEventExpose *event)
{
   gint32 x0, y0, x, y;
   GdkGC *gc;
   DwStyleColor *bg_color;
   GdkWindow *window;
   gint32 l;
   int i;
   gboolean selected = FALSE;

   for (i = 0; i < DW_HIGHLIGHT_NUM_LAYERS && !selected; i++)
      selected = DW_BULLET(widget)->selected[i];

   l = MIN (widget->allocation.width, widget->allocation.ascent);
   x = x0 = p_Dw_widget_x_world_to_viewport (widget, widget->allocation.x);
   y0 = p_Dw_widget_y_world_to_viewport (widget, widget->allocation.y);
   y = y0 + widget->allocation.ascent - widget->style->font->x_height;
   gc = selected ? widget->style->color->inverse_gc :
      widget->style->color->gc;
   window = DW_WIDGET_WINDOW (widget);

   if (selected) {
      bg_color = p_Dw_widget_get_bg_color (widget);
      gdk_draw_rectangle (window, bg_color->inverse_gc,
                          TRUE, x0, y0,
                          widget->allocation.width,
                          DW_WIDGET_HEIGHT(widget));
   }

   switch (widget->style->list_style_type) {
   case DW_STYLE_LIST_STYLE_TYPE_DISC:
      gdk_draw_arc (window, gc, TRUE, x, y, l, l, 0, 360 * 64);
      break;
   case DW_STYLE_LIST_STYLE_TYPE_CIRCLE:
      gdk_draw_arc (window, gc, FALSE, x, y, l, l, 0, 360 * 64);
      break;
   case DW_STYLE_LIST_STYLE_TYPE_SQUARE:
      gdk_draw_rectangle (window, gc, FALSE, x, y, l, l);
      break;
   default:
      break;
   }
}
Esempio n. 14
0
void drawTest(Ihandle *ih, int posx)
{
  GtkWidget* widget = (GtkWidget*)IupGetAttribute(ih, "WID");
  gdk_draw_arc (widget->window,
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                TRUE,
                0, 0, widget->allocation.width, widget->allocation.height,
                0, 64 * 360);
}
Esempio n. 15
0
static VALUE
rg_draw_arc(VALUE self, VALUE gc, VALUE filled, VALUE x, VALUE y, VALUE w, VALUE h, VALUE a1, VALUE a2)
{
    gdk_draw_arc(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
                 RVAL2CBOOL(filled),
                 NUM2INT(x), NUM2INT(y),
                 NUM2INT(w), NUM2INT(h),
                 NUM2INT(a1), NUM2INT(a2));
    return self;
}
Esempio n. 16
0
void DrawColorFilledEllipse (GdkGC * gc, double x, double y, double sizeX, double sizeY)
{
    x = (x + shift_X) * zoom;
    y = (y + shift_Y[0]) * zoom;
    sizeX *= zoom;
    sizeY *= zoom;

    if (sizeX < 1000000 && sizeY < 1000000 && x < 1000000 && y < 1000000 && x > -1000000 && y > -1000000)
        gdk_draw_arc (pixmap, gc, TRUE, x - sizeX, y - sizeY, 2 * sizeX, 2 * sizeY, 0, 360 * 64);
}
Esempio n. 17
0
// Méthodes de remplissage (ellipse, rectangle) 
void Fenetre::remplitEllipse(int x, int y, int large, int haut) { // ellipse pleine
    if (existe) {
       gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo);
       gdk_draw_arc(dessin,
    		      fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)], TRUE,
                  x,y,large,haut,0,360*64); 
       gtk_widget_queue_draw(fenetre); // provoquer l'affichage
       traiteEvenements();
       }
}
Esempio n. 18
0
/*!
  Display a circle.
  \param center : Circle center position.
  \param radius : Circle radius.
  \param color : Circle color.
  \param fill : When set to true fill the circle.
  \param thickness : Thickness of the circle. This parameter is only useful 
  when \e fill is set to false.
*/
void vpDisplayGTK::displayCircle ( const vpImagePoint &center,
				   unsigned int radius,
				   const vpColor &color,
				   bool fill,
				   unsigned int thickness )
{
  if (displayHasBeenInitialized)
  {
    if ( thickness == 1 ) thickness = 0;

    if (color.id < vpColor::id_unknown)
      gdk_gc_set_foreground(gc, col[color.id]);
    else {
      gdkcolor.red   = 256 * color.R;
      gdkcolor.green = 256 * color.G;
      gdkcolor.blue  = 256 * color.B;
      gdk_colormap_alloc_color(colormap,&gdkcolor,FALSE,TRUE);
      gdk_gc_set_foreground(gc, &gdkcolor);     
    }

    gdk_gc_set_line_attributes(gc, (gint)thickness,
			       GDK_LINE_SOLID, GDK_CAP_BUTT,
			       GDK_JOIN_BEVEL) ;

    if (fill == false)
      gdk_draw_arc(background, gc, FALSE,
		   vpMath::round( center.get_u()-radius ), 
		   vpMath::round( center.get_v()-radius ),
		   (gint)(2*radius), (gint)(2*radius), 23040, 23040) ; /* 23040 = 360*64 */
    else
      gdk_draw_arc(background, gc, TRUE,
		   vpMath::round( center.get_u()-radius ), 
		   vpMath::round( center.get_v()-radius ),
		   (gint)(2*radius), (gint)(2*radius), 23040, 23040) ; /* 23040 = 360*64 */
  }
  else
  {
    vpERROR_TRACE("GTK not initialized " ) ;
    throw(vpDisplayException(vpDisplayException::notInitializedError,
                             "GTK not initialized")) ;
  }
}
Esempio n. 19
0
File: panel.c Progetto: g7/fbpanel
static void
make_round_corners(panel *p)
{
    GdkBitmap *b;
    GdkGC* gc;
    GdkColor black = { 0, 0, 0, 0};
    GdkColor white = { 1, 0xffff, 0xffff, 0xffff};
    int w, h, r, br;

    ENTER;
    w = p->aw;
    h = p->ah;
    r = p->round_corners_radius;
    if (2*r > MIN(w, h)) {
        r = MIN(w, h) / 2;
        DBG("chaning radius to %d\n", r);
    }
    if (r < 4) {
        DBG("radius too small\n");
        RET();
    }
    b = gdk_pixmap_new(NULL, w, h, 1);
    gc = gdk_gc_new(GDK_DRAWABLE(b));
    gdk_gc_set_foreground(gc, &black);
    gdk_draw_rectangle(GDK_DRAWABLE(b), gc, TRUE, 0, 0, w, h);
    gdk_gc_set_foreground(gc, &white);
    gdk_draw_rectangle(GDK_DRAWABLE(b), gc, TRUE, r, 0, w-2*r, h);
    gdk_draw_rectangle(GDK_DRAWABLE(b), gc, TRUE, 0, r, r, h-2*r);
    gdk_draw_rectangle(GDK_DRAWABLE(b), gc, TRUE, w-r, r, r, h-2*r);

    br = 2 * r;
    gdk_draw_arc(GDK_DRAWABLE(b), gc, TRUE, 0, 0, br, br, 0*64, 360*64);
    gdk_draw_arc(GDK_DRAWABLE(b), gc, TRUE, 0, h-br-1, br, br, 0*64, 360*64);
    gdk_draw_arc(GDK_DRAWABLE(b), gc, TRUE, w-br, 0, br, br, 0*64, 360*64);
    gdk_draw_arc(GDK_DRAWABLE(b), gc, TRUE, w-br, h-br-1, br, br, 0*64, 360*64);

    gtk_widget_shape_combine_mask(p->topgwin, b, 0, 0);
    g_object_unref(gc);
    g_object_unref(b);

    RET();
}
Esempio n. 20
0
void iupdrvDrawArc(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)
{
  GdkColor color;
  iupgdkColorSet(&color, r, g, b);
  gdk_gc_set_rgb_fg_color(dc->pixmap_gc, &color);

  if (style!=IUP_DRAW_FILL)
    iDrawSetLineStyle(dc, style);

  gdk_draw_arc(dc->pixmap, dc->pixmap_gc, style == IUP_DRAW_FILL, x1, y1, x2 - x1 + 1, y2 - y1 + 1, iupRound(a1 * 64), iupRound((a2 - a1) * 64));
}
Esempio n. 21
0
static void
draw_light_marker (gint xpos,
		   gint ypos)
{
  GdkColor  color;

  color.red   = 0x0;
  color.green = 0x0;
  color.blue  = 0x0;
  gdk_gc_set_rgb_bg_color (gc, &color);

  color.red   = 0x0;
  color.green = 0x4000;
  color.blue  = 0xFFFF;
  gdk_gc_set_rgb_fg_color (gc, &color);

  gdk_gc_set_function (gc, GDK_COPY);

  if (mapvals.lightsource.type == POINT_LIGHT)
    {
      lightx = xpos;
      lighty = ypos;

      /* Save background */
      /* =============== */

      backbuf.x = lightx - 7;
      backbuf.y = lighty - 7;
      backbuf.w = 14;
      backbuf.h = 14;

      /* X doesn't like images that's outside a window, make sure */
      /* we get the backbuffer image from within the boundaries   */
      /* ======================================================== */

      if (backbuf.x < 0)
        backbuf.x = 0;
      else if ((backbuf.x + backbuf.w) > PREVIEW_WIDTH)
        backbuf.w = (PREVIEW_WIDTH - backbuf.x);
      if (backbuf.y < 0)
        backbuf.y = 0;
      else if ((backbuf.y + backbuf.h) > PREVIEW_HEIGHT)
        backbuf.h = (PREVIEW_WIDTH - backbuf.y);

      backbuf.image = gdk_drawable_get_image (previewarea->window,
                                              backbuf.x, backbuf.y,
                                              backbuf.w, backbuf.h);

      gdk_draw_arc (previewarea->window, gc,
		    TRUE,
		    lightx - 7, lighty - 7, 14, 14,
		    0, 360 * 64);
    }
}
Esempio n. 22
0
void Fenetre::traceArc(int x, int y, int large, int haut, int angle1, int angle2, int e) {
    if (existe) {
       gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo); // courbe
       choixEpaisseurTrace(e); // couleur et épaisseur du tracé
       gdk_draw_arc(dessin,
    		      fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)], FALSE,
                  x,y,large,haut,angle1*64,angle2*64); 
       gtk_widget_queue_draw(fenetre); // provoquer l'affichage
       traiteEvenements();
       }
}
Esempio n. 23
0
File: gui_util.c Progetto: bert/fped
void draw_arc(GdkDrawable *da, GdkGC *gc, int fill,
    int x, int y, int r, double a1, double a2)
{
	/*
	 * This adjustment handles two distinct cases:
	 * - if a1 == a2, we make sure we draw a full circle
	 * - the end angle a2 must always be greater than the start angle a1
	 */
	if (a2 <= a1)
		a2 += 360;
        gdk_draw_arc(da, gc, fill, x-r, y-r, 2*r, 2*r, a1*64, (a2-a1)*64);
}
Esempio n. 24
0
/*
 * Draws a circle _centered_ at x,y with diameter dia
 */
static void 
gerbv_gdk_draw_circle(GdkPixmap *pixmap, GdkGC *gc, 
		  gint filled, gint x, gint y, gint dia)
{
    static const gint full_circle = 23360;
    gint real_x = x - dia / 2;
    gint real_y = y - dia / 2;
    
    gdk_draw_arc(pixmap, gc, filled, real_x, real_y, dia, dia, 0, full_circle);
    
    return;
} /* gerbv_gdk_draw_circle */
Esempio n. 25
0
void
draw_place_name(int i, GdkPixmap *pixmap, GdkColor *draw_color)
{
  int pix_x1, pix_y1;

  pix_x1 = map_x_to_pix(place_list->places[i].x/map->config.resolution);
  pix_y1 = map_y_to_pix(place_list->places[i].y/map->config.resolution);

  gdk_gc_set_foreground (drawing_gc, draw_color);

  gdk_draw_arc(pixmap, drawing_gc, 1, pix_x1-5, pix_y1-5,
	       10, 10, 0, 360*64);

  gdk_gc_set_foreground (drawing_gc, &carmen_black);

  gdk_draw_arc(pixmap, drawing_gc, 0, pix_x1-5, pix_y1-5,
	       10, 10, 0, 360*64);

  gdk_gc_set_foreground (drawing_gc, &carmen_black);
  gdk_draw_string(pixmap, place_font, drawing_gc, pix_x1, pix_y1-5,
		  place_list->places[i].name);
}
Esempio n. 26
0
File: main.c Progetto: bobbens/cwiid
void drawStick_expose_event(GtkWidget *drawStick, GdkEventExpose *event,
                            struct stick *stick)
{
	gint width, height;

	(void)event;

	gdk_window_get_geometry(drawStick->window, NULL, NULL, &width, &height,
	                        NULL);
	gdk_draw_arc(drawStick->window,
	             drawStick->style->fg_gc[GTK_WIDGET_STATE(drawStick)],
				 FALSE,
				 0, 0, width-1, height-1, 0, 64*360);
	if (stick->valid) {
		gdk_draw_arc(drawStick->window,
		             drawStick->style->fg_gc[GTK_WIDGET_STATE(drawStick)],
		             TRUE,
		             (double)stick->x/stick->max*width - 2,
		             (1 - (double)stick->y/stick->max)*height - 2,
		             3, 3, 0, 64*360);
	}
}
Esempio n. 27
0
File: cdgdk.c Progetto: LuaDist/cd
static void cdsector(cdCtxCanvas *ctxcanvas, int xc, int yc, int w, int h, double a1, double a2)
{
  if (ctxcanvas->canvas->use_matrix ||
      ctxcanvas->canvas->new_region)
  {
    cdSimSector(ctxcanvas, xc, yc, w, h, a1, a2);
  }
  else
  {
    /* "filled parameter = TRUE" produces a 'pie slice' */
    gdk_draw_arc(ctxcanvas->wnd, ctxcanvas->gc, TRUE, xc-w/2, yc-h/2, w, h, cdRound(a1*64), cdRound((a2 - a1)*64));
  }
}
Esempio n. 28
0
static void
gtk_plot_gdk_draw_ellipse                            (GtkPlotPC *pc,
                                                     gint filled,
                                                     gdouble x, gdouble y,
                                                     gdouble width, gdouble height)
{
  if(!GTK_PLOT_GDK(pc)->gc) return;
  if(!GTK_PLOT_GDK(pc)->drawable) return;

  gdk_draw_arc (GTK_PLOT_GDK(pc)->drawable, GTK_PLOT_GDK(pc)->gc,
                filled,
                roundint(x), roundint(y),
                roundint(width), roundint(height), 0, 25000);
}
Esempio n. 29
0
void
rcm_draw_little_circle (GdkWindow *window,
			GdkGC     *color,
			gfloat     hue,
			gfloat     satur)
{
  gint x,y;

  x = GRAY_CENTER + GRAY_RADIUS * satur * cos(hue);
  y = GRAY_CENTER - GRAY_RADIUS * satur * sin(hue);

  gdk_draw_arc (window, color, 0, x-LITTLE_RADIUS, y-LITTLE_RADIUS,
                2*LITTLE_RADIUS, 2*LITTLE_RADIUS, 0, 360*64);
}
Esempio n. 30
0
File: cdgdk.c Progetto: LuaDist/cd
static void cdarc(cdCtxCanvas *ctxcanvas, int xc, int yc, int w, int h, double a1, double a2)
{
  if (ctxcanvas->canvas->use_matrix)
  {
    cdSimArc(ctxcanvas, xc, yc, w, h, a1, a2);
    return;
  }

  /* angles in 1/64ths of degrees counterclockwise, similar to CD */

  cdgdkCheckSolidStyle(ctxcanvas, 1);
  gdk_draw_arc(ctxcanvas->wnd, ctxcanvas->gc, FALSE, xc-w/2, yc-h/2, w, h, cdRound(a1*64), cdRound((a2 - a1)*64));
  cdgdkCheckSolidStyle(ctxcanvas, 0);
}