After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625538 - add GdkImage support
add GdkImage support
Status: RESOLVED FIXED
Product: gnome-perl
Classification: Bindings
Component: Gtk2
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk2-perl-bugs
gtk2-perl-bugs
Depends on:
Blocks:
 
 
Reported: 2010-07-29 02:00 UTC by Kevin Ryde
Modified: 2010-12-21 21:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
.xs and .t (11.29 KB, patch)
2010-07-29 02:00 UTC, Kevin Ryde
none Details | Review
patch and test cases (530 bytes, patch)
2010-11-27 22:39 UTC, Kevin Ryde
none Details | Review
patch and test cases (10.95 KB, patch)
2010-12-13 22:32 UTC, Kevin Ryde
committed Details | Review

Description Kevin Ryde 2010-07-29 02:00:58 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().
Comment 1 Torsten Schoenfeld 2010-11-23 21:34:37 UTC
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.
Comment 2 Kevin Ryde 2010-11-23 22:12:33 UTC
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! :-)
Comment 3 Torsten Schoenfeld 2010-11-24 19:49:45 UTC
The accessors were added in 2.22: <http://library.gnome.org/devel/gdk/2.22/gdk-Images.html>.
Comment 4 Kevin Ryde 2010-11-27 22:39:18 UTC
Created attachment 175389 [details] [review]
patch and test cases

This one with the get funcs.
Comment 5 Torsten Schoenfeld 2010-12-12 13:40:20 UTC
(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.
Comment 6 Kevin Ryde 2010-12-13 22:32:35 UTC
Created attachment 176376 [details] [review]
patch and test cases

Ah dear, the git checkin going wrong.
Comment 7 Torsten Schoenfeld 2010-12-21 21:44:10 UTC
Magnificent patch.  Thanks.