beginner question about refreshing screen



Hi,

I am currently coding a drawing editor. I have used the scribbe_simple
program as a base.

When I add points to the screen, I want to be able to join them in "real
time", I mean I click and it appears immediatly. 

The solution of scribbe is not really good for me as it only works for
rectangles

draw_brush (GtkWidget *widget, int x, int y)  {
  GdkRectangle update_rect; 

  update_rect.x = x; 
  update_rect.y = y; 
  update_rect.width = 5; 
  update_rect.height = 5; 
  gdk_draw_rectangle (pixmap,
                      widget->style->black_gc,
                      TRUE,
                      update_rect.x, update_rect.y,
                      update_rect.width, update_rect.height); 

  gtk_widget_draw (widget, &update_rect); 
}


questions

1 is there a function similar to gtk_widget_draw that can draw lines or
circles...?

2 how can I call the expose_event function which is like this ?

static gint expose_event (GtkWidget *widget, GdkEventExpose *event) {
  gdk_draw_pixmap(widget->window,
                  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                  pixmap,
                  event->area.x, event->area.y,
                  event->area.x, event->area.y,
                  event->area.width, event->area.height); 
  return FALSE; 
}

3 Or better, what would look like a simple (really simple) refresh
function (without the  GdkEventExpose *event argument) 


Sorry for these dumb question, but I quite a beginner, and the .h files
are not (always) enough for me.

Thanks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]