[Gtk-sharp-list] Patch for gdk/Pixbuf.custom

Martin Willemoes Hansen mwh@sysrq.dk
Wed, 27 Aug 2003 09:53:21 +0200


--=-3dJzawwQngW9xs4eXuWb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Wed, 2003-08-27 at 06:26, Mike Kestner wrote:
> On Tue, 2003-08-26 at 16:36, Martin Willemoes Hansen wrote:
> > Hi!
> > 
> > I noticed that I could not compile the gdk assembly, the cause was a
> > missing DllImport.
> 
> Can you kill the inline doc comments above the new dllimport?  Looks
> like it was a copy/paste error even for the real method, but it
> certainly doesn't apply to the new dllimport method.  :)
> 
> In general we should be killing these in-line docs and making sure any
> useful info they contain is merged into the real docs.
> 
> > Okay to commit?
> 
> Please do.

Umh I added a proper copyright/information header and fixed some long
method signatures.
Okay to commit?
-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------               


--=-3dJzawwQngW9xs4eXuWb
Content-Disposition: attachment; filename=Pixbuf.custom.diff
Content-Type: text/plain; name=Pixbuf.custom.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

? Pixbuf.custom.diff
Index: Pixbuf.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gdk/Pixbuf.custom,v
retrieving revision 1.6
diff -u -r1.6 Pixbuf.custom
--- Pixbuf.custom	23 Jul 2003 17:19:18 -0000	1.6
+++ Pixbuf.custom	27 Aug 2003 08:02:04 -0000
@@ -1,7 +1,19 @@
+// Pixbuf.custom - Gdk Pixbuf class customizations
 //
-// Extensions to Pixbuf
-//
+// Authors: 
+// 	Vladimir Vukicevic <vladimir@pobox.com>
+// 	Miguel de Icaza <miguel@ximian.com>
+// 	Duncan Mak <duncan@ximian.com>
+//	Gonzalo Paniagua Javier <gonzalo@ximian.com>
+//	Martin Willemoes Hansen <mwh@sysrq.dk> 
+//
+// (C) 2002 Vladimir Vukicevic
+// (C) 2003 Ximian, Inc. (Miguel de Icaza)
+// (C) 2003 Ximian, Inc. (Duncan Mak)
+// (C) 2003 Ximian, Inc. (Gonzalo Paniagua Javier)
+// (C) 2003 Martin Willemoes Hansen
 //
+// This code is inserted after the automatically generated code.
 
 		IntPtr LoadFromStream (System.IO.Stream input)
 		{
@@ -44,10 +56,14 @@
 		}
 
 		[DllImport("gdk_pixbuf-2.0")]
-		static extern IntPtr gdk_pixbuf_composite_color_simple(IntPtr raw, int dest_width, int dest_height, int interp_type, int overall_alpha, int check_size, uint color1, uint color2);
-
-		public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, Gdk.InterpType interp_type, int overall_alpha, int check_size, uint color1, uint color2) {
-			IntPtr raw_ret = gdk_pixbuf_composite_color_simple(Handle, dest_width, dest_height, (int) interp_type, overall_alpha, check_size, color1, color2);
+		static extern IntPtr gdk_pixbuf_composite_color_simple(IntPtr raw, int dest_width, int dest_height, 
+								       int interp_type, int overall_alpha, 
+								       int check_size, uint color1, uint color2);
+
+		public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, Gdk.InterpType interp_type, 
+						       int overall_alpha, int check_size, uint color1, uint color2) {
+			IntPtr raw_ret = gdk_pixbuf_composite_color_simple(Handle, dest_width, dest_height, (int) interp_type, 
+									   overall_alpha, check_size, color1, color2);
 			Gdk.Pixbuf ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret, true);
 			return ret;
 		}
@@ -72,7 +88,8 @@
 					int bits_per_sample, int width, int height, int rowstride, 
 					GdkSharp.PixbufDestroyNotifyNative destroy_fn, System.IntPtr destroy_fn_data);
 
-		public Pixbuf(byte [] data, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, Gdk.PixbufDestroyNotify destroy_fn)
+		public Pixbuf(byte [] data, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, 
+			      Gdk.PixbufDestroyNotify destroy_fn)
 		{
 			GdkSharp.PixbufDestroyNotifyWrapper destroy_fn_wrapper = null;
 			destroy_fn_wrapper = new GdkSharp.PixbufDestroyNotifyWrapper (destroy_fn, this);
@@ -115,10 +132,15 @@
 // operation will create the Pixbuf instead of two
 //
 
-		/// <summary> GetFromDrawable Method </summary>
-		/// <remarks> To be completed </remarks>
-		public Gdk.Pixbuf CreateFromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) {
-			IntPtr raw_ret = gdk_pixbuf_get_from_drawable((IntPtr) 0, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height);
+		[DllImport("libgdk_pixbuf-2.0-0.dll")]
+		static extern IntPtr gdk_pixbuf_get_from_drawable (IntPtr nullpointer, IntPtr src, IntPtr cmap, 
+								   int src_x, int src_y, int dest_x, int dest_y, 
+								   int width, int height);
+
+		public Gdk.Pixbuf CreateFromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, 
+						      int dest_x, int dest_y, int width, int height) {
+			IntPtr raw_ret = gdk_pixbuf_get_from_drawable((IntPtr) 0, src.Handle, cmap.Handle, src_x, 
+								      src_y, dest_x, dest_y, width, height);
 			return new Pixbuf (raw_ret);
 		}
 
@@ -135,8 +157,11 @@
 				(uint) color1.ToArgb (), (uint) color2.ToArgb ());
 		}
 		
-		public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, Gdk.InterpType interp_type, int overall_alpha, int check_size, System.Drawing.Color color1, System.Drawing.Color color2) {
-			return CompositeColorSimple (dest_width, dest_height, interp_type, overall_alpha, check_size, (uint) color1.ToArgb (), (uint) color2.ToArgb ());
+		public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, Gdk.InterpType interp_type, 
+						       int overall_alpha, int check_size, System.Drawing.Color color1, 
+						       System.Drawing.Color color2) {
+			return CompositeColorSimple (dest_width, dest_height, interp_type, overall_alpha, check_size, 
+						     (uint) color1.ToArgb (), (uint) color2.ToArgb ());
 		}
 
 //

--=-3dJzawwQngW9xs4eXuWb--