From d5ec2ba7cb6c7c657240eb1e68e18da6e4a7b37f Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 27 Feb 2003 05:16:47 +0000 Subject: [PATCH] 2003-02-26 Charles Iliya Krempeaux * configure.in : Added support for Rsvg.NET -- librsvg .NET bindings. (Made a check for the library. And made it so "rsvg/Makefile" would be generated. Also made it so it will display if rsvg-sharp.dll will be generated or not.) * makefile : Added support for Rsvg.NET -- librsvg .NET bindings. (Added an entry for Rsvg.NET.) * sources/gtk-sharp.sources : Added an entry for Rsvg.NET -- librsvg .NET bindings. * rsvg/ : Created "rsvg/" directory. (To hold stuff for Rsvg.NET.) * rsvg/Tool.cs : Created Rsvg.Tool class to hold various procedures (which were not automatically wrapped). * rsvg/Makefile.in : Created "rsvg/Makefile.in". * api/Makefile.in : Added and entry for Rsvg.NET. svn path=/trunk/gtk-sharp/; revision=12020 --- ChangeLog | 19 ++++ api/.cvsignore | 1 - api/Makefile.in | 4 +- api/rsvg-api.xml | 181 ++++++++++++++++++++++++++++++++++++++ configure.in | 11 +++ makefile | 2 +- rsvg/.cvsignore | 4 + rsvg/Makefile.in | 36 ++++++++ rsvg/Tool.cs | 145 ++++++++++++++++++++++++++++++ sources/gtk-sharp.sources | 1 + 10 files changed, 401 insertions(+), 3 deletions(-) create mode 100644 api/rsvg-api.xml create mode 100755 rsvg/.cvsignore create mode 100644 rsvg/Makefile.in create mode 100644 rsvg/Tool.cs diff --git a/ChangeLog b/ChangeLog index 751864ece..2cad3dc13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2003-02-26 Charles Iliya Krempeaux + + * configure.in : Added support for Rsvg.NET -- librsvg + .NET bindings. (Made a check for the library. And + made it so "rsvg/Makefile" would be generated. Also + made it so it will display if rsvg-sharp.dll will + be generated or not.) + * makefile : Added support for Rsvg.NET -- librsvg + .NET bindings. (Added an entry for Rsvg.NET.) + * sources/gtk-sharp.sources : Added an entry for + Rsvg.NET -- librsvg .NET bindings. + * rsvg/ : Created "rsvg/" directory. (To hold stuff + for Rsvg.NET.) + * rsvg/Tool.cs : Created Rsvg.Tool class to hold + various procedures (which were not automatically + wrapped). + * rsvg/Makefile.in : Created "rsvg/Makefile.in". + * api/Makefile.in : Added and entry for Rsvg.NET. + 2003-02-26 Gonzalo Paniagua Javier * generator/Parser.cs: use XmlDocument.Load (Stream). The one using diff --git a/api/.cvsignore b/api/.cvsignore index 5c364cb93..a00c4c6ae 100755 --- a/api/.cvsignore +++ b/api/.cvsignore @@ -1,6 +1,5 @@ *.dll *.exe -*.xml generated generated-stamp Makefile diff --git a/api/Makefile.in b/api/Makefile.in index 33286e4b9..9853a686c 100644 --- a/api/Makefile.in +++ b/api/Makefile.in @@ -10,7 +10,9 @@ APIS = \ gnome-api.xml \ gda-api.xml \ gst-api.xml \ - gnomedb-api.xml + gnomedb-api.xml \ + rsvg-api.xml \ + RUNTIME=mono diff --git a/api/rsvg-api.xml b/api/rsvg-api.xml new file mode 100644 index 000000000..022449453 --- /dev/null +++ b/api/rsvg-api.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/configure.in b/configure.in index de95f2746..a94185954 100644 --- a/configure.in +++ b/configure.in @@ -88,6 +88,14 @@ if test "x$enable_gda" = "xyes"; then fi fi +RSVG_REQUIRED_VERSION=2.0.1 +PKG_CHECK_MODULES(RSVG_DEPENDENCIES, librsvg-2.0 >= $RSVG_REQUIRED_VERSION, enable_rsvg=yes, enable_rsvg=no) +if test "x$enable_rsvg" = "xyes"; then + BASE_DEPENDENCIES_CFLAGS="$BASE_DEPENDENCIES_CFLAGS $RSVG_DEPENDENCIES_CFLAGS" + BASE_DEPENDENCIES_LIBS="$BASE_DEPENDENCIES_LIBS $RSVG_DEPENDENCIES_LIBS" +fi + + AC_SUBST(BASE_DEPENDENCIES_CFLAGS) AC_SUBST(BASE_DEPENDENCIES_LIBS) @@ -95,6 +103,7 @@ AM_CONDITIONAL(ENABLE_GNOME, test "x$enable_gnome" = "xyes") AM_CONDITIONAL(ENABLE_GLADE, test "x$enable_glade" = "xyes") AM_CONDITIONAL(ENABLE_GDA, test "x$enable_gda" = "xyes") AM_CONDITIONAL(ENABLE_GNOMEDB, test "x$enable_gnomedb" = "xyes") +AM_CONDITIONAL(ENABLE_RSVG, test "x$enable_rsvg" = "xyes") AC_SUBST(CFLAGS) @@ -118,6 +127,7 @@ gconf/GConf/Makefile gconf/GConf.PropertyEditors/Makefile gconf/tools/Makefile gst/Makefile +rsvg/Makefile sample/Makefile ]) @@ -132,6 +142,7 @@ echo " * gnome-sharp.dll: $enable_gnome" echo " * glade-sharp.dll: $enable_glade" echo " * gda-sharp.dll: $enable_gda" echo " * gnomedb-sharp.dll: $enable_gnomedb" +echo " * rsvg-sharp.dll: $enable_rsvg " echo "" echo " NOTE: if any of the above say 'no' you may install the" echo " corresponding development packages for them, rerun" diff --git a/makefile b/makefile index df3f304c4..986bbe500 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ NATIVE_DIRS = glue parser -DIRS=generator api glib pango atk gdk gtk glade art gnome gda gnomedb gconf sample +DIRS=generator api glib pango atk gdk gtk glade art gnome gda gnomedb gconf rsvg sample ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT))) CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe MCS=mcs diff --git a/rsvg/.cvsignore b/rsvg/.cvsignore new file mode 100755 index 000000000..14f5b5a7d --- /dev/null +++ b/rsvg/.cvsignore @@ -0,0 +1,4 @@ +*.dll +generated +Makefile + diff --git a/rsvg/Makefile.in b/rsvg/Makefile.in new file mode 100644 index 000000000..d652ff693 --- /dev/null +++ b/rsvg/Makefile.in @@ -0,0 +1,36 @@ +COMPILER=mcs +OUTPUT=rsvg-sharp.dll + +@ENABLE_RSVG_TRUE@ all: linux +@ENABLE_RSVG_FALSE@ all: + +linux: $(OUTPUT) + +$(OUTPUT): *.cs generated/*.cs + $(COMPILER) \ + --unsafe\ + --target library \ + -L ../glib \ + -L ../gdk \ + -L ../gtk \ + -L ../art \ + -r glib-sharp.dll -r gdk-sharp.dll -r gtk-sharp.dll -r art-sharp.dll \ + -o $(OUTPUT) \ + --recurse '*.cs' + + + +clean: clean-dll clean-generated + +clean-dll: + rm -f *.dll + +clean-generated: + rm -rf generated + + + +install: all +@ENABLE_RSVG_TRUE@ ../mkinstalldirs $(DESTDIR)@prefix@/lib && \ +@ENABLE_RSVG_TRUE@ cp $(OUTPUT) $(DESTDIR)@prefix@/lib + diff --git a/rsvg/Tool.cs b/rsvg/Tool.cs new file mode 100644 index 000000000..0173844aa --- /dev/null +++ b/rsvg/Tool.cs @@ -0,0 +1,145 @@ +// +// rsvg/Tool.cs - Rsvg Tool class +// +// Author: Charles Iliya Krempeaux +// +// Copyright (C) 2003 Reptile Consulting & Services Ltd. +// Copyright (C) 2003 Charles Iliya Krempeaux. +// + + + +// O B J E C T S //////////////////////////////////////////////////////////////////////////////////////////////////////////// + + namespace Rsvg { + + class Tool + { + + + // D L L I M P O R T S //////////////////////////////////////////////////////////////////////////////////////// + + [System.Runtime.InteropServices.DllImport("rsvg-2")] + static extern System.IntPtr rsvg_pixbuf_from_file( string file_name + , out System.IntPtr error + ); + + [System.Runtime.InteropServices.DllImport("rsvg-2")] + static extern + System.IntPtr + rsvg_pixbuf_from_file_at_zoom( string file_name + , double x_zoom + , double y_zoom + , out System.IntPtr error + ); + + [System.Runtime.InteropServices.DllImport("rsvg-2")] + static extern + System.IntPtr + rsvg_pixbuf_from_file_at_size( string file_name + , int width + , int height + , out System.IntPtr error + ); + + [System.Runtime.InteropServices.DllImport("rsvg-2")] + static extern + System.IntPtr + rsvg_pixbuf_from_file_at_max_size( string file_name + , int max_width + , int max_height + , out System.IntPtr error + ); + + [System.Runtime.InteropServices.DllImport("rsvg-2")] + static extern + System.IntPtr + rsvg_pixbuf_from_file_at_zoom_with_max( string file_name + , double x_zoom + , double y_zoom + , int max_width + , int max_height + , out System.IntPtr error + ); + + //////////////////////////////////////////////////////////////////////////////////////// D L L I M P O R T S // + + + + // P R O C E D U R E S ////////////////////////////////////////////////////////////////////////////////////////// + + public static Gdk.Pixbuf PixbufFromFile(string file_name) + { + System.IntPtr error = System.IntPtr.Zero; + + System.IntPtr raw_pixbuf = rsvg_pixbuf_from_file(file_name, out error); + + if (System.IntPtr.Zero != error) { + throw new GLib.GException ( error ); + } else { + return new Gdk.Pixbuf( raw_pixbuf ); + } + } + + public static Gdk.Pixbuf PixbufFromFileAtZoom(string file_name, double x_zoom, double y_zoom) + { + System.IntPtr error = System.IntPtr.Zero; + + 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 );; + } else { + return new Gdk.Pixbuf( raw_pixbuf ); + } + } + + public static Gdk.Pixbuf PixbufFromFileAtSize(string file_name, int width, int height) + { + System.IntPtr error = System.IntPtr.Zero; + + 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 );; + } else { + return new Gdk.Pixbuf( raw_pixbuf ); + } + } + + public static Gdk.Pixbuf PixbufFromFileAtMaxSize(string file_name, int max_width, int max_height) + { + System.IntPtr error = System.IntPtr.Zero; + + 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 );; + } else { + return new Gdk.Pixbuf( raw_pixbuf ); + } + } + + public static Gdk.Pixbuf PixbufFromFileAtZoomWithMaxSize(string file_name, double x_zoom, double y_zoom, int max_width, int max_height) + { + System.IntPtr error = System.IntPtr.Zero; + + 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 );; + } else { + return new Gdk.Pixbuf( raw_pixbuf ); + } + } + + ////////////////////////////////////////////////////////////////////////////////////////// P R O C E D U R E S // + + + } // class Tool + + } // namespace Rsvg + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// O B J E C T S // + + diff --git a/sources/gtk-sharp.sources b/sources/gtk-sharp.sources index d8a2c22d6..88b183741 100644 --- a/sources/gtk-sharp.sources +++ b/sources/gtk-sharp.sources @@ -12,3 +12,4 @@ libart_lgpl-2.3.10 Art art_lgpl libgda-0.10.0/libgda Gda gda-2 libgnomedb-0.10.0/libgnomedb GnomeDb gnomedb-2 gstreamer-0.4.2/gst Gst gstreamer +librsvg-2.0.1 Rsvg rsvg-2