Re: Images in GTKmm



You should subclass Gtk::DrawingArea
and implement at least:
	virtual bool on_configure_event(GdkEventConfigure *event);
	virtual bool on_expose_event(GdkEventExpose *event);

some steps:
1. calculate the image offsets, scale, etc.

2. with the info in (1), render the pixbuf to the offscreen pixmap like so:
	pixmap->draw_pixbuf(..., pixbuf, ...);

3. shows the contents of pixmap in on_expose_event() function:
	
	get_window()->draw_drawable
	(
		get_style()->get_fg_gc(get_state()),
  		pixmap,
		event->area.x, event->area.y,
		event->area.x, event->area.y,
		event->area.width, event->area.height
	);

Best regards,
smso



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