mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
29 lines
634 B
Plaintext
29 lines
634 B
Plaintext
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);
|
|
} |