Commit 1cc3041d authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

depend on poppler-glib >= 0.4.1.

2007-04-27  Sven Neumann  <sven@gimp.org>

	* configure.in: depend on poppler-glib >= 0.4.1.

	* plug-ins/common/poppler.c: removed ifdefs to handle older
	versions of the poppler library. Removed "antialias" toggle from
	the procedure API and from the GUI; it's not supported by poppler.


svn path=/trunk/; revision=22353
parent 25e1872f
2007-04-27 Sven Neumann <sven@gimp.org>
* configure.in: depend on poppler-glib >= 0.4.1.
* plug-ins/common/poppler.c: removed ifdefs to handle older
versions of the poppler library. Removed "antialias" toggle from
the procedure API and from the GUI; it's not supported by poppler.
2007-04-27 Sven Neumann <sven@gimp.org> 2007-04-27 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/truchet.scm: fixed typo in procedure * plug-ins/script-fu/scripts/truchet.scm: fixed typo in procedure
...@@ -51,7 +51,7 @@ m4_define([alsa_required_version], [1.0.0]) ...@@ -51,7 +51,7 @@ m4_define([alsa_required_version], [1.0.0])
m4_define([rsvg_required_version], [2.8.0]) m4_define([rsvg_required_version], [2.8.0])
m4_define([wmf_required_version], [0.2.8]) m4_define([wmf_required_version], [0.2.8])
m4_define([pygtk_required_version], [2.10.4]) m4_define([pygtk_required_version], [2.10.4])
m4_define([poppler_required_version], [0.3.1]) m4_define([poppler_required_version], [0.4.1])
m4_define([gnome_vfs_required_version], [2.10.0]) m4_define([gnome_vfs_required_version], [2.10.0])
m4_define([gnomeui_required_version], [2.10.0]) m4_define([gnomeui_required_version], [2.10.0])
m4_define([gnome_keyring_required_version], [0.4.5]) m4_define([gnome_keyring_required_version], [0.4.5])
...@@ -1248,18 +1248,6 @@ fi ...@@ -1248,18 +1248,6 @@ fi
AC_SUBST(POPPLER) AC_SUBST(POPPLER)
AC_SUBST(LIBPOPPLER) AC_SUBST(LIBPOPPLER)
if test "x$have_poppler" = xyes; then
if $PKG_CONFIG --atleast-version=0.4 poppler-glib; then
AC_DEFINE(HAVE_POPPLER_0_4, 1,
[Define to 1 if libpoppler >= 0.4 is available])
fi
if $PKG_CONFIG --atleast-version=0.4.1 poppler-glib; then
AC_DEFINE(HAVE_POPPLER_0_4_1, 1,
[Define to 1 if libpoppler >= 0.4.1 is available])
fi
fi
############################################################################### ###############################################################################
# Check for gnome-vfs and libcurl (and optionally libgnomeui and gnome-keyring) # Check for gnome-vfs and libcurl (and optionally libgnomeui and gnome-keyring)
......
...@@ -43,14 +43,12 @@ typedef struct ...@@ -43,14 +43,12 @@ typedef struct
{ {
GimpPageSelectorTarget target; GimpPageSelectorTarget target;
gdouble resolution; gdouble resolution;
gboolean antialias;
} PdfLoadVals; } PdfLoadVals;
static PdfLoadVals loadvals = static PdfLoadVals loadvals =
{ {
GIMP_PAGE_SELECTOR_TARGET_LAYERS, GIMP_PAGE_SELECTOR_TARGET_LAYERS,
100.00, /* 100 dpi */ 100.00 /* 100 dpi */
TRUE /* antialias */
}; };
typedef struct typedef struct
...@@ -72,7 +70,6 @@ static gint32 load_image (PopplerDocument *doc, ...@@ -72,7 +70,6 @@ static gint32 load_image (PopplerDocument *doc,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpPageSelectorTarget target, GimpPageSelectorTarget target,
guint32 resolution, guint32 resolution,
gboolean antialias,
PdfSelectedPages *pages); PdfSelectedPages *pages);
static gboolean load_dialog (PopplerDocument *doc, static gboolean load_dialog (PopplerDocument *doc,
...@@ -111,20 +108,19 @@ query (void) ...@@ -111,20 +108,19 @@ query (void)
{ GIMP_PDB_STRING, "filename", "The name of the file to load" }, { GIMP_PDB_STRING, "filename", "The name of the file to load" },
{ GIMP_PDB_STRING, "raw-filename", "The name entered" }, { GIMP_PDB_STRING, "raw-filename", "The name entered" },
{ GIMP_PDB_INT32, "resolution", "Resolution to rasterize to (dpi)" }, { GIMP_PDB_INT32, "resolution", "Resolution to rasterize to (dpi)" },
{ GIMP_PDB_INT32, "antialias", "Whether to antialias" },
{ GIMP_PDB_INT32, "n-pages", "Number of pages to load (0 for all)" }, { GIMP_PDB_INT32, "n-pages", "Number of pages to load (0 for all)" },
{ GIMP_PDB_INT32ARRAY,"page", "The pages to load" } { GIMP_PDB_INT32ARRAY,"pages", "The pages to load" }
}; };
static const GimpParamDef load_return_vals[] = static const GimpParamDef load_return_vals[] =
{ {
{ GIMP_PDB_IMAGE, "image", "Output image" } { GIMP_PDB_IMAGE, "image", "Output image" }
}; };
static const GimpParamDef thumb_args[] = static const GimpParamDef thumb_args[] =
{ {
{ GIMP_PDB_STRING, "filename", "The name of the file to load" }, { GIMP_PDB_STRING, "filename", "The name of the file to load" },
{ GIMP_PDB_INT32, "thumb-size", "Preferred thumbnail size" } { GIMP_PDB_INT32, "thumb-size", "Preferred thumbnail size" }
}; };
static const GimpParamDef thumb_return_vals[] = static const GimpParamDef thumb_return_vals[] =
...@@ -227,8 +223,7 @@ run (const gchar *name, ...@@ -227,8 +223,7 @@ run (const gchar *name,
case GIMP_RUN_WITH_LAST_VALS: case GIMP_RUN_WITH_LAST_VALS:
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
/* bah! hardly any file plugins work non-interactively. /* FIXME: implement non-interactive mode */
* why should we? */
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
break; break;
} }
...@@ -239,7 +234,6 @@ run (const gchar *name, ...@@ -239,7 +234,6 @@ run (const gchar *name,
run_mode, run_mode,
loadvals.target, loadvals.target,
loadvals.resolution, loadvals.resolution,
loadvals.antialias,
pages); pages);
if (image_ID != -1) if (image_ID != -1)
...@@ -268,11 +262,11 @@ run (const gchar *name, ...@@ -268,11 +262,11 @@ run (const gchar *name,
} }
else else
{ {
gdouble width = 0; gdouble width = 0;
gdouble height = 0; gdouble height = 0;
gdouble scale; gdouble scale;
gint32 image = -1; gint32 image = -1;
GdkPixbuf *buf = NULL; GdkPixbuf *pixbuf = NULL;
/* Possibly retrieve last settings */ /* Possibly retrieve last settings */
gimp_get_data (LOAD_PROC, &loadvals); gimp_get_data (LOAD_PROC, &loadvals);
...@@ -282,6 +276,7 @@ run (const gchar *name, ...@@ -282,6 +276,7 @@ run (const gchar *name,
if (doc) if (doc)
{ {
PopplerPage *page = poppler_document_get_page (doc, 0); PopplerPage *page = poppler_document_get_page (doc, 0);
if (page) if (page)
{ {
poppler_page_get_size (page, &width, &height); poppler_page_get_size (page, &width, &height);
...@@ -289,38 +284,35 @@ run (const gchar *name, ...@@ -289,38 +284,35 @@ run (const gchar *name,
g_object_unref (page); g_object_unref (page);
} }
buf = get_thumbnail (doc, 0, param[1].data.d_int32); pixbuf = get_thumbnail (doc, 0, param[1].data.d_int32);
g_object_unref (doc);
} }
if (buf) if (pixbuf)
{ {
image = gimp_image_new (gdk_pixbuf_get_width (buf), image = gimp_image_new (gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (buf), gdk_pixbuf_get_height (pixbuf),
GIMP_RGB); GIMP_RGB);
gimp_image_undo_disable (image); gimp_image_undo_disable (image);
layer_from_pixbuf (image, "thumbnail", 0, buf, 0.0, 1.0);
layer_from_pixbuf (image, "thumbnail", 0, pixbuf, 0.0, 1.0);
g_object_unref (pixbuf);
gimp_image_undo_enable (image); gimp_image_undo_enable (image);
gimp_image_clean_all (image); gimp_image_clean_all (image);
} }
scale = loadvals.resolution / gimp_unit_get_factor (GIMP_UNIT_POINT);
scale = loadvals.resolution /
gimp_unit_get_factor (GIMP_UNIT_POINT);
width *= scale; width *= scale;
height *= scale; height *= scale;
if (doc)
g_object_unref (doc);
if (buf)
g_object_unref (buf);
if (image != -1) if (image != -1)
{ {
*nreturn_vals = 4; *nreturn_vals = 4;
values[1].type = GIMP_PDB_IMAGE;
values[1].type = GIMP_PDB_IMAGE;
values[1].data.d_image = image; values[1].data.d_image = image;
values[2].type = GIMP_PDB_INT32; values[2].type = GIMP_PDB_INT32;
values[2].data.d_int32 = width; values[2].data.d_int32 = width;
...@@ -332,6 +324,7 @@ run (const gchar *name, ...@@ -332,6 +324,7 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }
} }
} }
else else
{ {
...@@ -399,7 +392,6 @@ load_image (PopplerDocument *doc, ...@@ -399,7 +392,6 @@ load_image (PopplerDocument *doc,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpPageSelectorTarget target, GimpPageSelectorTarget target,
guint32 resolution, guint32 resolution,
gboolean antialias,
PdfSelectedPages *pages) PdfSelectedPages *pages)
{ {
gint32 image_ID = 0; gint32 image_ID = 0;
...@@ -418,10 +410,6 @@ load_image (PopplerDocument *doc, ...@@ -418,10 +410,6 @@ load_image (PopplerDocument *doc,
/* read the file */ /* read the file */
#if 0
poppler_set_antialias (antialias);
#endif
for (i = 0; i < pages->n_pages; i++) for (i = 0; i < pages->n_pages; i++)
{ {
PopplerPage *page; PopplerPage *page;
...@@ -461,17 +449,7 @@ load_image (PopplerDocument *doc, ...@@ -461,17 +449,7 @@ load_image (PopplerDocument *doc,
buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
poppler_page_render_to_pixbuf (page, 0, 0, poppler_page_render_to_pixbuf (page, 0, 0, width, height, scale, 0, buf);
width, height,
scale,
#ifdef HAVE_POPPLER_0_4_1
0,
#endif
buf
#ifndef HAVE_POPPLER_0_4
, 0, 0
#endif
);
layer_from_pixbuf (image_ID, page_label, i, buf, layer_from_pixbuf (image_ID, page_label, i, buf,
doc_progress, 1.0 / pages->n_pages); doc_progress, 1.0 / pages->n_pages);
...@@ -535,11 +513,13 @@ get_thumbnail (PopplerDocument *doc, ...@@ -535,11 +513,13 @@ get_thumbnail (PopplerDocument *doc,
if (! pixbuf) if (! pixbuf)
{ {
double width, height, scale; gdouble width;
gdouble height;
gdouble scale;
poppler_page_get_size (page, &width, &height); poppler_page_get_size (page, &width, &height);
scale = (double) preferred_size / MAX (width, height); scale = (gdouble) preferred_size / MAX (width, height);
width *= scale; width *= scale;
height *= scale; height *= scale;
...@@ -547,17 +527,8 @@ get_thumbnail (PopplerDocument *doc, ...@@ -547,17 +527,8 @@ get_thumbnail (PopplerDocument *doc,
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
width, height); width, height);
poppler_page_render_to_pixbuf (page, 0, 0, poppler_page_render_to_pixbuf (page,
width, height, 0, 0, width, height, scale, 0, pixbuf);
scale,
#ifdef HAVE_POPPLER_0_4_1
0,
#endif
pixbuf
#ifndef HAVE_POPPLER_0_4
,0, 0
#endif
);
} }
g_object_unref (page); g_object_unref (page);
...@@ -631,7 +602,6 @@ load_dialog (PopplerDocument *doc, ...@@ -631,7 +602,6 @@ load_dialog (PopplerDocument *doc,
GtkWidget *title; GtkWidget *title;
GtkWidget *selector; GtkWidget *selector;
GtkWidget *resolution; GtkWidget *resolution;
GtkWidget *toggle;
GtkWidget *hbox; GtkWidget *hbox;
ThreadData thread_data; ThreadData thread_data;
...@@ -732,15 +702,6 @@ load_dialog (PopplerDocument *doc, ...@@ -732,15 +702,6 @@ load_dialog (PopplerDocument *doc,
G_CALLBACK (gimp_resolution_entry_update_x_in_dpi), G_CALLBACK (gimp_resolution_entry_update_x_in_dpi),
&loadvals.resolution); &loadvals.resolution);
/* Antialiasing */
toggle = gtk_check_button_new_with_mnemonic (_("A_ntialiasing"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), loadvals.antialias);
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&loadvals.antialias);
/* Setup done; display the dialog */ /* Setup done; display the dialog */
gtk_widget_show (dialog); gtk_widget_show (dialog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment