summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <doml@src.gnome.org>2003-03-18 00:26:49 +0000
committerDom Lachowicz <doml@src.gnome.org>2003-03-18 00:26:49 +0000
commitdbbe4d9ea95f18e6b256a0c0ff73af6949464899 (patch)
tree5a3efc7a8bef8b0894dc0711bfb8b89642d0bf65
parent8def940a99df991c0193a460fc9ae7c241704d61 (diff)
downloadlibrsvg-dbbe4d9ea95f18e6b256a0c0ff73af6949464899.tar.gz
rsvg can now be used as a gimp plugin
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.am2
-rw-r--r--NEWS9
-rw-r--r--configure.in30
-rw-r--r--gimp-plugin/Makefile.am27
-rw-r--r--gimp-plugin/README4
-rw-r--r--gimp-plugin/svg.c47
7 files changed, 106 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index f48d7939..3a131d54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-17 Dom Lachowicz <cinamod@hotmail.com>
+
+ * Makefile.am: additions for GIMP support
+ * configure.in: ditto
+ * gimp-plugin/Makefile.am: ditto
+ * gimp-plugin/svg.c: ditto
+ * NEWS: update to mention GIMP plugin
+
2003-03-14 Dom Lachowicz <cinamod@hotmail.com>
* rsvg-path.c (rsvg_path_arc): Fix NaN issue, bug 108380
diff --git a/Makefile.am b/Makefile.am
index f59b8eae..9120b4b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . gtk-engine gdk-pixbuf-loader doc
+SUBDIRS = . gtk-engine gdk-pixbuf-loader doc gimp-plugin
bin_PROGRAMS = rsvg
diff --git a/NEWS b/NEWS
index 9c4dfc0c..e0ffa11e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+Version 2.2.5
+
+- Gimp Import/Load plugin
+- Bugfixes
+
+Version 2.2.4
+
+- Few bugfixes
+
Version 2.2.3
- All sorts of build and installation fixes
diff --git a/configure.in b/configure.in
index 11285836..c2476811 100644
--- a/configure.in
+++ b/configure.in
@@ -117,7 +117,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wcast-align -Wsign-compare \
- -Werror \
+ -Werror \
$CFLAGS"
for option in -Wsign-promo -Wno-sign-compare; do
@@ -229,6 +229,33 @@ AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
dnl ===========================================================================
+LIBGIMP_CFLAGS=""
+LIBGIMP_LIBS=""
+LIBGIMPPKG=""
+
+test_gimp=true
+AC_ARG_WITH(gimp,[ --with-gimp Build a gimp plugin],[
+ if test "x$withval" = "xno"; then
+ test_gimp=false
+ fi
+])
+if test "x$test_gimp" = "xtrue"; then
+ PKG_CHECK_MODULES(LIBGIMP,[gimp-1.3 >= 1.3.10], test_gimp=true, test_gimp=false)
+fi
+
+if test "x$test_gimp" = "xtrue"; then
+ LIBGIMP_CFLAGS="$LIBGIMP_CFLAGS"
+ LIBGIMPPKG="gimp-1.3"
+else
+ AC_MSG_WARN([Gimp plugin disbled, as requested (Use --with-gimp to enable)])
+fi
+AM_CONDITIONAL(ENABLE_GIMP_PLUGIN,[test "$LIBGIMPPKG" != ""])
+
+AC_SUBST(LIBGIMP_CFLAGS)
+AC_SUBST(LIBGIMP_LIBS)
+
+dnl ===========================================================================
+
AC_OUTPUT([
librsvg.spec
librsvg-features.h
@@ -240,4 +267,5 @@ gtk-engine/examples/Makefile
gtk-engine/examples/bubble/Makefile
gtk-engine/examples/bubble/gtk-2.0/Makefile
gdk-pixbuf-loader/Makefile
+gimp-plugin/Makefile
])
diff --git a/gimp-plugin/Makefile.am b/gimp-plugin/Makefile.am
new file mode 100644
index 00000000..93087159
--- /dev/null
+++ b/gimp-plugin/Makefile.am
@@ -0,0 +1,27 @@
+gimpdir = $(libdir)/gimp/1.3/plug-ins
+
+INCLUDES = \
+ $(LIBRSVG_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(LIBGIMP_CFLAGS) \
+ -I$(top_srcdir)
+
+if ENABLE_GIMP_PLUGIN
+gimp_PROGRAMS = svg
+else
+gimp_PROGRAMS =
+endif
+
+DEPS = $(top_builddir)/librsvg-2.la
+LDADDS =$(LIBGSF_LIBS)\
+ $(LIBGIMP_LIBS)\
+ $(top_builddir)/librsvg-2.la \
+ $(LIBRSVG_LIBS)
+
+svg_SOURCES=svg.c
+svg_LDFLAGS = -avoid-version -module
+svg_DEPENDENCIES = $(DEPS)
+svg_LDADD = $(LDADDS) -lm
+
+install-%: %
+ $(mkinstalldirs) $(gimpdir)
diff --git a/gimp-plugin/README b/gimp-plugin/README
deleted file mode 100644
index 6ed0366d..00000000
--- a/gimp-plugin/README
+++ /dev/null
@@ -1,4 +0,0 @@
-svg.c is a temporary copy of a plugin I'm hoping to get pushed up into The Gimp
-proper. Until then, this is just a play/staging area, and a place for Gimp
-people to grab this plugin from, and perhaps come up with a build system for,
-as my auto* foo is horrible.
diff --git a/gimp-plugin/svg.c b/gimp-plugin/svg.c
index 9efb9e7a..505b0589 100644
--- a/gimp-plugin/svg.c
+++ b/gimp-plugin/svg.c
@@ -28,11 +28,11 @@
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
-#include <librsvg/rsvg.h>
-#include "libgimp/stdplugins-intl.h"
+#include <rsvg.h>
+
+/* TODO: remove me, initialize gimp i18n services */
+#define _(String) (String)
-/* Declare local functions.
- */
static void query (void);
static void run (gchar *name,
gint nparams,
@@ -43,13 +43,24 @@ static gint32 load_image (gchar *filename,
GimpRunMode runmode,
gboolean preview);
+GimpPlugInInfo PLUG_IN_INFO = {
+ NULL, /* init_proc */
+ NULL, /* quit_proc */
+ query, /* query_proc */
+ run, /* run_proc */
+};
+
MAIN ()
+/*
+ * 'query()' - Respond to a plug-in query...
+ */
static void
query (void)
{
static GimpParamDef load_args[] =
{
+ { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_STRING, "filename", "The name of the file to load" },
{ GIMP_PDB_STRING, "raw_filename", "The name of the file to load" }
};
@@ -59,11 +70,11 @@ query (void)
};
gimp_install_procedure ("file_svg_load",
- "loads files in the SVG file format",
- "loads files in the SVG file format",
- "Dom Lachowicz",
- "Dom Lachowicz",
- "2002",
+ "Loads files in the SVG file format",
+ "Loads files in the SVG file format",
+ "Dom Lachowicz <cinamod@hotmail.com>",
+ "Dom Lachowicz <cinamod@hotmail.com>",
+ "(c) 2003 - " VERSION,
"<Load>/SVG",
NULL,
GIMP_PLUGIN,
@@ -72,15 +83,13 @@ query (void)
load_args, load_return_vals);
gimp_register_magic_load_handler ("file_svg_load",
- "svg",
- "",
+ "svg", "",
"0,string,<?xml,0,string,<svg");
}
/*
* 'run()' - Run the plug-in...
*/
-
static void
run (gchar *name,
gint nparams,
@@ -101,9 +110,12 @@ run (gchar *name,
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
+ /* MUST call this before any RSVG funcs */
+ g_type_init ();
+
if (strcmp (name, "file_svg_load") == 0)
{
- INIT_I18N_UI ();
+ /* INIT_I18N_UI (); */
image_ID = load_image (param[1].data.d_string, run_mode, FALSE);
if (image_ID != -1)
@@ -124,7 +136,6 @@ run (gchar *name,
/*
* 'load_image()' - Load a SVG image into a new image window.
*/
-
static gint32
load_image (gchar *filename, /* I - File to load */
GimpRunMode runmode,
@@ -157,12 +168,18 @@ load_image (gchar *filename, /* I - File to load */
image = gimp_image_new (gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
GIMP_RGB);
+ if (image == -1)
+ {
+ g_message ("Can't allocate new image\n%s", filename);
+ gimp_quit ();
+ }
+
gimp_image_set_filename (image, filename);
layer = gimp_layer_new (image, _("Background"),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
- GIMP_RGB_IMAGE, 100, GIMP_NORMAL_MODE);
+ GIMP_RGBA_IMAGE, 100, GIMP_NORMAL_MODE);
drawable = gimp_drawable_get (layer);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0,