colormap manipulation

i have to apply some image processing algorithms using gdk. They all involve only operation on colormap and not directy on the pixels.
Can you give me some tips about what stuctures should i used.

i tried using a GtkImage whick store information in gdk-pixbuf and then convert the pixbuf into pixmap and then set a colormap to the pixmap, but in this way modifying the colormad does not modify the pixmap.

        GdkPixbuf *pixbuf;
	GdkPixmap *pixmap;
	GdkColor color;
	GdkVisual *visual = gdk_visual_get_best() ;
	GdkColormap *colormap =gdk_colormap_new (visual,FALSE);
        //image_active is a GtkImage create with gtk_image_new_from_file
	pixbuf = gtk_image_get_pixbuf ( GTK_IMAGE(image_active));
	for (i=0; i < colormap->size; i++){
		if (colormap->colors){

	pixmap = gdk_pixmap_new ( NULL, 
		gdk_pixbuf_get_height (pixbuf),
	gdk_drawable_set_colormap (pixmap, colormap);

	gdk_draw_pixbuf ( pixmap, NULL, pixbuf, 0, 0, 0, 0, 
                     	gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height (pixbuf),

	gtk_image_set_from_pixmap ( GTK_IMAGE(image_active), pixmap, NULL);
	gtk_widget_show (window_colormap);

many thanks
Adi Roiban

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