Re: expose event & pixmap question



>gint exposeEventHandler(GtkWidget* widget, GdkEventExpose* event) {
>   gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widge
>t)],
>      Pixmaps::myPicture, event->area.x, event->area.y,
>      event->area.x, event->area.y, event->area.width, event->area.height);
>
>   return FALSE;
>};
>
>
>Pixmaps make expose event handlers easy I think because you can just
>redraw uncovered portion with a single function call as in function above.
>
>WHY CAN'T WE REDRAW A PORTION OF THE DRAWING AREA THE SAME
>WAY AND AVOID NEED FOR PIXMAP?

because we're shouting?

its because a Pixmap is a different kind of resource than a
Window. They are both considered to "drawables" - you can draw things
on them by calling the gdk_draw_*() functions. However, a pixmap is an
"offscreen" drawable that is never mapped to the display. A window in
an "onscreen" drawable that can be mapped to the display. when you
draw on a window, you are either going to fail (the window is not
mapped), or the results show up "right away". when you draw in a
pixmap, the results don't show up till you draw the pixmap into a
window. 

a drawing area has a window, not a pixmap, as its drawable. if you
want something else, then i suspect that the Canvas might be worth
getting to know.

does this make it any clearer?

--p



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