new example/test for Rsvg

svn path=/trunk/gtk-sharp/; revision=32795
This commit is contained in:
John Luke 2004-08-24 20:26:36 +00:00
parent 8e8cb3ebcb
commit 87ca50791c
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,30 @@
using System;
using Gtk;
using Rsvg;
class RsvgResourceTest : Window
{
static void Main ()
{
Application.Init ();
new RsvgResourceTest ();
Application.Run ();
}
RsvgResourceTest () : base ("Rsvg Draw Test")
{
this.DeleteEvent += new DeleteEventHandler (OnWinDelete);
Image image = new Image ();
image.Pixbuf = Pixbuf.LoadFromResource ("sample.svg");
this.Add (image);
this.ShowAll ();
}
void OnWinDelete (object sender, DeleteEventArgs e)
{
Application.Quit ();
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.IO;
using Gtk;
using Rsvg;
class RsvgResourceTest : Window
{
static void Main ()
{
Application.Init ();
new RsvgResourceTest ();
Application.Run ();
}
RsvgResourceTest () : base ("Rsvg Draw Test")
{
this.DeleteEvent += new DeleteEventHandler (OnWinDelete);
Image image = new Image ();
// contrived way to get a stream
System.IO.Stream s = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream ("sample.svg");
if (s == null)
throw new ArgumentException ("resource must be a valid resource name of 'assembly'.");
image.Pixbuf = Pixbuf.LoadFromStream (s);
this.Add (image);
this.ShowAll ();
}
void OnWinDelete (object sender, DeleteEventArgs e)
{
Application.Quit ();
}
}

View File

@ -24,7 +24,7 @@ using Gtk;
{
this.DeleteEvent += new Gtk.DeleteEventHandler(delete_event);
string svg_file_name = "sample.svg";
Gdk.Pixbuf pixbuf = Rsvg.Tool.PixbufFromFile (svg_file_name);
Gdk.Pixbuf pixbuf = Rsvg.Pixbuf.FromFile (svg_file_name);
Gtk.Image image = new Gtk.Image();
image.Pixbuf = pixbuf;