GNOME Bugzilla – Bug 625538
add GdkImage support
Last modified: 2010-12-21 21:44:14 UTC
Created attachment 166750 [details] [review] .xs and .t This is a few lines to complete GdkImage support. An advantage of an image over a pixbuf is that you can fetch actual pixel values from pixmaps or windows. The GdkImage object itself already arises in the wrappings, the code here is new() for it, and operations like get_pixel() and put_pixel().
The docs say that GdkImage "has now been superceded to a large extent by the much more flexible GdkRGB functions." So is GdkImage really better for your use case? If so, then I think the patch can go in. Just one minor thing: can you name the accessors "get_foo" and implement them as is done in xs/GtkSelection.xs? That is, use the "get_foo" methods if available, otherwise use struct access.
The access to pixel values is the key bit. I believe GdkImage is the only way to fetch a pixel value as such from a pixmap/bitmap/window. If working with big bitmaps you might also appreciate having the bits packed into bytes instead of pixbuf 3-bytes per bit. There's no get_foo() accessors apart from the get_colormap() one. I'd suspect there probably won't be in the future, and that it might be unwise to anticipate the names. (Notwithstanding the general gtk tendency to make code bigger and slower by putting access through functions instead of fields! :-)
The accessors were added in 2.22: <http://library.gnome.org/devel/gdk/2.22/gdk-Images.html>.
Created attachment 175389 [details] [review] patch and test cases This one with the get funcs.
(In reply to comment #4) > This one with the get funcs. Looks like this patch doesn't contain the new files t/GdkImage.t and xs/GdkImage.xs.
Created attachment 176376 [details] [review] patch and test cases Ah dear, the git checkin going wrong.
Magnificent patch. Thanks.