From b650e6dfb7940d279e8c81cfe5bb6c08a36372d4 Mon Sep 17 00:00:00 2001 From: John Luke Date: Tue, 24 Aug 2004 20:02:47 +0000 Subject: [PATCH] * rsvg/Pixbuf.custom: new custom file * rsvg/Makefile.am: add Pixbuf.custom to build * rsvg/Tool.cs: remove double ; that cause warnings * rsvg/rsvg-sharp.pc.in: add Requires: gtk-sharp art-sharp svn path=/trunk/gtk-sharp/; revision=32792 --- ChangeLog | 4 ++++ rsvg/Makefile.am | 2 +- rsvg/Pixbuf.custom | 45 +++++++++++++++++++++++++++++++++++++++++++ rsvg/Rsvg.metadata | 1 + rsvg/Tool.cs | 8 ++++---- rsvg/rsvg-sharp.pc.in | 1 + 6 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 rsvg/Pixbuf.custom diff --git a/ChangeLog b/ChangeLog index acb7b7737..fc67e2a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ * gtk/Makefile.am: add Menu.custom * gtk/Menu.custom: new custom for Popup () overload [Fixes #60668] + * rsvg/Pixbuf.custom: new custom file + * rsvg/Makefile.am: add Pixbuf.custom to build + * rsvg/Tool.cs: remove double ; that cause warnings + * rsvg/rsvg-sharp.pc.in: add Requires: gtk-sharp art-sharp 2004-08-24 Larry Ewing diff --git a/rsvg/Makefile.am b/rsvg/Makefile.am index 31bef2884..4f232f0e3 100644 --- a/rsvg/Makefile.am +++ b/rsvg/Makefile.am @@ -28,7 +28,7 @@ sources = \ build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs -customs = +customs = Pixbuf.custom build_customs = $(addprefix $(srcdir)/, $(customs)) diff --git a/rsvg/Pixbuf.custom b/rsvg/Pixbuf.custom new file mode 100644 index 000000000..8a4aee9f8 --- /dev/null +++ b/rsvg/Pixbuf.custom @@ -0,0 +1,45 @@ +// Rsvg.Pixbuf.custom - Rsvg Pixbuf class customizations +// +// Author: John Luke +// +// Copyright (C) 2004 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + public static Gdk.Pixbuf LoadFromResource (string resource) + { + if (resource == null) + throw new ArgumentNullException ("resource"); + + System.IO.Stream s = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (resource); + if (s == null) + throw new ArgumentException ("resource must be a valid resource name of 'assembly'."); + + return LoadFromStream (s); + } + + public static Gdk.Pixbuf LoadFromStream (System.IO.Stream input) + { + Handle loader = new Handle (); + 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; + } diff --git a/rsvg/Rsvg.metadata b/rsvg/Rsvg.metadata index a56b69e6c..2fc4806b0 100644 --- a/rsvg/Rsvg.metadata +++ b/rsvg/Rsvg.metadata @@ -1,4 +1,5 @@ + 1 diff --git a/rsvg/Tool.cs b/rsvg/Tool.cs index e9e1288b7..800990717 100644 --- a/rsvg/Tool.cs +++ b/rsvg/Tool.cs @@ -101,7 +101,7 @@ System.IntPtr raw_pixbuf = rsvg_pixbuf_from_file_at_zoom(file_name, x_zoom, y_zoom, out error); if (System.IntPtr.Zero != error) { - throw new GLib.GException( error );; + throw new GLib.GException( error ); } else { return new Gdk.Pixbuf( raw_pixbuf ); } @@ -114,7 +114,7 @@ System.IntPtr raw_pixbuf = rsvg_pixbuf_from_file_at_size(file_name, width, height, out error); if (System.IntPtr.Zero != error) { - throw new GLib.GException( error );; + throw new GLib.GException( error ); } else { return new Gdk.Pixbuf( raw_pixbuf ); } @@ -127,7 +127,7 @@ System.IntPtr raw_pixbuf = rsvg_pixbuf_from_file_at_max_size(file_name, max_width, max_height, out error); if (System.IntPtr.Zero != error) { - throw new GLib.GException( error );; + throw new GLib.GException( error ); } else { return new Gdk.Pixbuf( raw_pixbuf ); } @@ -140,7 +140,7 @@ System.IntPtr raw_pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max(file_name, x_zoom, y_zoom, max_width, max_height, out error); if (System.IntPtr.Zero != error) { - throw new GLib.GException( error );; + throw new GLib.GException( error ); } else { return new Gdk.Pixbuf( raw_pixbuf ); } diff --git a/rsvg/rsvg-sharp.pc.in b/rsvg/rsvg-sharp.pc.in index f4a3c64ce..c5043bed7 100644 --- a/rsvg/rsvg-sharp.pc.in +++ b/rsvg/rsvg-sharp.pc.in @@ -6,4 +6,5 @@ libdir=${exec_prefix}/lib Name: Rsvg# Description: Rsvg# - librsvg .NET Binding Version: @VERSION@ +Requires: gtk-sharp art-sharp Libs: -r:${libdir}/mono/@PACKAGE@/rsvg-sharp.dll