Re: [gtkmm] How to modify Gdk::Pixbuf data
- From: Ole Laursen <olau hardworking dk>
- To: gtkmm-list gnome org
- Subject: Re: [gtkmm] How to modify Gdk::Pixbuf data
- Date: 08 Oct 2003 21:28:42 +0200
Silviu D Minut <minutsil cse msu edu> writes:
> I need to read an image from the disk, display it, do some image
> processing on it (filtering, edge detection, etc.) and then display again
> the results.
>
> So I use a Gdk::Pixbuf for that, which is a protected member in some
> class. First I do
>
> Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = creat_from_file("imagefile");
>
> Then I get the data from the pixbuf_
>
> u_char * pixbufdata_=pixbuf_->get_data();
>
> and I copy it to a buffer (u_char * data) in memory, in a for loop.
Don't do that. Work directly on the pixbuf data, then call simply call
image->set_pixbuf(pixbuf) (or whatever) when you are done.
For working with the data, you may want to have a look at my pixbuf
iterators:
http://www.cs.auc.dk/~olau/misc/pixbuf-drawing.hpp
I've used them extensively myself. I wrote a mail about the concept
here:
http://mail.gnome.org/archives/gtkmm-list/2003-January/msg00198.html
Perhaps it is time to revise them for inclusion in gtkmm? My time is
limited right now, though.
--
Ole Laursen
http://www.cs.auc.dk/~olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]