From 2bff4ae70dfeaf57ad6fb9b5102b134d9c31dd8a Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Tue, 17 Sep 2002 05:29:54 +0000 Subject: [PATCH] Sneak this patch at night, while Mike and Rachel are sleeping and not particularly watching the cvs list svn path=/trunk/gtk-sharp/; revision=7556 --- gdk/Pixbuf.custom | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gdk/Pixbuf.custom diff --git a/gdk/Pixbuf.custom b/gdk/Pixbuf.custom new file mode 100644 index 000000000..ac209186d --- /dev/null +++ b/gdk/Pixbuf.custom @@ -0,0 +1,29 @@ +IntPtr LoadFromStream (System.IO.Stream input) +{ + PixbufLoader loader = new PixbufLoader (); + byte [] buffer = new byte [8192]; + + int n; + + while ((n = input.Read (buffer, 0, 8192)) != 0) + loader.Write (buffer, (uint) n); + loader.Close (); + + return loader.Pixbuf.Handle; +} + +public Pixbuf (System.IO.Stream input) +{ + Raw = LoadFromStream (input); +} + +public Pixbuf (System.Reflection.Assembly assembly, string resource) +{ + if (assembly == null) + assembly = System.Reflection.Assembly.GetCallingAssembly (); + + System.IO.Stream s; + Pixbuf p = null; + using (s = assembly.GetManifestResourceStream (resource)) + Raw = LoadFromStream (s); +} \ No newline at end of file