diff --git a/sample/rsvg/SvgFromResource.cs b/sample/rsvg/SvgFromResource.cs new file mode 100644 index 000000000..e98682b69 --- /dev/null +++ b/sample/rsvg/SvgFromResource.cs @@ -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 (); + } +} + diff --git a/sample/rsvg/SvgFromStream.cs b/sample/rsvg/SvgFromStream.cs new file mode 100644 index 000000000..a307bae54 --- /dev/null +++ b/sample/rsvg/SvgFromStream.cs @@ -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 (); + } +} + diff --git a/sample/rsvg/svghelloworld.cs b/sample/rsvg/svghelloworld.cs index 106a2241b..1988b0a16 100644 --- a/sample/rsvg/svghelloworld.cs +++ b/sample/rsvg/svghelloworld.cs @@ -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;