2005-01-25 Mike Kestner <mkestner@novell.com>
* gdk/Gdk.metadata : hide all the Pixbuf.SaveTo methods. * gdk/Pixbuf.custom : implement the SaveTo methods. svn path=/trunk/gtk-sharp/; revision=39514
This commit is contained in:
parent
fb12bb5f61
commit
ae84ad32ae
4 changed files with 135 additions and 49 deletions
|
@ -1,3 +1,8 @@
|
|||
2005-01-25 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* gdk/Gdk.metadata : hide all the Pixbuf.SaveTo methods.
|
||||
* gdk/Pixbuf.custom : implement the SaveTo methods.
|
||||
|
||||
2005-01-25 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* gtk/Gtk.metadata : hide all the SignalFunc using Toolbar methods.
|
||||
|
|
|
@ -1409,54 +1409,6 @@ Gdk.Pixbuf pb = new Gdk.Pixbuf(memorystream);
|
|||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToBufferv">
|
||||
<MemberSignature Language="C#" Value="public bool SaveToBufferv (string buffer, out uint buffer_size, string type, string option_keys, string option_values);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="buffer" Type="System.String" />
|
||||
<Parameter Name="buffer_size" Type="System.UInt32&" RefType="out" />
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
<Parameter Name="option_keys" Type="System.String" />
|
||||
<Parameter Name="option_values" Type="System.String" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="buffer">a <see cref="T:System.String" /></param>
|
||||
<param name="buffer_size">a <see cref="T:System.UInt32" /></param>
|
||||
<param name="type">a <see cref="T:System.String" /></param>
|
||||
<param name="option_keys">a <see cref="T:System.String" /></param>
|
||||
<param name="option_values">a <see cref="T:System.String" /></param>
|
||||
<returns>a <see cref="T:System.Boolean" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToCallbackv">
|
||||
<MemberSignature Language="C#" Value="public bool SaveToCallbackv (Gdk.PixbufSaveFunc save_func, IntPtr user_data, string type, string option_keys, string option_values);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="save_func" Type="Gdk.PixbufSaveFunc" />
|
||||
<Parameter Name="user_data" Type="System.IntPtr" />
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
<Parameter Name="option_keys" Type="System.String" />
|
||||
<Parameter Name="option_values" Type="System.String" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="save_func">a <see cref="T:Gdk.PixbufSaveFunc" /></param>
|
||||
<param name="user_data">a <see cref="T:System.IntPtr" /></param>
|
||||
<param name="type">a <see cref="T:System.String" /></param>
|
||||
<param name="option_keys">a <see cref="T:System.String" /></param>
|
||||
<param name="option_values">a <see cref="T:System.String" /></param>
|
||||
<returns>a <see cref="T:System.Boolean" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Unref">
|
||||
<MemberSignature Language="C#" Value="public void Unref ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
|
@ -1572,5 +1524,79 @@ Gdk.Pixbuf pb = new Gdk.Pixbuf(memorystream);
|
|||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToBuffer">
|
||||
<MemberSignature Language="C#" Value="public byte [] SaveToBuffer (string type, string [] option_keys, string [] option_values);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Byte[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
<Parameter Name="option_keys" Type="System.String[]" />
|
||||
<Parameter Name="option_values" Type="System.String[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Saves to a buffer.</summary>
|
||||
<param name="type">an image type, such as png, jpeg, or ico</param>
|
||||
<param name="option_keys">an array of option keys.</param>
|
||||
<param name="option_values">an array of option values.</param>
|
||||
<returns>a <see cref="T:System.Byte[]" /></returns>
|
||||
<remarks>>The <paramref name="option_keys"/> and <paramref name="option_values"/> should contain key/value pairs. See <see cref="M:Gdk.Pixbuf.Save"/> for more details. Throws a <see cref="T:GLib.GException"/> if the save is not successful.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToBuffer">
|
||||
<MemberSignature Language="C#" Value="public byte [] SaveToBuffer (string type);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Byte[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Saves to a buffer.</summary>
|
||||
<param name="type">an image type, such as png, jpeg, or ico</param>
|
||||
<returns>a <see cref="T:System.Byte[]" /></returns>
|
||||
<remarks>Throws a <see cref="T:GLib.GException"/> if the save is not successful.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToCallback">
|
||||
<MemberSignature Language="C#" Value="public void SaveToCallback (Gdk.PixbufSaveFunc save_func, string type);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="save_func" Type="Gdk.PixbufSaveFunc" />
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Save using a callback delegate.</summary>
|
||||
<param name="save_func">a <see cref="T:Gdk.PixbufSaveFunc" /></param>
|
||||
<param name="type">an image type, such as png, jpeg, or ico</param>
|
||||
<remarks>Throws a <see cref="T:GLib.GException"/> if the save is not successful.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="SaveToCallback">
|
||||
<MemberSignature Language="C#" Value="public void SaveToCallback (Gdk.PixbufSaveFunc save_func, string type, string [] option_keys, string [] option_values);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="save_func" Type="Gdk.PixbufSaveFunc" />
|
||||
<Parameter Name="type" Type="System.String" />
|
||||
<Parameter Name="option_keys" Type="System.String[]" />
|
||||
<Parameter Name="option_values" Type="System.String[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Save using a callback delegate.</summary>
|
||||
<param name="save_func">a <see cref="T:Gdk.PixbufSaveFunc" /></param>
|
||||
<param name="type">an image type, such as png, jpeg, or ico</param>
|
||||
<param name="option_keys">an array of option keys</param>
|
||||
<param name="option_values">an array of option values</param>
|
||||
<remarks>The <paramref name="option_keys"/> and <paramref name="option_values"/> should contain key/value pairs. See <see cref="M:Gdk.Pixbuf.Save"/> for more details. Throws a <see cref="T:GLib.GException"/> if the save is not successful.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
</Type>
|
||||
|
|
|
@ -84,6 +84,10 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMask']/*/*[@name='mask_return']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Save']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Savev']/*/*[@type='char**']" name="array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBuffer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBufferv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallback']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallbackv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='ScaleSimple']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property[@name='Pixels']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='GetPixbuf']" name="needs_ref">1</attr>
|
||||
|
|
|
@ -252,3 +252,54 @@
|
|||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_free (IntPtr raw);
|
||||
|
||||
[DllImport("libgdk_pixbuf-2.0-0.dll")]
|
||||
static extern unsafe bool gdk_pixbuf_save_to_bufferv (IntPtr raw, out IntPtr buffer, out uint buffer_size, string type, string[] option_keys, string[] option_values, out IntPtr error);
|
||||
|
||||
string[] NullTerm (string[] src)
|
||||
{
|
||||
string[] result = new string [src.Length + 1];
|
||||
for (int i = 0; i < src.Length; i++)
|
||||
result [i] = src [i];
|
||||
result [src.Length] = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public unsafe byte[] SaveToBuffer (string type)
|
||||
{
|
||||
return SaveToBuffer (type, new string [0], new string [0]);
|
||||
}
|
||||
|
||||
public unsafe byte[] SaveToBuffer (string type, string[] option_keys, string[] option_values)
|
||||
{
|
||||
IntPtr error = IntPtr.Zero;
|
||||
IntPtr buffer;
|
||||
uint buffer_size;
|
||||
if (!gdk_pixbuf_save_to_bufferv (Handle, out buffer, out buffer_size, type, NullTerm (option_keys), NullTerm (option_values), out error))
|
||||
throw new GLib.GException (error);
|
||||
|
||||
byte[] result = new byte [buffer_size];
|
||||
Marshal.Copy (buffer, result, 0, (int) buffer_size);
|
||||
g_free (buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport("libgdk_pixbuf-2.0-0.dll")]
|
||||
static extern unsafe bool gdk_pixbuf_save_to_callbackv (IntPtr raw, GdkSharp.PixbufSaveFuncNative save_func, IntPtr user_data, string type, string[] option_keys, string[] option_values, out IntPtr error);
|
||||
|
||||
public unsafe void SaveToCallback (PixbufSaveFunc save_func, string type)
|
||||
{
|
||||
SaveToCallback (save_func, type, new string [0], new string [0]);
|
||||
}
|
||||
|
||||
public unsafe void SaveToCallback (PixbufSaveFunc save_func, string type, string[] option_keys, string[] option_values)
|
||||
{
|
||||
GdkSharp.PixbufSaveFuncWrapper save_func_wrapper = null;
|
||||
save_func_wrapper = new GdkSharp.PixbufSaveFuncWrapper (save_func, this);
|
||||
IntPtr error = IntPtr.Zero;
|
||||
if(!gdk_pixbuf_save_to_callbackv (Handle, save_func_wrapper.NativeDelegate, IntPtr.Zero, type, NullTerm (option_keys), NullTerm (option_values), out error))
|
||||
throw new GLib.GException (error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue