|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Missing Gdk_Pixbuf_New_From_DataHi,
I am looking at GtkAda source (previous version and the latest 2.10.0 from Libre site). I found on the last line in gdk-pixbuf.ads that gdk_pixbuf_new_from_data is missing or is not implemented. Why? Is there any method to read pixbuf from Ada.Streams? I believe the missing function can do that with some implementation of conversion and stuff. Has anyone done this before? Thanks. -- "If you missed the rising sun and the morning dew, don't miss the beautiful sunset." -- Adrian Hoe inspired by Michal Nowak, June 15 2004 _______________________________________________ gtkada mailing list gtkada@... http://lists.adacore.com/mailman/listinfo/gtkada |
|
|
Re: Missing Gdk_Pixbuf_New_From_DataPlease do not cross post to multiple lists, thanks.
> I am looking at GtkAda source (previous version and the latest 2.10.0 > from Libre site). I found on the last line in gdk-pixbuf.ads that > gdk_pixbuf_new_from_data is missing or is not implemented. Why? Because nobody has implemented it so far. > Is there any method to read pixbuf from Ada.Streams? I believe the You can probably use Gdk_New_From_Xpm_Data for this purpose, or implement (and contribute) binding for gdk_pixbuf_new_from_data. Arno _______________________________________________ gtkada mailing list gtkada@... http://lists.adacore.com/mailman/listinfo/gtkada |
|
|
Re: Missing Gdk_Pixbuf_New_From_DataOn Tue, 25 Sep 2007 22:06:38 +0800, you wrote:
> I am looking at GtkAda source (previous version and the latest 2.10.0 > from Libre site). I found on the last line in gdk-pixbuf.ads that > gdk_pixbuf_new_from_data is missing or is not implemented. Why? Because it requires flat arrays I guess. You can use it directly using pragma Import. For example: X_Size : constant GInt := 16; Y_Size : constant GInt := 16; type Pixbuf_Image is array (Natural range 0..1023) of GUChar; pragma Convention (C, Pixbuf_Image); Pixels : constant Pixbuf_Image := ( 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, 255,255,255, 0, ... ); function Get_Pixbuf ( Data : Pixbuf_Image := Pixels; Colorspace : Gdk_Colorspace := Colorspace_RGB; Has_Alpha : GBoolean := 1; Bits : Int := 8; Width : Int := Int (X_Size); Height : Int := Int (Y_Size); Rowstride : Int := 64; Fn : Address := Null_Address; Fn_Data : Address := Null_Address ) return Gdk_Pixbuf; pragma Import (C, Get_Pixbuf, "gdk_pixbuf_new_from_data"); > Is there any method to read pixbuf from Ada.Streams? I believe the > missing function can do that with some implementation of conversion > and stuff. Has anyone done this before? I did a slightly different thing, a generator of Ada packages from XPM files. See http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#xpm2gtkada With streams, you would first read the image pixels from the stream into the memory and then call gdk_pixbuf_new_from_data. If you don't know the image size in advance as in my example, you can use System.Address in the first parameter of gdk_pixbuf_new_from_data instead. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de _______________________________________________ gtkada mailing list gtkada@... http://lists.adacore.com/mailman/listinfo/gtkada |
|
|
|
| Free Forum Powered by Nabble | Forum Help |