Exemple #1
0
static int
use_gc (hidGC gc)
{

    if (gc->me_pointer != &ghid_hid)
    {
        fprintf (stderr, "Fatal: GC from another HID passed to GTK HID\n");
        abort ();
    }

    if (!gport->pixmap)
        return 0;
    if (!gc->gc)
    {
        gc->gc = gdk_gc_new (gport->top_window->window);
        ghid_set_color (gc, gc->colorname);
        ghid_set_line_width (gc, gc->width);
        ghid_set_line_cap (gc, (EndCapStyle)gc->cap);
        ghid_set_draw_xor (gc, gc->xor_mask);
    }
    if (gc->mask_seq != mask_seq)
    {
        if (mask_seq)
            gdk_gc_set_clip_mask (gc->gc, gport->mask);
        else
            gdk_gc_set_clip_mask (gc->gc, NULL);
        gc->mask_seq = mask_seq;
    }
    gport->u_gc = WHICH_GC (gc);
    return 1;
}
Exemple #2
0
static int
use_gc (hidGC gc)
{
  render_priv *priv = gport->render_priv;
  GdkWindow *window = gtk_widget_get_window (gport->top_window);

  if (gc->me_pointer != &ghid_hid)
    {
      fprintf (stderr, "Fatal: GC from another HID passed to GTK HID\n");
      abort ();
    }

  if (!gport->pixmap)
    return 0;
  if (!gc->gc)
    {
      gc->gc = gdk_gc_new (window);
      ghid_set_color (gc, gc->colorname);
      ghid_set_line_width (gc, gc->width);
      ghid_set_line_cap (gc, (EndCapStyle)gc->cap);
      ghid_set_draw_xor (gc, gc->xor_mask);
      gdk_gc_set_clip_origin (gc->gc, 0, 0);
    }
  if (gc->mask_seq != mask_seq)
    {
      if (mask_seq)
	gdk_gc_set_clip_mask (gc->gc, gport->mask);
      else
	set_clip (priv, gc->gc);
      gc->mask_seq = mask_seq;
    }
  priv->u_gc = WHICH_GC (gc);
  return 1;
}
Exemple #3
0
void
ghid_set_line_width (hidGC gc, int width)
{

    gc->width = width;
    if (gc->gc)
        gdk_gc_set_line_attributes (WHICH_GC (gc),
                                    Vz (gc->width), GDK_LINE_SOLID,
                                    (GdkCapStyle)gc->cap, (GdkJoinStyle)gc->join);
}
Exemple #4
0
void
ghid_set_line_width (hidGC gc, Coord width)
{
  render_priv *priv = gport->render_priv;

  gc->width = width;
  if (gc->gc)
    gdk_gc_set_line_attributes (WHICH_GC (gc),
				Vz (gc->width), GDK_LINE_SOLID,
				(GdkCapStyle)gc->cap, (GdkJoinStyle)gc->join);
}
Exemple #5
0
void
ghid_set_line_cap (hidGC gc, EndCapStyle style)
{

    switch (style)
    {
    case Trace_Cap:
    case Round_Cap:
        gc->cap = GDK_CAP_ROUND;
        gc->join = GDK_JOIN_ROUND;
        break;
    case Square_Cap:
    case Beveled_Cap:
        gc->cap = GDK_CAP_PROJECTING;
        gc->join = GDK_JOIN_MITER;
        break;
    }
    if (gc->gc)
        gdk_gc_set_line_attributes (WHICH_GC (gc),
                                    Vz (gc->width), GDK_LINE_SOLID,
                                    (GdkCapStyle)gc->cap, (GdkJoinStyle)gc->join);
}