* gdk/Pixbuf.custom: Removed the Assembly constructors.
(Pixbuf.LoadResource (string)): New. (Pixbuf.LoadResource (Assembly, string)): New. svn path=/trunk/gtk-sharp/; revision=20103
This commit is contained in:
parent
62a858e0cd
commit
c3b09b0d5b
2 changed files with 19 additions and 16 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-11-17 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
|
* gdk/Pixbuf.custom: Removed the Assembly constructors.
|
||||||
|
(Pixbuf.LoadResource (string)): New.
|
||||||
|
(Pixbuf.LoadResource (Assembly, string)): New.
|
||||||
|
|
||||||
2003-11-16 Mike Kestner <mkestner@ximian.com>
|
2003-11-16 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
* generator/Parameters: handle array+len param pairs.
|
* generator/Parameters: handle array+len param pairs.
|
||||||
|
|
|
@ -15,34 +15,31 @@
|
||||||
//
|
//
|
||||||
// This code is inserted after the automatically generated code.
|
// This code is inserted after the automatically generated code.
|
||||||
|
|
||||||
IntPtr LoadFromStream (System.IO.Stream input)
|
static private Pixbuf LoadFromStream (System.IO.Stream input)
|
||||||
{
|
{
|
||||||
PixbufLoader loader = new PixbufLoader ();
|
PixbufLoader loader = new PixbufLoader ();
|
||||||
byte [] buffer = new byte [8192];
|
byte [] buffer = new byte [8192];
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
while ((n = input.Read (buffer, 0, 8192)) != 0)
|
while ((n = input.Read (buffer, 0, 8192)) != 0)
|
||||||
loader.Write (buffer, (uint) n);
|
loader.Write (buffer, (uint) n);
|
||||||
|
|
||||||
loader.Close ();
|
loader.Close ();
|
||||||
|
return loader.Pixbuf;
|
||||||
return loader.Pixbuf.Handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pixbuf (System.IO.Stream input)
|
static public Pixbuf LoadResource (System.Reflection.Assembly assembly, string resource)
|
||||||
{
|
{
|
||||||
Raw = LoadFromStream (input);
|
System.IO.Stream s = assembly.GetManifestResourceStream (resource);
|
||||||
|
if (s == null)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return LoadFromStream (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pixbuf (System.Reflection.Assembly assembly, string resource)
|
static public Pixbuf LoadResource (string resource)
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
return LoadResource (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
||||||
assembly = System.Reflection.Assembly.GetCallingAssembly ();
|
|
||||||
|
|
||||||
System.IO.Stream s;
|
|
||||||
Pixbuf p = null;
|
|
||||||
using (s = assembly.GetManifestResourceStream (resource))
|
|
||||||
Raw = LoadFromStream (s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue