how to show GdkImlibImage?



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



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