[gtkada] Addition of Gdk_New_From_Data into Gdk.Pixbuf
Anne et Damien Carbonne
aetdcarbonne at free.fr
Tue Jul 14 14:28:43 CEST 2009
Arnaud Charlet a écrit :As Gdk_New_From_Data is currently missing from
Gdk.Pixbuf, I created a
>> binding for it (in a child package of Gtk.Pixbuf).
>> Would you consider adding this directly into to Gtk.Pixbuf?
>> Is the attached code sufficient or would you prefer a diff?
>>
>
> A patch (diff) against svn trunk as well as a ChangeLog would be better.
>
> The patch will probably need to be reworked before integration, since
> the API you provide is pretty low-level (in particular the handling of
> Destroy_Fn/Destroy_Fn_Data).
>
> I'd suggest either remove the two last parameters, or perhaps provide a single
> extra parameter: Destroy_Fn, removing the use of user data from the spec
> (and still use it under the hood in the body).
>
> The spec (comments) should probably also reflect/explain this business
> of destroy/user data.
>
> Arno
>
I checked out current (2009-07-14) svn trunk. I have attached a possible
patch usable on the trunk.
I replaced the destroy cb and data with a boolean parameter used to tell
whether pixel data must be automatically freed.
Does it fit what you have in mind?
It would be possible to add another version, that would be generic and
would have an associated user data type.
generic
type Closure_Type is ...
package Generic_XXX is
type Destroy_Callback is access procedure
(Pixels : in out Guchar_Array_Access;
Closure : in out Closure_Type);
function New_from_Data
(Data : Guchar_Array_Access;
...
Closure : Closure_Type) return Gdk_Pixbuf;
end Generic_XXX;
If you think it is worth, I could provide an additional patch with the
generic version.
Damien
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gdk-pixbuf-new_from_data.patch
Url: /pipermail/gtkada/attachments/20090714/8280a79c/attachment.txt
More information about the gtkada
mailing list