Re: display 16bit-image
- From: Bob Caryl <bob fis-cal com>
- To: Andreas Schropp <schropp_andreas yahoo de>
- Cc: gtkmm-list gnome org
- Subject: Re: display 16bit-image
- Date: Mon, 11 Jul 2005 08:18:42 -0500
Andreas Schropp wrote:
Hi,
I am desperately looking for a suitable method using
gtkmm in order to display 16 bit data (grey-valued) on the screen.
I want to refresh that image in certain moments by a mouse click
or any other timer-signal.
Until now, I tried it with the "gdkmm/pixbuf.h"-class using its
"create_from_data(...)-method, but until now everything failed.
Thanx a lot in advance
Andreas
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Hello Andreas,
If you want to display your image from inline data you will want to use
the gdk-pixbuf-csource utility found in /opt/gnome/bin to create a C
source file you can include in your source code. Once that is done you
need to include the following in your derived window class:
Glib::RefPtr<Gdk::Pixbuf> image;
Then, in the constructor for your derived window class you need to have
this line:
image = Gdk::Pixbuf::create_from_inline(-1,<pointer to your inline
image data>,FALSE);
Then, in your overridden on_expose_event function, you will want this code:
Glib::RefPtr<Gdk::Pixbuf> tmpimage =
image->scale_simple(get_width(),get_height(),Gdk::INTERP_BILINEAR);
tmpimage->render_to_drawable(get_window(),
get_style()->get_white_gc(),
0, 0, 0, 0, get_width(), get_height(),Gdk::RGB_DITHER_NONE, 0, 0);
The foregoing code scales the image pixbuf you created in the
constructor to the current size of your window. Of course, you can use
that same code in a mouse event as well to re-render the image.
I hope this helps a bit.
Bob Caryl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]