GDK-Pixbuf question, creating and reading private data-chunk for png
Hello, I am using gdk_pixbuf_save to store a gdk_drawable into a PNG File. Now I want to add a private data-chunk to PNG to store some additional Information. Is it possible to add a private data-chunk with GDK functions? If not, what do you think would be the best way to create this file? Using libpng with png_set_unknown_chunks() ? Is there any examplke of how I get GDK-IMAGE-DATA to libpng? regards Arne ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: libgdk_pixbuf, VC++ and TIFF files.
On 30 Nov 2010, at 15:47, John Emmas wrote: > gdk_pixbuf_new_from_file() opens the specified file using g_fopen() which in > turn, calls _wfopen(). This returns a FILE*. Next, > _gdk_pixbuf_generic_image_load() gets used to read the subsequent TIFF data. > That process starts with the FILE* getting sent to _fileno() which returns a > 'C' run time file handle. That file handle eventually gets passed to > TIFFFdOpen() which in turn, calls TIFFClientOpen() to read in the TIFF header. > > Unfortunately, the Win32 version tries to read the TIFF header courtesy of > the Windows function 'ReadFile()'. AFAIK, ReadFile() will only accept file > handles returned from CreateFile() - not from fopen() or _wfopen(). > Consequently, libgdk_pixbuf fails to read the TIFF data (on Win32/VC++) > because it used g_fopen() to open the file, instead of using TIFF's own > TIFFOpen() function, which would have opened the file using CreateFile() After posting a question on the libTIFF mailing list I discovered that there were already some POSIX style file handlers available (read() / write() etc) that I could use instead of the Win32 ones. This solved my problem but it threw up another problem in the TIFF handler for libgdk-pixbuf, namely in the module 'io-tiff.c'. Here's the relevant section from the function 'gdk_pixbuf__tiff_image_load()' (not sure if my formatting will work via the mailing list):- static GdkPixbuf* gdk_pixbuf__tiff_image_load (FILE *f, GError **error) { TIFF *tiff; int fd; GdkPixbuf *pixbuf; [ ... ] fd = fileno (f); tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r"); if (!tiff || global_error) { tiff_set_error (error, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Failed to open TIFF image")); tiff_pop_handlers (); return NULL; } pixbuf = tiff_image_parse (tiff, NULL, error); TIFFClose(tiff); [ ... ] return pixbuf; } The important thing to note is that TIFFFdOpen() does not actually open a file. The file must have already been opened by some external process, prior to calling the above function. However, TIFFClose() does in fact close the file. This means that when the external process tries to close it, there's a risk of it crashing or asserting. AFAICT the call to TIFFClose(tiff); should really have been TIFFCleanup(tiff); I tried substituting the alternative function and it seemed to fix the problem. This needs to be fixed quite urgently in libgdk-pixbuf because if it's currently working on any given compiler, it's purely by luck..! John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Signal inside widget subclass
Lets say your buffer's class is like typedef struct _MyTextBufferClass { GtkTextBufferClass parent_class; // more stuff here } MyTextBufferClass; Basicaly in my_text_buffer_class_init override "changed" function void my_text_buffer_class_init(MyTextBufferClass *klass) { GtkTextBufferClass* tbc = (GtkTextBufferClass*)klass; tbc->changed = your_function_name_here; } And then in your function call previous function void your_function_name_here(GtkTextBuffer *buffer) { // your stuff here GTK_TEXT_BUFFER_CLASS(my_text_buffer_parent_class)->changed(buffer) } On 12/02/2010 04:42 AM, Erick Pérez Castellanos wrote: Hi: I have this design issue: I’m kinda newbie with gtk development, so sorry is this is the first line on some mystery tutorial out there . I’m subclassing a Gtk.TextBuffer and I want to know inside the widget code when the “changed” signal is emitted. I know I always can connect a callback to the signal, that why they exist anyway, but that sound like something I wouldn't do inside the widget. Is it correct ? At least from the Gtk development/design point view. It works, really well, my point is purely about design, maybe there a better and prettier way of doing this. Thxs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Does GTK has something similar to SC_KEYMENU from Windows API?
Hi everybody, Does GTK has something similar to SC_KEYMENU from Windows API? For example, when user press "Alt-Space" on Windows to evoke the system menu(or "Alt-F" to evoke the "File" menu, etc.), then the process would receive a message called WM_SYSCOMMAND with SC_KEYMENU as its parameter. Does GTK has something similar? The following link is the document of SC_KEYMENU from Microsoft's website: http://msdn.microsoft.com/en-us/library/ms646360%28VS.85%29.aspx See the wParam and Remarks part of the webpage. Thanks very much. Regards H Xu 2010/12/2 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list