--- En date de : Lun 18.2.13, Rena <hyperhac...@gmail.com> a écrit :
> Recently I've been developing a Game Boy emulator
> that uses GtkDrawingArea and GdkPixbuf to display the game
> screen.
> 
> In addition to the game output I want to also be able to draw text and
> shapes on the display window, and Cairo seems to be the ideal way to
> draw shapes. I'm already using Cairo to copy the Pixbuf to the
> GtkDrawingArea, so that seems like a good sign that Cairo and
> GdkPixbuf should interact nicely.

Hi,

Not sure if this can help, but here's what I do. It uses GdkPixmap.

  double new_x,new_y;
  new_x=d_area->allocation.width;
  new_y=d_area->allocation.height;
  copy_gc=d_area->style->fg_gc[GTK_WIDGET_STATE (d_area)];
  pixmap=gdk_pixmap_new(d_area->window,new_x,new_y,-1);
  cairo=gdk_cairo_create(pixmap);

and then, on "expose" events:
  gdk_draw_drawable(d_area->window, copy_gc, pixmap,
                    event->area.x, event->area.y,
                    event->area.x, event->area.y,
                    event->area.width, event->area.height);

I also have to handle "configure" events (where the drawing area changes size).

-- 
LL
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to