Re: How to display an image array?



Don't know if this will help, but here is a snippet I use to draw straight onto the Gdk::Window  (screen is a Gtk::Image in this case)

<snip>
screen.get_window()->draw_rgb_image(
     screen.get_style()->get_bg_gc(Gtk::STATE_NORMAL),
     0,
     0,
     width,
     height,
     Gdk::RGB_DITHER_NONE,
     (const guchar*) data,
     width*3
);
</snip>

And here's one I use with pixbuf...

<snip>
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create_from_data(
     (guint8*) data,
     Gdk::COLORSPACE_RGB,
     false,
     depth,
     width,
     height,
     width*3
);
</snip>

Not sure if they are the "right" way to do it, but they work for me.

- John Hobbs

john velvetcache org

On Fri, Sep 26, 2008 at 2:57 PM, simba simba <simba buffalo gmail com> wrote:
Hi dear all:

Now I have a image array, char * data. I know this array's length( image's width and height) and array's format( RGB 32bits for a pixel or Grayscale leve 8bits for a pixel).

My question is how can I display this image array by using gtkmm?

I have tried using Gtk::Pixbuf  pixbuf.create_from_data().

But it is not good for me. Is there any example codes?

Thanks a lot!!

simba

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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