colormap manipulation

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

 



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){
		 colormap->colors[i].red=0;

		}
	}
	
	pixmap = gdk_pixmap_new ( NULL, 
		gdk_pixbuf_get_width(pixbuf),
		gdk_pixbuf_get_height (pixbuf),
		3*gdk_pixbuf_get_bits_per_sample(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),
                      GDK_RGB_DITHER_NORMAL,0,0);
											

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


many thanks
Adi Roiban

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux