Am Montag, den 27.11.2006, 17:43 +0100 schrieb Christophe Piault: > Hi all, > > I'm trying to got the bit depth (typically 8, 16, 24 or 32) of a Gtk::Image. > Gdk::Pixbuf::get_bits_per_sample() seems to be what I'm looking for > but it always returns 8. Others get methods work perfectly well.
With the current GdkPixbuf implementation get_bits_per_sample() will always return 8. Note that bits_per_sample is not the same as the "bit depth". That would be get_n_channels() * get_bits_per_sample(). However, at the moment GdkPixbuf only supports the RGB and RGBA colorspace -- even grayscale images are expanded to RGB on load. To cut a long story short, there is no such thing as a "bit depth of a Gtk::Image". Gtk::Image is a container that can hold several kinds of image representations. > I also tried with Gdk::Drawable::get_depth() after getting the pixmap > with Gtk::Image::get_pixmap. Unfortunately get_pixmap works only > for empty and pixmap image. Gdk::Pixmap represents an entity of the windowing system. In fact, on most platforms out there the bit depth of a Gdk::Pixmap to be displayed has to match the desktop's bit depth -- at least as far as I know. Only highend graphics hardware supports displaying multiple bit depths at the same time. So, Gdk::Pixmap is probably not what you want. And Gdk::Pixbuf abstracts the details so much that it's impossible to probe the internal format of the original image, save for querying the existence of an alpha channel. --Daniel _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
