SV: SV: drawables.



> -----Oprindelig meddelelse-----
> Fra: Paul Davis [mailto:paul linuxaudiosystems com]
> Sendt: 23. juni 2006 16:51
> Til: Morten Bo Nielsen
> Cc: gtkmm-list gnome org
> Emne: Re: SV: drawables.
> 
> On Wed, 2006-06-21 at 10:30 +0200, Morten Bo Nielsen wrote:
> > Now I do this (using libglade) - (InData is a class of my own
making):
> >
> > Gtk::DrawingArea *PolyDrawArea;
> > xml_interface->get_widget( "PolyDrawArea", PolyDrawArea );
> >
> > Glib::RefPtr<Gdk::Pixbuf> image = Gdk::Pixbuf::create_from_file(
> > "nn.bmp" );
> > PolyDrawArea->set_size_request( image->get_width(),
image->get_height()
> > );
> > image->render_to_drawable( 	PolyDrawArea->get_window(),
> > 			PolyDrawArea->get_style()-
> >get_black_gc(),
> > 			0, 0, 0, 0,
> > 			image->get_width(), image->get_height(),
> > 			Gdk::RGB_DITHER_NONE, 0, 0);
> >
> >
> > It works, but I get
> >
> > (AcqTest.exe:3996): Gdk-CRITICAL **: gdk_draw_pixbuf: assertion
> > 'GDK_IS_DRAWABLE (drawable)' failed
> >
> > on the render_to_drawable() line.
> > Any ideas?
> 
> you are drawing in an expose handler, yes?
> 

no. :-)

I do this now.

	// retrieving gdk::window to write to
	Glib::RefPtr<Gdk::Window> Window =  PolyDrawArea->get_window();
	if( !Window )
		return; 

I exit the draw-function if the gdk::window is not visible. It is good
for performance and it is properbly better programming as well.

morten




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