Re: [gtk-list] how to show GdkImlibImage?



Dear shigang,
	You have forgotten to render the image. You should really render
the image with gdk_imlib_render before copying the pixmap.Also, it far
better that you create a drawable and then draw the pximap onto it. It is
more efficient. You can also eliminate the problem of flicker and
implement double buffering if you adopt this approach.

On Thu, 23 Sep 1999, shigang wrote:

> Hi everyone:
> 	I use "Gdk_Imlib" library creating a GdkImlibImage object. As a test, I want to show
> this image as background of a window widget. 
> 	
> 	The sample codes are as follow, but it can not reach my target !!!
> 
> #include <gtk/gtk.h>
> #include <gdk/gdk.h>
> #include <gdk_imlib.h>
> 
> int main(int argc, char* argv[])
> {
> 	Gtkwidget * window;
> 	GdkImlibImage * image;
> 	GdkPixmap * pixmap;
> 
> 	gtk_init(&argc,&argv);
> 	gdk_imlib_init();
> 	
> 	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> 	gtk_widget_realize(window);
> 
> /************************************************************************************/
> 											  				
> 	image = gdk_imlib_load_image("linuxGirl.xpm");// as a sample xpm file   
> 	pixmap = gdk_imlib_copy_image(image);
> 
> /************************************************************************************/
> 
> 	gdk_window_set_back_pixmap(window->window,pixmap,0);
> 	gtk_widget_set_app_paintable(window,TRUE);
> 	gdk_window_show(window->window);
> 	gtk_widget_show(window);
> 	
> 	gtk_mian();
> 	return 0;
> }
> 
> As my personal opinion, I think the problem located in the scale which was encapsulated by "/*******/".
> 
> It was because that when I use other method to create pixmap it worked well.
> 
> So my question is how can I get pixmap from GdkImlibImage?
> 
> Waiting for your ideas! 
>  
> 
> email:	 shigang@chpc.ict.ac.cn
> 
> shigang
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 




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