[gtkada] How to access the alpha channel in a Pixbuf
Dmitry A. Kazakov
mailbox at dmitry-kazakov.de
Wed Nov 7 10:50:40 CET 2007
On Tue, 6 Nov 2007 19:50:53 +0100, you wrote:
> So the questions are:
>
> 1. How should I access the alpha channel data?
> Should I do unchecked_conversion to array of guchars? (Or packed record
> with R, G, B, and A members)
Yes, and the array should be flat. Alternatively you could use
Interfaces.C.Pointers instead of the array.
> 2. In case of RGBA data format, is the array of Rgb_Record consistent at
> all with the image data? (ie. does it not treat the alpha channel byte
> as a color byte of the next pixel?)
Looks like it is not, because Get_Pixels is imported directly from GDK:
pragma Import (C, Get_Pixels, "gdk_pixbuf_get_pixels");
The bindings could be a bit thicker here, or maybe thinner, returning a
pointer to guchar, obtained from Interfaces.C.Pointers.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
More information about the gtkada
mailing list