Re: How can I update the gdk-pixbuf raw data?



Hello, Zahra

Dear Andrey,
 Thanks alot for your guidance, but when i change the buffer
data, image header is also changed, and when using
"gdk_pixbuf_loader_write", an error of "unrecognized image file
format" will be arised, this is because that the image format is
important for the loader.
 is it any way to skip this restriction?
 Thanks,
 Zahra Zojaji
  
No, this restriction cannot be skipped - even typed loader(created via
gdk_pixbuf_loader_new_with_type()) need image header for
loading image correctly.

But if you change buffer, can you also adjust header?

By the way, pixbuf itself contains pixels as raw data - array of
rows, each row is array of pixels
(http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-gdk-pixbuf.html).
May be, it is easier to manipulate with pixels of pixbuf itself?
Or create copy of pixbuf, and manipulate with copy. Later you can
synchronize pixbufs using gdk_pixbuf_copy or gdk_pixbuf_copy_area.

 -----Original Message-----
 From: Andrey Tsyvarev <tsyvarev ispras ru>
 To: zzojaji aim com
 Cc: gtk-app-devel-list gnome org
 Sent: Fri, 15 May 2009 5:39 pm
 Subject: Re: How can I update the gdk-pixbuf raw data?
  
    
Hello, Zahra.    You can use GdkPixbufLoader for retrieve pixbuf
from raw data.  Code example:    GdkPixbufLoader *loader =
gdk_pixbuf_loader_new();  gdk_pixbuf_loader_write(loader, buffer,
buffer_size, NULL);  gdk_pixbuf_loader_close(loader, NULL); 
GdkPixbuf* pixbuf =     
gdk_pixbuf_copy(gdk_pixbuf_loader_get_pixbuf(loader)); 
g_object_unref(loader);        Now 'pixbuf' contains image,
previously stored in 'buffer'.    If you want to do more complex
things, than simple restoring pixbuf  from buffer, you may read
GdkPixbufLoader description
http://library.gnome.org/devel/gdk-pixbuf/stable/GdkPixbufLoader.html
Hello,      >   I am new to GTK and have a problem with
gdk-pixbuf, How can I update the   pixbuf raw data?   
  >   There is a pixbuf constructed from an image file, I  want
to  > change raw data behind it and upload new data back to pixbuf.
I  am  > using the "gdk_pIxbuf_save_to_buffer" for accessing raw
data, but I   > don't know how to upload the buffer back to the
pixbuf!      >   Thanks, in advance,      >   Zahra Zojaji          
_______________________________________________  >
gtk-app-devel-list mailing list  > gtk-app-devel-list gnome org >
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list --  
Andrey Tsyvarev      Linux Verification Center, ISPRAS   web:
http://www.linuxtesting.org e-mail: tsyvarev ispras ru  
  
  

We found the real 'Hotel California' and the 'Seinfeld' diner.
What will you find? Explore WhereItsAt.com.
  



-- 
Andrey Tsyvarev
 
 Linux Verification Center, ISPRAS
 web:    http://www.linuxtesting.org
 e-mail: tsyvarev ispras ru




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