Re: Got my statusbar displaying locations HURRAY THANKS, next
- From: Deborah Swayne <dfs research att com>
- To: "Billy N. Patton" <bpatton dal asp ti com>
- Cc: Gtk users <gtk-list gnome org>
- Subject: Re: Got my statusbar displaying locations HURRAY THANKS, next
- Date: Mon, 18 Dec 2000 10:30:30 -0500
> Could someone please enligntenment on the proper procedure for doing the
> following.
> 1. create pixmap size of screen (done i think);
> 2. put all data into pixmap. (maybe done)
> 3. blit to screen ???
> 4. if resize destroy current pixmap and rebuild
I handle these myself, though some people prefer to use a canvas. I
end up using two pixmaps, one for the basic drawing, and one for the
drawing plus some decorations which may change frequently, as the
mouse is moved.
---- Questions 1 and 4 ----
Attach a callback to your drawing area:
gtk_signal_connect (GTK_OBJECT (sp->da),
"configure_event",
(GtkSignalFunc) splot_configure_cb,
(gpointer) sp);
In the configure event handler, create or resize the pixmap:
static gint
splot_configure_cb (GtkWidget *w, GdkEventConfigure *event, splotd *sp)
{
if (w->allocation.width == 1 || w->allocation.height == 1)
return false;
/*-- Create new backing pixmaps of the appropriate size --*/
if (sp->pixmap0 != NULL)
gdk_pixmap_unref (sp->pixmap0);
if (sp->pixmap1 != NULL)
gdk_pixmap_unref (sp->pixmap1);
sp->pixmap0 = gdk_pixmap_new (w->window,
w->allocation.width, w->allocation.height, -1);
sp->pixmap1 = gdk_pixmap_new (w->window,
w->allocation.width, w->allocation.height, -1);
gtk_widget_queue_draw (sp->da);
return false;
}
---- Question 3 ----
Blit pixmap to screen:
The basic routines are as
follows:
/* clear the pixmap */
gdk_gc_set_foreground (gg->plot_GC, &gg->bg_color);
gdk_draw_rectangle (sp->pixmap0, gg->plot_GC,
TRUE, 0, 0,
da->allocation.width,
da->allocation.height);
/* draw to the pixmap; code not shown */
/* copy pixmap0 to pixmap1 */
gdk_draw_pixmap (sp->pixmap1, gg->plot_GC, sp->pixmap0,
0, 0, 0, 0,
w->allocation.width,
w->allocation.height);
/* copy pixmap1 to the window */
w = sp->da;
gdk_draw_pixmap (w->window, gg->plot_GC, sp->pixmap1,
0, 0, 0, 0,
w->allocation.width,
w->allocation.height);
Debby
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]